@fugood/bricks-ctor 2.25.0-beta.60 → 2.25.0-beta.62
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/package.json +4 -28
- package/tools/__tests__/legacy-forwarder.test.js +91 -0
- package/tools/_forward.ts +26 -0
- package/tools/deploy.ts +3 -175
- package/tools/mcp-server.ts +3 -35
- package/tools/postinstall.ts +3 -291
- package/tools/pull.ts +3 -198
- package/tools/push-config.ts +3 -113
- package/tools/simulator.ts +3 -149
- package/compile/__tests__/config-diff.test.js +0 -100
- package/compile/__tests__/index.test.js +0 -461
- package/compile/__tests__/util.test.js +0 -450
- package/compile/action-name-map.ts +0 -1079
- package/compile/config-diff.ts +0 -155
- package/compile/index.ts +0 -1594
- package/compile/util.ts +0 -482
- package/index.ts +0 -6
- package/skills/bricks-ctor/SKILL.md +0 -38
- package/skills/bricks-ctor/references/animation.md +0 -160
- package/skills/bricks-ctor/references/architecture-patterns.md +0 -88
- package/skills/bricks-ctor/references/automations.md +0 -232
- package/skills/bricks-ctor/references/buttress.md +0 -245
- package/skills/bricks-ctor/references/data-calculation.md +0 -252
- package/skills/bricks-ctor/references/local-sync.md +0 -129
- package/skills/bricks-ctor/references/media-flow.md +0 -165
- package/skills/bricks-ctor/references/remote-data-bank.md +0 -196
- package/skills/bricks-ctor/references/simulator.md +0 -132
- package/skills/bricks-ctor/references/source-editing-tools.md +0 -81
- package/skills/bricks-ctor/references/standby-transition.md +0 -124
- package/skills/bricks-ctor/references/verification-toolchain.md +0 -200
- package/skills/bricks-design/SKILL.md +0 -171
- package/skills/bricks-design/references/architecture-truths.md +0 -132
- package/skills/bricks-design/references/avoiding-complexity.md +0 -91
- package/skills/bricks-design/references/design-critique.md +0 -195
- package/skills/bricks-design/references/design-languages.md +0 -265
- package/skills/bricks-design/references/performance.md +0 -116
- package/skills/bricks-design/references/presentation-and-slideshow.md +0 -137
- package/skills/bricks-design/references/translating-inputs.md +0 -152
- package/skills/bricks-design/references/variations-and-tweaks.md +0 -124
- package/skills/bricks-design/references/when-the-brief-is-branded.md +0 -284
- package/skills/bricks-design/references/when-the-brief-is-vague.md +0 -85
- package/skills/bricks-design/references/workflow.md +0 -134
- package/skills/bricks-ux/SKILL.md +0 -114
- package/skills/bricks-ux/references/accessibility.md +0 -162
- package/skills/bricks-ux/references/flow-states.md +0 -175
- package/skills/bricks-ux/references/interaction-archetypes.md +0 -189
- package/skills/bricks-ux/references/monitoring-screens.md +0 -153
- package/skills/bricks-ux/references/pressable-composition.md +0 -126
- package/skills/bricks-ux/references/user-journey.md +0 -168
- package/skills/bricks-ux/references/ux-critique.md +0 -256
- package/skills/rive-marketplace/SKILL.md +0 -99
- package/tools/__tests__/_cli-error.test.ts +0 -35
- package/tools/__tests__/_mcp-config.test.ts +0 -67
- package/tools/__tests__/pull.test.ts +0 -108
- package/tools/_cli-error.ts +0 -17
- package/tools/_edits-log.ts +0 -41
- package/tools/_git-author.ts +0 -37
- package/tools/_last-pushed-commit.ts +0 -28
- package/tools/_mcp-config.ts +0 -42
- package/tools/_shell.ts +0 -180
- package/tools/icons/.gitattributes +0 -1
- package/tools/icons/fa6pro-glyphmap.json +0 -4686
- package/tools/icons/fa6pro-meta.json +0 -1
- package/tools/mcp-env.ts +0 -13
- package/tools/mcp-tools/__tests__/data-calc-editing.test.js +0 -516
- package/tools/mcp-tools/__tests__/entry-editing.test.js +0 -866
- package/tools/mcp-tools/__tests__/huggingface.test.ts +0 -49
- package/tools/mcp-tools/__tests__/icons.test.ts +0 -21
- package/tools/mcp-tools/__tests__/mcp-env.test.js +0 -19
- package/tools/mcp-tools/_editing-helpers.ts +0 -98
- package/tools/mcp-tools/_verify.ts +0 -50
- package/tools/mcp-tools/compile.ts +0 -104
- package/tools/mcp-tools/data-calc-editing.ts +0 -1311
- package/tools/mcp-tools/entry-editing.ts +0 -2297
- package/tools/mcp-tools/huggingface.ts +0 -772
- package/tools/mcp-tools/icons.ts +0 -97
- package/tools/mcp-tools/lottie.ts +0 -102
- package/tools/mcp-tools/media.ts +0 -113
- package/tools/simulator-main.mjs +0 -488
- package/tools/simulator-preload.cjs +0 -16
- package/types/animation.d.ts +0 -116
- package/types/automation.d.ts +0 -231
- package/types/brick-base.d.ts +0 -80
- package/types/bricks/Camera.d.ts +0 -246
- package/types/bricks/Chart.d.ts +0 -372
- package/types/bricks/GenerativeMedia.d.ts +0 -290
- package/types/bricks/Icon.d.ts +0 -98
- package/types/bricks/Image.d.ts +0 -126
- package/types/bricks/Items.d.ts +0 -480
- package/types/bricks/Lottie.d.ts +0 -168
- package/types/bricks/Maps.d.ts +0 -262
- package/types/bricks/QrCode.d.ts +0 -117
- package/types/bricks/Rect.d.ts +0 -150
- package/types/bricks/RichText.d.ts +0 -131
- package/types/bricks/Rive.d.ts +0 -220
- package/types/bricks/Scene3D.d.ts +0 -676
- package/types/bricks/Sketch.d.ts +0 -256
- package/types/bricks/Slideshow.d.ts +0 -201
- package/types/bricks/Svg.d.ts +0 -99
- package/types/bricks/Text.d.ts +0 -148
- package/types/bricks/TextInput.d.ts +0 -242
- package/types/bricks/Video.d.ts +0 -242
- package/types/bricks/VideoStreaming.d.ts +0 -112
- package/types/bricks/WebRtcStream.d.ts +0 -65
- package/types/bricks/WebView.d.ts +0 -168
- package/types/bricks/index.d.ts +0 -23
- package/types/canvas.d.ts +0 -82
- package/types/common.d.ts +0 -141
- package/types/data-calc-command/base.d.ts +0 -57
- package/types/data-calc-command/collection.d.ts +0 -418
- package/types/data-calc-command/color.d.ts +0 -432
- package/types/data-calc-command/constant.d.ts +0 -50
- package/types/data-calc-command/datetime.d.ts +0 -147
- package/types/data-calc-command/file.d.ts +0 -129
- package/types/data-calc-command/index.d.ts +0 -13
- package/types/data-calc-command/iteratee.d.ts +0 -23
- package/types/data-calc-command/logictype.d.ts +0 -190
- package/types/data-calc-command/math.d.ts +0 -275
- package/types/data-calc-command/object.d.ts +0 -119
- package/types/data-calc-command/sandbox.d.ts +0 -66
- package/types/data-calc-command/string.d.ts +0 -407
- package/types/data-calc-script.d.ts +0 -21
- package/types/data-calc.d.ts +0 -12
- package/types/data.d.ts +0 -97
- package/types/generators/AlarmClock.d.ts +0 -110
- package/types/generators/Assistant.d.ts +0 -640
- package/types/generators/BleCentral.d.ts +0 -247
- package/types/generators/BlePeripheral.d.ts +0 -208
- package/types/generators/CanvasMap.d.ts +0 -74
- package/types/generators/CastlesPay.d.ts +0 -87
- package/types/generators/DataBank.d.ts +0 -160
- package/types/generators/File.d.ts +0 -432
- package/types/generators/GraphQl.d.ts +0 -132
- package/types/generators/Http.d.ts +0 -222
- package/types/generators/HttpServer.d.ts +0 -230
- package/types/generators/Information.d.ts +0 -103
- package/types/generators/Intent.d.ts +0 -168
- package/types/generators/Iterator.d.ts +0 -108
- package/types/generators/Keyboard.d.ts +0 -105
- package/types/generators/LlmAnthropicCompat.d.ts +0 -212
- package/types/generators/LlmAppleBuiltin.d.ts +0 -159
- package/types/generators/LlmGgml.d.ts +0 -903
- package/types/generators/LlmMediaTekNeuroPilot.d.ts +0 -235
- package/types/generators/LlmMlx.d.ts +0 -228
- package/types/generators/LlmOnnx.d.ts +0 -213
- package/types/generators/LlmOpenAiCompat.d.ts +0 -312
- package/types/generators/LlmQualcommAiEngine.d.ts +0 -247
- package/types/generators/Mcp.d.ts +0 -637
- package/types/generators/McpServer.d.ts +0 -289
- package/types/generators/MediaFlow.d.ts +0 -170
- package/types/generators/MqttBroker.d.ts +0 -141
- package/types/generators/MqttClient.d.ts +0 -141
- package/types/generators/Question.d.ts +0 -408
- package/types/generators/RealtimeTranscription.d.ts +0 -287
- package/types/generators/RerankerGgml.d.ts +0 -195
- package/types/generators/SerialPort.d.ts +0 -151
- package/types/generators/SoundPlayer.d.ts +0 -94
- package/types/generators/SoundRecorder.d.ts +0 -139
- package/types/generators/SpeechToTextGgml.d.ts +0 -424
- package/types/generators/SpeechToTextOnnx.d.ts +0 -236
- package/types/generators/SpeechToTextPlatform.d.ts +0 -85
- package/types/generators/SqLite.d.ts +0 -159
- package/types/generators/Step.d.ts +0 -107
- package/types/generators/SttAppleBuiltin.d.ts +0 -153
- package/types/generators/Tcp.d.ts +0 -126
- package/types/generators/TcpServer.d.ts +0 -147
- package/types/generators/TextToSpeechAppleBuiltin.d.ts +0 -127
- package/types/generators/TextToSpeechGgml.d.ts +0 -221
- package/types/generators/TextToSpeechOnnx.d.ts +0 -178
- package/types/generators/TextToSpeechOpenAiLike.d.ts +0 -121
- package/types/generators/ThermalPrinter.d.ts +0 -193
- package/types/generators/Tick.d.ts +0 -83
- package/types/generators/Udp.d.ts +0 -120
- package/types/generators/VadGgml.d.ts +0 -260
- package/types/generators/VadOnnx.d.ts +0 -231
- package/types/generators/VadTraditional.d.ts +0 -138
- package/types/generators/VectorStore.d.ts +0 -257
- package/types/generators/Watchdog.d.ts +0 -107
- package/types/generators/WebCrawler.d.ts +0 -103
- package/types/generators/WebRtc.d.ts +0 -181
- package/types/generators/WebSocket.d.ts +0 -148
- package/types/generators/index.d.ts +0 -57
- package/types/index.d.ts +0 -13
- package/types/subspace.d.ts +0 -60
- package/types/switch.d.ts +0 -51
- package/types/system.d.ts +0 -707
- package/utils/__tests__/calc.test.js +0 -25
- package/utils/__tests__/id.test.js +0 -154
- package/utils/calc.ts +0 -130
- package/utils/data.ts +0 -495
- package/utils/event-props.ts +0 -912
- package/utils/id.ts +0 -133
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"0":["100","ad","add","adjust","air-freshener","alien-monster","allergies","ambulance","american-sign-language-interpreting","analytics","angle-double-down","angle-double-left","angle-double-right","angle-double-up","angry","apple-alt","apple-crate","archive","area-chart","arrow-alt-circle-down","arrow-alt-circle-left","arrow-alt-circle-right","arrow-alt-circle-up","arrow-alt-down","arrow-alt-from-bottom","arrow-alt-from-left","arrow-alt-from-right","arrow-alt-from-top","arrow-alt-left","arrow-alt-right","arrow-alt-square-down","arrow-alt-square-left","arrow-alt-square-right","arrow-alt-square-up","arrow-alt-to-bottom","arrow-alt-to-left","arrow-alt-to-right","arrow-alt-to-top","arrow-alt-up","arrow-circle-down","arrow-circle-left","arrow-circle-right","arrow-circle-up","arrow-from-bottom","arrow-from-left","arrow-from-right","arrow-from-top","arrow-left-rotate","arrow-right-from-file","arrow-right-rotate","arrow-right-to-file","arrow-rotate-back","arrow-rotate-backward","arrow-rotate-forward","arrow-square-down","arrow-square-left","arrow-square-right","arrow-square-up","arrow-to-bottom","arrow-to-left","arrow-to-right","arrow-to-top","arrow-turn-right","arrows","arrows-alt","arrows-alt-h","arrows-alt-v","arrows-h","arrows-v","asl-interpreting","assistive-listening-systems","atlas","atom-alt","automobile","backspace","balance-scale","balance-scale-left","balance-scale-right","band-aid","bank","bar-chart","barcode-alt","barn-silo","baseball-ball","basketball-ball","bathtub","battery","battery-0","battery-1","battery-2","battery-3","battery-4","battery-5","battery-car","bed-alt","beer","beer-foam","behance-square","betamax","bible","biking","biking-mountain","birthday-cake","blackboard","blind","book-alt","book-circle","book-dead","book-law","book-open-alt","book-reader","book-spells","bookmark-circle","border-style","border-style-alt","bowl-salad","bowl-shaved-ice","box-alt","box-fragile","box-full","box-up","box-usd","boxes","boxes-alt","bracket","bracket-curly-left","bracket-left","brackets","briefcase-clock","broadcast-tower","burn","bus-alt","business-front","cab","cake","calculator-alt","calendar-alt","calendar-circle","calendar-download","calendar-edit","calendar-note","calendar-time","calendar-times","calendar-upload","camera-alt","camera-circle","camera-home","cancel","car-alt","car-crash","car-mechanic","caravan-alt","caret-circle-down","caret-circle-left","caret-circle-right","caret-circle-up","caret-square-down","caret-square-left","caret-square-right","caret-square-up","carriage-baby","cctv","chain","chain-broken","chain-horizontal","chain-horizontal-slash","chain-slash","chalkboard-teacher","chart-pie-alt","check-circle","check-square","cheeseburger","chess-bishop-alt","chess-clock-alt","chess-king-alt","chess-knight-alt","chess-pawn-alt","chess-queen-alt","chess-rook-alt","chevron-circle-down","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-double-down","chevron-double-left","chevron-double-right","chevron-double-up","chevron-square-down","chevron-square-left","chevron-square-right","chevron-square-up","child-rifle","chocolate-bar","clinic-medical","clock-four","close","cloud-download","cloud-download-alt","cloud-upload","cloud-upload-alt","cny","cocktail","coffee","coffee-togo","cog","cogs","columns","comment-alt","comment-alt-arrow-down","comment-alt-arrow-up","comment-alt-captions","comment-alt-check","comment-alt-dollar","comment-alt-dots","comment-alt-edit","comment-alt-exclamation","comment-alt-image","comment-alt-lines","comment-alt-medical","comment-alt-minus","comment-alt-music","comment-alt-plus","comment-alt-quote","comment-alt-slash","comment-alt-smile","comment-alt-text","comment-alt-times","comment-edit","comment-middle-alt","comment-middle-top-alt","comment-times","commenting","comments-alt","comments-alt-dollar","compress-alt","compress-arrows","compress-arrows-alt","concierge-bell","construction","contact-book","contact-card","conveyor-belt-alt","couch-small","cowbell-more","credit-card-alt","creemee","cricket","crop-alt","curling","cut","cutlery","dashboard","deaf","deafness","debug","dedent","desktop-alt","desktop-code","desktop-medical","desktop-slash","dewpoint","diagnoses","dial-med-high","digging","digital-tachograph","directions","dizzy","dollar","dollar-circle","dollar-square","dolly-box","dolly-flatbed","dolly-flatbed-alt","dolly-flatbed-empty","donate","dot-circle","doughnut","drafting-compass","dribbble-square","drivers-license","drone-alt","dryer-alt","earth","earth-america","eclipse-alt","edit","ellipsis-h","ellipsis-h-alt","ellipsis-v","ellipsis-v-alt","engine-exclamation","envelope-badge","envelope-circle","envelope-square","eur","euro","exchange","exchange-alt","exclamation-circle","exclamation-square","exclamation-triangle","expand-alt","expand-arrows","expand-arrows-alt","exploding-head","external-link","external-link-alt","external-link-square","external-link-square-alt","eye-dropper-empty","eyedropper","facebook-square","fast-backward","fast-forward","feather-alt","feed","female","field-hockey","fighter-jet","file-alt","file-archive","file-award","file-caret-down","file-caret-up","file-chart-line","file-clipboard","file-download","file-edit","file-medical-alt","file-search","file-text","file-times","file-upload","film-alt","film-cannister","fire-alt","firewall","first-aid","fist-raised","flag-alt","flame","flask-poison","flask-potion","floppy-disk-times","flushed","fog","folder-blank","folder-cog","folder-download","folder-search","folder-times","folder-upload","font-awesome-alt","font-awesome-flag","font-awesome-logo-full","football-ball","fragile","frosty-head","frown","frown-open","funnel-dollar","futbol-ball","game-board-alt","gamepad-alt","gauge-med","gauge-simple-med","gave-dandy","gbp","git-square","github-square","gitlab-square","glass-champagne","glass-cheers","glass-half-empty","glass-half-full","glass-martini","glass-martini-alt","glass-whiskey","glass-whiskey-rocks","glasses-alt","globe-africa","globe-americas","globe-asia","globe-europe","globe-oceania","glove-boxing","golf-ball","google-plus-square","grid-3","grimace","grin","grin-alt","grin-beam","grin-beam-sweat","grin-hearts","grin-squint","grin-squint-tears","grin-stars","grin-tears","grin-tongue","grin-tongue-squint","grin-tongue-wink","grin-wink","grip-horizontal","h-square","hacker-news-square","hamburger","hand-holding-usd","hand-holding-water","hand-paper","hand-receiving","hand-rock","hands-american-sign-language-interpreting","hands-heart","hands-helping","hands-usd","hands-wash","handshake-alt","handshake-alt-slash","hard-hat","hard-of-hearing","hat-hard","haykal","hdd","head-vr","header","headphones-alt","heart-broken","heart-circle","heart-half-alt","heart-music-camera-bolt","heart-rate","heart-square","heartbeat","hiking","history","home","home-alt","home-blank","home-heart","home-lg","home-lg-alt","home-user","hospital-alt","hospital-symbol","hospital-wide","hot-tub","hourglass-1","hourglass-2","hourglass-3","hourglass-empty","house-damage","house-flood","house-leave","house-person-arrive","house-person-depart","house-return","hryvnia","humidity","icons-alt","id-card-alt","ils","inbox-arrow-down","inbox-arrow-up","indian-rupee","industry-alt","info-circle","info-square","innosoft","inr","instagram-square","institution","inventory","island-tree-palm","journal-whills","jpy","js-square","kiss","kiss-beam","kiss-wink-heart","krw","ladder-water","landmark-alt","landscape","laptop-house","lastfm-square","laugh","laugh-beam","laugh-squint","laugh-wink","layer-group-minus","layer-group-plus","legal","level-down","level-down-alt","level-up","level-up-alt","line-chart","list-1-2","list-alt","list-dots","list-numeric","list-squares","location","location-circle","location-slash","lock-alt","lock-open-alt","lollypop","long-arrow-alt-down","long-arrow-alt-left","long-arrow-alt-right","long-arrow-alt-up","long-arrow-down","long-arrow-left","long-arrow-right","long-arrow-up","low-vision","luchador","luggage-cart","magic","magic-wand-sparkles","mail-bulk","mail-forward","mail-reply","mail-reply-all","maki-roll","makizushi","male","map-marked","map-marked-alt","map-marker","map-marker-alt","map-marker-alt-slash","map-marker-check","map-marker-edit","map-marker-exclamation","map-marker-minus","map-marker-plus","map-marker-question","map-marker-slash","map-marker-smile","map-marker-times","map-marker-xmark","map-signs","mars-stroke-h","mars-stroke-v","mask-luchador","medium-m","medkit","meh","meh-blank","meh-rolling-eyes","message-edit","message-times","messaging","microphone-alt","microphone-alt-slash","microphone-circle","microphone-circle-alt","mind-share","minus-circle","minus-hexagon","minus-large","minus-octagon","minus-square","mobile-alt","mobile-android","mobile-android-alt","mobile-iphone","mobile-phone","money-bill-alt","money-bill-wave-alt","money-bills-alt","money-check-alt","money-check-edit","money-check-edit-alt","monitor-heart-rate","mortar-board","mouse","mouse-alt","mouse-pointer","multiply","museum","music-alt","music-alt-slash","navicon","nigiri","odnoklassniki-square","oil-temp","page-break","paint-brush","paint-brush-alt","paint-brush-fine","paintbrush-alt","palette-boxes","pallet-alt","paper-plane-alt","paragraph-rtl","parentheses","parenthesis","parking","parking-circle","parking-circle-slash","parking-slash","party-back","pastafarianism","pause-circle","paw-alt","pen-alt","pen-alt-slash","pen-square","pencil-alt","pencil-paintbrush","pencil-ruler","pencil-square","pennant","people-arrows-left-right","people-carry","percentage","person-carry","phone-alt","phone-arrow-down","phone-arrow-up","phone-circle","phone-circle-alt","phone-circle-down","phone-incoming","phone-laptop","phone-outgoing","phone-square","phone-square-alt","phone-square-down","photo-video","pie-chart","pied-piper-square","ping-pong-paddle-ball","pinterest-square","plane-alt","play-circle","plus-circle","plus-hexagon","plus-octagon","plus-square","poll","poll-h","poo-bolt","portal-enter","portal-exit","portrait","pound-sign","pray","praying-hands","prescription-bottle-alt","presentation","print-search","pro","procedures","project-diagram","puzzle-piece-alt","question-circle","question-square","quidditch","quidditch-broom-ball","quote-left-alt","quote-right-alt","quran","rabbit-fast","radiation-alt","radio-alt","random","rectangle-hd","rectangle-landscape","rectangle-portrait","rectangle-sd","rectangle-times","reddit-square","redo","redo-alt","refresh","remove","remove-format","rendact","reorder","repeat-1-alt","repeat-alt","reply-time","retweet-alt","rmb","rod-asclepius","rod-snake","rotate-back","rotate-backward","rotate-forward","rouble","rows","rss-square","rub","ruble","running","rupee","sad-cry","sad-tear","save","save-circle-arrow-right","save-circle-xmark","save-times","sax-hot","scalpel-path","scanner","screenshot","scroll-ribbon","search","search-dollar","search-location","search-minus","search-plus","send","sensor-alert","sensor-smoke","share-alt","share-alt-square","share-square","shekel","sheqel","sheqel-sign","shield-alt","shield-blank","shield-times","shipping-fast","shipping-timed","shopping-bag","shopping-basket","shopping-basket-alt","shopping-cart","shortcake","shower-alt","shuttle-van","sign","sign-in","sign-in-alt","sign-language","sign-out","sign-out-alt","signal-1","signal-2","signal-3","signal-4","signal-5","signal-alt","signal-alt-1","signal-alt-2","signal-alt-3","signal-alt-4","signal-alt-slash","signal-bars-strong","signal-perfect","signing","skating","ski-jump","ski-lift","skiing","skiing-nordic","slack-hash","sledding","sliders-h","sliders-h-square","sliders-v","sliders-v-square","smile","smile-beam","smile-plus","smile-wink","smoking-ban","sms","snapchat-ghost","snapchat-square","snowboarding","snowmobile","soccer-ball","sort-alpha-asc","sort-alpha-desc","sort-alpha-down","sort-alpha-down-alt","sort-alpha-up","sort-alpha-up-alt","sort-alt","sort-amount-asc","sort-amount-desc","sort-amount-down","sort-amount-down-alt","sort-amount-up","sort-amount-up-alt","sort-asc","sort-circle","sort-circle-down","sort-circle-up","sort-desc","sort-numeric-asc","sort-numeric-desc","sort-numeric-down","sort-numeric-down-alt","sort-numeric-up","sort-numeric-up-alt","sort-shapes-down","sort-shapes-down-alt","sort-shapes-up","sort-shapes-up-alt","sort-size-down","sort-size-down-alt","sort-size-up","sort-size-up-alt","sort-up-down","soup","space-shuttle","space-station-moon-alt","sprout","square-root-alt","square-wine-glass-crack","staff-aesculapius","star-circle","star-half-alt","star-sharp-half-alt","starfighter-alt","starfighter-alt-advanced","steam-square","step-backward","step-forward","sticky-note","stop-circle","store-alt","store-alt-slash","stream","subtract","subway","subway-tunnel","sun-alt","surprise","swimmer","swimming-pool","sync","sync-alt","t-shirt","table-tennis","tablet-alt","tablet-android","tablet-android-alt","tachometer","tachometer-alt","tachometer-alt-average","tachometer-alt-fast","tachometer-alt-fastest","tachometer-alt-slow","tachometer-alt-slowest","tachometer-average","tachometer-fast","tachometer-fastest","tachometer-slow","tachometer-slowest","tally-5","tanakh","tasks","tasks-alt","telegram-plane","teletype","teletype-answer","television","temperature-0","temperature-1","temperature-2","temperature-3","temperature-4","temperature-down","temperature-frigid","temperature-hot","temperature-up","tenge","th","th-large","th-list","theater-masks","thermometer-0","thermometer-1","thermometer-2","thermometer-3","thermometer-4","thermometer-empty","thermometer-full","thermometer-half","thermometer-quarter","thermometer-three-quarters","thumb-tack","thunderstorm","thunderstorm-moon","thunderstorm-sun","ticket-alt","times","times-circle","times-hexagon","times-octagon","times-rectangle","times-square","times-to-slot","tint","tint-slash","tired","toilet-paper-alt","toilet-paper-reverse","toilet-paper-reverse-alt","toilet-paper-reverse-slash","tombstone-alt","tools","torah","tram","transgender-alt","trash-alt","trash-alt-slash","trash-arrow-turn-left","trash-can-arrow-turn-left","trash-circle","trash-restore","trash-restore-alt","trash-undo-alt","tree-alt","trian-balbot","triangle-circle-square","triangle-music","trophy-alt","truck-couch","truck-loading","try","tshirt","tumblr-square","turkish-lira","tv-alt","twitter-square","umbrella-alt","undo","undo-alt","university","unlink","unlock-alt","unsorted","usd","usd-circle","usd-square","user-alt","user-alt-slash","user-chart","user-circle","user-cog","user-construction","user-edit","user-friends","user-hard-hat","user-md","user-md-chat","user-times","users-class","users-cog","users-crown","utensil-fork","utensil-knife","utensil-spoon","utensils-alt","vcard","vhs","viadeo-square","video-camera","video-circle","video-handheld","vimeo-square","volleyball-ball","volume-control-phone","volume-down","volume-medium","volume-mute","volume-times","volume-up","vote-nay","vote-yea","walking","wall-brick","warehouse-alt","warning","washer","water-lower","water-rise","waveform-circle","waveform-path","webcam","webcam-slash","weight","whatsapp-square","wheat-alt","wheelchair-alt","wifi-1","wifi-2","wifi-3","wifi-strong","wind-circle-exclamation","window-alt","window-close","wine-glass-alt","won","wsh","xing-square","xmark-circle","xmark-hexagon","xmark-octagon","xmark-square","yen","youtube-square","zap","zzz"],"1":["42-group","500px","accessible-icon","accusoft","adn","adversal","affiliatetheme","airbnb","algolia","alipay","amazon","amazon-pay","amilia","android","angellist","angrycreative","angular","app-store","app-store-ios","apper","apple","apple-pay","artstation","asymmetrik","atlassian","audible","autoprefixer","avianex","aviato","aws","bandcamp","battle-net","behance","bilibili","bimobject","bitbucket","bitcoin","bity","black-tie","blackberry","blogger","blogger-b","bluetooth-b","bootstrap","bots","btc","buffer","buromobelexperte","buy-n-large","buysellads","canadian-maple-leaf","cc-amazon-pay","cc-amex","cc-apple-pay","cc-diners-club","cc-discover","cc-jcb","cc-mastercard","cc-paypal","cc-stripe","cc-visa","centercode","centos","chrome","chromecast","cloudflare","cloudscale","cloudsmith","cloudversify","cmplid","codepen","codiepie","confluence","connectdevelop","contao","cotton-bureau","cpanel","creative-commons","creative-commons-by","creative-commons-nc","creative-commons-nc-eu","creative-commons-nc-jp","creative-commons-nd","creative-commons-pd","creative-commons-pd-alt","creative-commons-remix","creative-commons-sa","creative-commons-sampling","creative-commons-sampling-plus","creative-commons-share","creative-commons-zero","critical-role","css3","css3-alt","cuttlefish","d-and-d","d-and-d-beyond","dailymotion","dashcube","deezer","delicious","deploydog","deskpro","dev","deviantart","dhl","diaspora","digg","digital-ocean","discord","discourse","dochub","docker","draft2digital","dribbble","dropbox","drupal","dyalog","earlybirds","ebay","edge","edge-legacy","elementor","ello","ember","empire","envira","erlang","ethereum","etsy","evernote","expeditedssl","facebook","facebook-f","facebook-messenger","fantasy-flight-games","fedex","fedora","figma","firefox","firefox-browser","first-order","first-order-alt","firstdraft","flickr","flipboard","fly","fonticons","fonticons-fi","fort-awesome","fort-awesome-alt","forumbee","foursquare","free-code-camp","freebsd","fulcrum","galactic-republic","galactic-senate","get-pocket","gg","gg-circle","git","git-alt","github","github-alt","gitkraken","gitlab","gitter","glide","glide-g","gofore","golang","goodreads","goodreads-g","google","google-drive","google-pay","google-play","google-plus","google-plus-g","google-wallet","gratipay","grav","gripfire","grunt","guilded","gulp","hacker-news","hackerrank","hashnode","hips","hire-a-helper","hive","hooli","hornbill","hotjar","houzz","html5","hubspot","ideal","imdb","instagram","instalod","intercom","internet-explorer","invision","ioxhost","itch-io","itunes","itunes-note","java","jedi-order","jenkins","jira","joget","joomla","js","jsfiddle","kaggle","keybase","keycdn","kickstarter","kickstarter-k","korvue","laravel","lastfm","leanpub","less","line","linkedin","linkedin-in","linode","linux","lyft","magento","mailchimp","mandalorian","markdown","mastodon","maxcdn","mdb","medapps","medium","medrt","meetup","megaport","mendeley","meta","microblog","microsoft","mix","mixcloud","mixer","mizuni","modx","monero","napster","neos","nfc-directional","nimblr","node","node-js","npm","ns8","nutritionix","octopus-deploy","odnoklassniki","odysee","old-republic","opencart","openid","opera","optin-monster","orcid","osi","padlet","page4","pagelines","palfed","patreon","paypal","perbyte","periscope","phabricator","phoenix-framework","phoenix-squadron","php","pied-piper","pied-piper-alt","pied-piper-hat","pied-piper-pp","pinterest","pinterest-p","pix","playstation","product-hunt","pushed","python","qq","quinscape","quora","r-project","raspberry-pi","ravelry","react","reacteurope","readme","rebel","red-river","reddit","reddit-alien","redhat","renren","replyd","researchgate","resolving","rev","rocketchat","rockrms","rust","safari","salesforce","sass","schlix","screenpal","scribd","searchengin","sellcast","sellsy","servicestack","shirtsinbulk","shopify","shopware","simplybuilt","sistrix","sith","sitrox","sketch","skyatlas","skype","slack","slideshare","snapchat","soundcloud","sourcetree","space-awesome","speakap","speaker-deck","spotify","square-behance","square-dribbble","square-facebook","square-font-awesome","square-font-awesome-stroke","square-git","square-github","square-gitlab","square-google-plus","square-hacker-news","square-instagram","square-js","square-lastfm","square-odnoklassniki","square-pied-piper","square-pinterest","square-reddit","square-snapchat","square-steam","square-tumblr","square-twitter","square-viadeo","square-vimeo","square-whatsapp","square-xing","square-youtube","squarespace","stack-exchange","stack-overflow","stackpath","staylinked","steam","steam-symbol","sticker-mule","strava","stripe","stripe-s","stubber","studiovinari","stumbleupon","stumbleupon-circle","superpowers","supple","suse","swift","symfony","teamspeak","telegram","tencent-weibo","the-red-yeti","themeco","themeisle","think-peaks","tiktok","trade-federation","trello","tumblr","twitch","twitter","typo3","uber","ubuntu","uikit","umbraco","uncharted","uniregistry","unity","unsplash","untappd","ups","usb","usps","ussunnah","vaadin","viacoin","viadeo","viber","vimeo","vimeo-v","vine","vk","vnv","vuejs","watchman-monitoring","waze","weebly","weibo","weixin","whatsapp","whmcs","wikipedia-w","windows","wirsindhandwerk","wix","wizards-of-the-coast","wodu","wolf-pack-battalion","wordpress","wordpress-simple","wpbeginner","wpexplorer","wpforms","wpressr","xbox","xing","y-combinator","yahoo","yammer","yandex","yandex-international","yarn","yelp","yoast","youtube","zhihu"],"511":["bluetooth","font-awesome","nfc-symbol"]}
|
package/tools/mcp-env.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const truthyEnvValues = new Set(['1', 'true', 'yes', 'on'])
|
|
2
|
-
|
|
3
|
-
export function isTruthyEnv(value: string | undefined) {
|
|
4
|
-
return truthyEnvValues.has(
|
|
5
|
-
String(value || '')
|
|
6
|
-
.trim()
|
|
7
|
-
.toLowerCase(),
|
|
8
|
-
)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function shouldRegisterEditingTools(env: Record<string, string | undefined> = process.env) {
|
|
12
|
-
return isTruthyEnv(env.BRICKS_CTOR_ENABLE_EDITING_TOOLS)
|
|
13
|
-
}
|
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
2
|
-
import os from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
|
|
5
|
-
jest.mock('oxfmt', () => ({
|
|
6
|
-
format: async (_file, source) => ({ code: source, errors: [] }),
|
|
7
|
-
}))
|
|
8
|
-
|
|
9
|
-
import { register, __test__ } from '../data-calc-editing'
|
|
10
|
-
|
|
11
|
-
const writeFixtureProject = async () => {
|
|
12
|
-
const projectDir = await mkdtemp(path.join(os.tmpdir(), 'bricks-data-calc-editing-'))
|
|
13
|
-
const subspaceDir = path.join(projectDir, 'subspaces/subspace-0')
|
|
14
|
-
await mkdir(subspaceDir, { recursive: true })
|
|
15
|
-
await writeFile(
|
|
16
|
-
path.join(subspaceDir, 'data.ts'),
|
|
17
|
-
`import type { Data } from 'bricks-ctor'
|
|
18
|
-
import { makeId } from 'bricks-ctor'
|
|
19
|
-
|
|
20
|
-
export const dPrice: Data = {
|
|
21
|
-
__typename: 'Data',
|
|
22
|
-
id: makeId('data'),
|
|
23
|
-
alias: 'price',
|
|
24
|
-
title: 'Price',
|
|
25
|
-
type: 'number',
|
|
26
|
-
value: 5,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const dQuantity: Data = {
|
|
30
|
-
__typename: 'Data',
|
|
31
|
-
id: makeId('data'),
|
|
32
|
-
alias: 'quantity',
|
|
33
|
-
title: 'Quantity',
|
|
34
|
-
type: 'number',
|
|
35
|
-
value: 2,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const dTotal: Data = {
|
|
39
|
-
__typename: 'Data',
|
|
40
|
-
id: makeId('data'),
|
|
41
|
-
alias: 'total',
|
|
42
|
-
title: 'Total',
|
|
43
|
-
type: 'number',
|
|
44
|
-
value: 0,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const dError: Data = {
|
|
48
|
-
__typename: 'Data',
|
|
49
|
-
id: makeId('data'),
|
|
50
|
-
alias: 'error',
|
|
51
|
-
title: 'Error',
|
|
52
|
-
type: 'string',
|
|
53
|
-
value: '',
|
|
54
|
-
}
|
|
55
|
-
`,
|
|
56
|
-
)
|
|
57
|
-
await writeFile(
|
|
58
|
-
path.join(subspaceDir, 'index.ts'),
|
|
59
|
-
`import type { Subspace } from 'bricks-ctor'
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
__typename: 'Subspace',
|
|
63
|
-
id: 'SUBSPACE_TEST',
|
|
64
|
-
title: 'Main',
|
|
65
|
-
layout: { width: 96, height: 54 },
|
|
66
|
-
canvases: [],
|
|
67
|
-
rootCanvas: undefined,
|
|
68
|
-
animations: [],
|
|
69
|
-
bricks: [],
|
|
70
|
-
generators: [],
|
|
71
|
-
data: Object.values(data),
|
|
72
|
-
dataRouting: [],
|
|
73
|
-
dataCalculation: [],
|
|
74
|
-
} as Subspace
|
|
75
|
-
`,
|
|
76
|
-
)
|
|
77
|
-
return projectDir
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const readProjectFile = (projectDir, relPath) => readFile(path.join(projectDir, relPath), 'utf8')
|
|
81
|
-
|
|
82
|
-
const readAudit = async (projectDir) =>
|
|
83
|
-
(await readFile(path.join(projectDir, '.bricks/edits.jsonl'), 'utf8'))
|
|
84
|
-
.trim()
|
|
85
|
-
.split('\n')
|
|
86
|
-
.map((line) => JSON.parse(line))
|
|
87
|
-
|
|
88
|
-
describe('ctor MCP data-calc editing tools', () => {
|
|
89
|
-
let projectDir
|
|
90
|
-
|
|
91
|
-
afterEach(async () => {
|
|
92
|
-
if (projectDir) await rm(projectDir, { recursive: true, force: true })
|
|
93
|
-
projectDir = null
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
test('registers the four data-calc MCP tools with descriptions', () => {
|
|
97
|
-
const calls = []
|
|
98
|
-
register(
|
|
99
|
-
{
|
|
100
|
-
tool(...args) {
|
|
101
|
-
calls.push(args)
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
'/tmp/project',
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
expect(calls.map(([name]) => name)).toEqual([
|
|
108
|
-
'new_data_calc',
|
|
109
|
-
'edit_data_calc',
|
|
110
|
-
'edit_data_calc_io',
|
|
111
|
-
'remove_data_calc',
|
|
112
|
-
])
|
|
113
|
-
expect(
|
|
114
|
-
calls.every(([, description]) => typeof description === 'string' && description.length > 20),
|
|
115
|
-
).toBe(true)
|
|
116
|
-
expect(calls[0][2].code.description).toContain('export function main')
|
|
117
|
-
expect(calls[2][2].data.description).toContain('{ ref')
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
test('new_data_calc creates script, sandbox, index, and minimal subspace wiring', async () => {
|
|
121
|
-
projectDir = await writeFixtureProject()
|
|
122
|
-
|
|
123
|
-
const result = await __test__.newDataCalc(projectDir, {
|
|
124
|
-
alias: 'totalCalc',
|
|
125
|
-
title: 'Total Calc',
|
|
126
|
-
code: 'return { total: inputs.price * inputs.quantity }',
|
|
127
|
-
inputs: [
|
|
128
|
-
{ key: 'price', data: 'price' },
|
|
129
|
-
{ key: 'quantity', data: 'quantity', trigger: false },
|
|
130
|
-
],
|
|
131
|
-
outputs: [{ key: 'total', data: 'total' }],
|
|
132
|
-
output: 'total',
|
|
133
|
-
error: 'error',
|
|
134
|
-
verify: false,
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
expect(result.outcome).toBe('ok')
|
|
138
|
-
expect(result.calc).toBe('total-calc')
|
|
139
|
-
const calc = await readProjectFile(
|
|
140
|
-
projectDir,
|
|
141
|
-
'subspaces/subspace-0/data-calc/data-calculation-total-calc.ts',
|
|
142
|
-
)
|
|
143
|
-
expect(calc).toMatch(/id:\s*makeId\(["']property_bank_calc["'], ["']totalCalc["']\)/)
|
|
144
|
-
expect(calc).toMatch(
|
|
145
|
-
/code:\s*await readFile\(new URL\(["']\.\/data-calculation-total-calc\.sandbox\.js["']/,
|
|
146
|
-
)
|
|
147
|
-
expect(calc).toContain('data: () => data.dPrice')
|
|
148
|
-
expect(calc).toContain('trigger: false')
|
|
149
|
-
expect(calc).toContain('output: () => data.dTotal')
|
|
150
|
-
expect(calc).toContain('error: () => data.dError')
|
|
151
|
-
const sandbox = await readProjectFile(
|
|
152
|
-
projectDir,
|
|
153
|
-
'subspaces/subspace-0/data-calc/data-calculation-total-calc.sandbox.js',
|
|
154
|
-
)
|
|
155
|
-
expect(sandbox).toContain('export function main()')
|
|
156
|
-
expect(sandbox).toContain('return { total: inputs.price * inputs.quantity }')
|
|
157
|
-
const index = await readProjectFile(projectDir, 'subspaces/subspace-0/data-calc/index.ts')
|
|
158
|
-
expect(index).toContain(
|
|
159
|
-
"import { dataCalculation as dataCalculation0 } from './data-calculation-total-calc'",
|
|
160
|
-
)
|
|
161
|
-
const subspaceIndex = await readProjectFile(projectDir, 'subspaces/subspace-0/index.ts')
|
|
162
|
-
expect(subspaceIndex).toMatch(/import \{ dataCalculation \} from ["']\.\/data-calc["']/)
|
|
163
|
-
expect(subspaceIndex).toMatch(/dataCalculation\s*\n\s*} as Subspace/)
|
|
164
|
-
const audit = await readAudit(projectDir)
|
|
165
|
-
expect(audit.at(-1).summary).toContain('created data calc total-calc')
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
test('records audit provenance from env', async () => {
|
|
169
|
-
projectDir = await writeFixtureProject()
|
|
170
|
-
const previousSessionId = process.env.BRICKS_CTOR_SESSION_ID
|
|
171
|
-
const previousAgentId = process.env.BRICKS_CTOR_AGENT_ID
|
|
172
|
-
process.env.BRICKS_CTOR_SESSION_ID = 'session-1'
|
|
173
|
-
process.env.BRICKS_CTOR_AGENT_ID = 'agent-1'
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
const result = await __test__.newDataCalc(projectDir, {
|
|
177
|
-
alias: 'auditCalc',
|
|
178
|
-
verify: false,
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
expect(result.outcome).toBe('ok')
|
|
182
|
-
const audit = await readAudit(projectDir)
|
|
183
|
-
expect(audit.at(-1).provenance).toEqual({
|
|
184
|
-
session: 'session-1',
|
|
185
|
-
agent: 'agent-1',
|
|
186
|
-
})
|
|
187
|
-
} finally {
|
|
188
|
-
if (previousSessionId === undefined) delete process.env.BRICKS_CTOR_SESSION_ID
|
|
189
|
-
else process.env.BRICKS_CTOR_SESSION_ID = previousSessionId
|
|
190
|
-
if (previousAgentId === undefined) delete process.env.BRICKS_CTOR_AGENT_ID
|
|
191
|
-
else process.env.BRICKS_CTOR_AGENT_ID = previousAgentId
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
test('edit_data_calc updates scalars, refs, and migrates inline code to sandbox form', async () => {
|
|
196
|
-
projectDir = await writeFixtureProject()
|
|
197
|
-
const dataCalcDir = path.join(projectDir, 'subspaces/subspace-0/data-calc')
|
|
198
|
-
await mkdir(dataCalcDir, { recursive: true })
|
|
199
|
-
await writeFile(
|
|
200
|
-
path.join(dataCalcDir, 'data-calculation-inline.ts'),
|
|
201
|
-
`import type { DataCalculationScript } from 'bricks-ctor'
|
|
202
|
-
import { makeId } from 'bricks-ctor'
|
|
203
|
-
import * as data from '../data'
|
|
204
|
-
|
|
205
|
-
export const dataCalculation: DataCalculationScript = {
|
|
206
|
-
__typename: 'DataCalculationScript',
|
|
207
|
-
id: makeId('property_bank_calc'),
|
|
208
|
-
alias: 'inline',
|
|
209
|
-
code: 'return inputs.price',
|
|
210
|
-
enableAsync: false,
|
|
211
|
-
inputs: [],
|
|
212
|
-
output: null,
|
|
213
|
-
outputs: [],
|
|
214
|
-
error: null,
|
|
215
|
-
}
|
|
216
|
-
`,
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
const result = await __test__.editDataCalc(projectDir, {
|
|
220
|
-
subspace: 0,
|
|
221
|
-
calc: 'inline',
|
|
222
|
-
set: {
|
|
223
|
-
title: 'Edited Inline',
|
|
224
|
-
enableAsync: true,
|
|
225
|
-
output: 'total',
|
|
226
|
-
error: 'error',
|
|
227
|
-
},
|
|
228
|
-
code: 'return { total: inputs.price }',
|
|
229
|
-
verify: false,
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
expect(result.outcome).toBe('ok')
|
|
233
|
-
const calc = await readProjectFile(
|
|
234
|
-
projectDir,
|
|
235
|
-
'subspaces/subspace-0/data-calc/data-calculation-inline.ts',
|
|
236
|
-
)
|
|
237
|
-
expect(calc).toMatch(/import \{ readFile \} from ["']node:fs\/promises["']/)
|
|
238
|
-
expect(calc).toMatch(/title:\s*["']Edited Inline["']/)
|
|
239
|
-
expect(calc).toContain('enableAsync: true')
|
|
240
|
-
expect(calc).toMatch(
|
|
241
|
-
/code:\s*await readFile\(new URL\(["']\.\/data-calculation-inline\.sandbox\.js["']/,
|
|
242
|
-
)
|
|
243
|
-
expect(calc).toContain('output: () => data.dTotal')
|
|
244
|
-
expect(calc).toContain('error: () => data.dError')
|
|
245
|
-
const sandbox = await readProjectFile(
|
|
246
|
-
projectDir,
|
|
247
|
-
'subspaces/subspace-0/data-calc/data-calculation-inline.sandbox.js',
|
|
248
|
-
)
|
|
249
|
-
expect(sandbox).toContain('return { total: inputs.price }')
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
test('edit_data_calc_io edits inputs and outputs with input-key uniqueness', async () => {
|
|
253
|
-
projectDir = await writeFixtureProject()
|
|
254
|
-
await __test__.newDataCalc(projectDir, {
|
|
255
|
-
alias: 'ioCalc',
|
|
256
|
-
inputs: [{ key: 'price', data: 'price' }],
|
|
257
|
-
outputs: [{ key: 'total', data: 'total' }],
|
|
258
|
-
verify: false,
|
|
259
|
-
})
|
|
260
|
-
|
|
261
|
-
const duplicate = await __test__.editDataCalcIo(projectDir, {
|
|
262
|
-
subspace: 0,
|
|
263
|
-
calc: 'io-calc',
|
|
264
|
-
field: 'inputs',
|
|
265
|
-
op: 'add',
|
|
266
|
-
key: 'price',
|
|
267
|
-
data: 'quantity',
|
|
268
|
-
verify: false,
|
|
269
|
-
})
|
|
270
|
-
expect(duplicate.outcome).toBe('error')
|
|
271
|
-
expect(duplicate.error.code).toBe('duplicate_key')
|
|
272
|
-
|
|
273
|
-
const addInput = await __test__.editDataCalcIo(projectDir, {
|
|
274
|
-
subspace: 0,
|
|
275
|
-
calc: 'io-calc',
|
|
276
|
-
field: 'inputs',
|
|
277
|
-
op: 'add',
|
|
278
|
-
key: 'quantity',
|
|
279
|
-
data: 'quantity',
|
|
280
|
-
trigger: false,
|
|
281
|
-
verify: false,
|
|
282
|
-
})
|
|
283
|
-
expect(addInput.outcome).toBe('ok')
|
|
284
|
-
|
|
285
|
-
const fanOut = await __test__.editDataCalcIo(projectDir, {
|
|
286
|
-
subspace: 0,
|
|
287
|
-
calc: 'io-calc',
|
|
288
|
-
field: 'outputs',
|
|
289
|
-
op: 'add',
|
|
290
|
-
key: 'total',
|
|
291
|
-
data: 'total',
|
|
292
|
-
verify: false,
|
|
293
|
-
})
|
|
294
|
-
expect(fanOut.outcome).toBe('ok')
|
|
295
|
-
|
|
296
|
-
const calc = await readProjectFile(
|
|
297
|
-
projectDir,
|
|
298
|
-
'subspaces/subspace-0/data-calc/data-calculation-io-calc.ts',
|
|
299
|
-
)
|
|
300
|
-
expect(calc).toMatch(/key:\s*["']quantity["']/)
|
|
301
|
-
expect(calc).toContain('trigger: false')
|
|
302
|
-
expect((calc.match(/key:\s*["']total["']/g) || []).length).toBe(2)
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
test('new_data_calc wraps top-level await bodies in an async main', async () => {
|
|
306
|
-
projectDir = await writeFixtureProject()
|
|
307
|
-
|
|
308
|
-
const result = await __test__.newDataCalc(projectDir, {
|
|
309
|
-
alias: 'asyncCalc',
|
|
310
|
-
enableAsync: true,
|
|
311
|
-
code: 'const value = await Promise.resolve(inputs.price)\nreturn value',
|
|
312
|
-
inputs: [{ key: 'price', data: 'price' }],
|
|
313
|
-
verify: false,
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
expect(result.outcome).toBe('ok')
|
|
317
|
-
const sandbox = await readProjectFile(
|
|
318
|
-
projectDir,
|
|
319
|
-
'subspaces/subspace-0/data-calc/data-calculation-async-calc.sandbox.js',
|
|
320
|
-
)
|
|
321
|
-
expect(sandbox).toContain('export async function main()')
|
|
322
|
-
})
|
|
323
|
-
|
|
324
|
-
test('new_data_calc rejects sandbox code that does not parse', async () => {
|
|
325
|
-
projectDir = await writeFixtureProject()
|
|
326
|
-
|
|
327
|
-
const result = await __test__.newDataCalc(projectDir, {
|
|
328
|
-
alias: 'broken',
|
|
329
|
-
code: 'return {',
|
|
330
|
-
verify: false,
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
expect(result.outcome).toBe('error')
|
|
334
|
-
expect(result.error.code).toBe('invalid_code')
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
test('edit_data_calc set routes inputs/outputs through the IO builder and guards required fields', async () => {
|
|
338
|
-
projectDir = await writeFixtureProject()
|
|
339
|
-
await __test__.newDataCalc(projectDir, { alias: 'setCalc', verify: false })
|
|
340
|
-
|
|
341
|
-
const ioViaSet = await __test__.editDataCalc(projectDir, {
|
|
342
|
-
subspace: 0,
|
|
343
|
-
calc: 'set-calc',
|
|
344
|
-
set: { inputs: [{ key: 'price', data: 'price' }] },
|
|
345
|
-
verify: false,
|
|
346
|
-
})
|
|
347
|
-
expect(ioViaSet.outcome).toBe('ok')
|
|
348
|
-
const calc = await readProjectFile(
|
|
349
|
-
projectDir,
|
|
350
|
-
'subspaces/subspace-0/data-calc/data-calculation-set-calc.ts',
|
|
351
|
-
)
|
|
352
|
-
expect(calc).toContain('data: () => data.dPrice')
|
|
353
|
-
|
|
354
|
-
const codeViaSet = await __test__.editDataCalc(projectDir, {
|
|
355
|
-
subspace: 0,
|
|
356
|
-
calc: 'set-calc',
|
|
357
|
-
set: { code: 'return 1' },
|
|
358
|
-
verify: false,
|
|
359
|
-
})
|
|
360
|
-
expect(codeViaSet.outcome).toBe('error')
|
|
361
|
-
expect(codeViaSet.error.code).toBe('invalid_field')
|
|
362
|
-
|
|
363
|
-
const badUnset = await __test__.editDataCalc(projectDir, {
|
|
364
|
-
subspace: 0,
|
|
365
|
-
calc: 'set-calc',
|
|
366
|
-
unset: ['inputs'],
|
|
367
|
-
verify: false,
|
|
368
|
-
})
|
|
369
|
-
expect(badUnset.outcome).toBe('error')
|
|
370
|
-
expect(badUnset.error.code).toBe('invalid_field')
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
test('subspace+calc addressing tolerates non-Script calc files while scanning', async () => {
|
|
374
|
-
projectDir = await writeFixtureProject()
|
|
375
|
-
const dataCalcDir = path.join(projectDir, 'subspaces/subspace-0/data-calc')
|
|
376
|
-
await mkdir(dataCalcDir, { recursive: true })
|
|
377
|
-
await writeFile(
|
|
378
|
-
path.join(dataCalcDir, 'data-calculation-0.ts'),
|
|
379
|
-
`import type { DataCalculationMap } from 'bricks-ctor'
|
|
380
|
-
|
|
381
|
-
export const dataCalculation: DataCalculationMap = {
|
|
382
|
-
__typename: 'DataCalculationMap',
|
|
383
|
-
id: 'PROPERTY_BANK_COMMAND_MAP_MAP',
|
|
384
|
-
nodes: [],
|
|
385
|
-
editorInfo: [],
|
|
386
|
-
}
|
|
387
|
-
`,
|
|
388
|
-
)
|
|
389
|
-
await __test__.newDataCalc(projectDir, { alias: 'realCalc', verify: false })
|
|
390
|
-
|
|
391
|
-
const result = await __test__.editDataCalc(projectDir, {
|
|
392
|
-
subspace: 0,
|
|
393
|
-
calc: 'realCalc',
|
|
394
|
-
set: { title: 'Real' },
|
|
395
|
-
verify: false,
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
expect(result.outcome).toBe('ok')
|
|
399
|
-
expect(result.file).toBe('subspaces/subspace-0/data-calc/data-calculation-real-calc.ts')
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
test('new_data_calc warns instead of overwriting a non-empty inline dataCalculation', async () => {
|
|
403
|
-
projectDir = await writeFixtureProject()
|
|
404
|
-
await writeFile(
|
|
405
|
-
path.join(projectDir, 'subspaces/subspace-0/index.ts'),
|
|
406
|
-
`import type { Subspace } from 'bricks-ctor'
|
|
407
|
-
|
|
408
|
-
export default {
|
|
409
|
-
__typename: 'Subspace',
|
|
410
|
-
id: 'SUBSPACE_TEST',
|
|
411
|
-
title: 'Main',
|
|
412
|
-
dataCalculation: [{ __typename: 'DataCalculationScript' }],
|
|
413
|
-
} as Subspace
|
|
414
|
-
`,
|
|
415
|
-
)
|
|
416
|
-
|
|
417
|
-
const result = await __test__.newDataCalc(projectDir, { alias: 'warned', verify: false })
|
|
418
|
-
|
|
419
|
-
expect(result.outcome).toBe('ok')
|
|
420
|
-
expect(result.warnings?.[0]).toContain('non-empty dataCalculation')
|
|
421
|
-
const index = await readProjectFile(projectDir, 'subspaces/subspace-0/index.ts')
|
|
422
|
-
expect(index).not.toMatch(/import \{ dataCalculation \}/)
|
|
423
|
-
expect(index).toContain("dataCalculation: [{ __typename: 'DataCalculationScript' }]")
|
|
424
|
-
})
|
|
425
|
-
|
|
426
|
-
test('remove_data_calc ignores non-sibling sandbox filenames in code', async () => {
|
|
427
|
-
projectDir = await writeFixtureProject()
|
|
428
|
-
const dataCalcDir = path.join(projectDir, 'subspaces/subspace-0/data-calc')
|
|
429
|
-
await mkdir(dataCalcDir, { recursive: true })
|
|
430
|
-
await writeFile(path.join(projectDir, 'evil.sandbox.js'), 'export function main() {}\n')
|
|
431
|
-
await writeFile(
|
|
432
|
-
path.join(dataCalcDir, 'data-calculation-escape.ts'),
|
|
433
|
-
`import type { DataCalculationScript } from 'bricks-ctor'
|
|
434
|
-
import { makeId } from 'bricks-ctor'
|
|
435
|
-
import { readFile } from 'node:fs/promises'
|
|
436
|
-
|
|
437
|
-
export const dataCalculation: DataCalculationScript = {
|
|
438
|
-
__typename: 'DataCalculationScript',
|
|
439
|
-
id: makeId('property_bank_calc'),
|
|
440
|
-
alias: 'escape',
|
|
441
|
-
code: await readFile(new URL('../../../evil.sandbox.js', import.meta.url), 'utf8'),
|
|
442
|
-
enableAsync: false,
|
|
443
|
-
inputs: [],
|
|
444
|
-
output: null,
|
|
445
|
-
outputs: [],
|
|
446
|
-
error: null,
|
|
447
|
-
}
|
|
448
|
-
`,
|
|
449
|
-
)
|
|
450
|
-
|
|
451
|
-
const result = await __test__.removeDataCalc(projectDir, {
|
|
452
|
-
subspace: 0,
|
|
453
|
-
calc: 'escape',
|
|
454
|
-
verify: false,
|
|
455
|
-
})
|
|
456
|
-
|
|
457
|
-
expect(result.outcome).toBe('ok')
|
|
458
|
-
await expect(readProjectFile(projectDir, 'evil.sandbox.js')).resolves.toContain('main')
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
test('remove_data_calc deletes calc files and regenerates index', async () => {
|
|
462
|
-
projectDir = await writeFixtureProject()
|
|
463
|
-
await __test__.newDataCalc(projectDir, {
|
|
464
|
-
alias: 'removeMe',
|
|
465
|
-
code: 'return inputs.price',
|
|
466
|
-
verify: false,
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
const result = await __test__.removeDataCalc(projectDir, {
|
|
470
|
-
subspace: 0,
|
|
471
|
-
calc: 'remove-me',
|
|
472
|
-
verify: false,
|
|
473
|
-
})
|
|
474
|
-
|
|
475
|
-
expect(result.outcome).toBe('ok')
|
|
476
|
-
await expect(
|
|
477
|
-
readProjectFile(projectDir, 'subspaces/subspace-0/data-calc/data-calculation-remove-me.ts'),
|
|
478
|
-
).rejects.toThrow()
|
|
479
|
-
await expect(
|
|
480
|
-
readProjectFile(
|
|
481
|
-
projectDir,
|
|
482
|
-
'subspaces/subspace-0/data-calc/data-calculation-remove-me.sandbox.js',
|
|
483
|
-
),
|
|
484
|
-
).rejects.toThrow()
|
|
485
|
-
const index = await readProjectFile(projectDir, 'subspaces/subspace-0/data-calc/index.ts')
|
|
486
|
-
expect(index).not.toContain('remove-me')
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
test('DataCalculationMap returns fallback recommendation', async () => {
|
|
490
|
-
projectDir = await writeFixtureProject()
|
|
491
|
-
const dataCalcDir = path.join(projectDir, 'subspaces/subspace-0/data-calc')
|
|
492
|
-
await mkdir(dataCalcDir, { recursive: true })
|
|
493
|
-
await writeFile(
|
|
494
|
-
path.join(dataCalcDir, 'data-calculation-map.ts'),
|
|
495
|
-
`import type { DataCalculationMap } from 'bricks-ctor'
|
|
496
|
-
|
|
497
|
-
export const dataCalculation: DataCalculationMap = {
|
|
498
|
-
__typename: 'DataCalculationMap',
|
|
499
|
-
id: 'PROPERTY_BANK_COMMAND_MAP_MAP',
|
|
500
|
-
nodes: [],
|
|
501
|
-
editorInfo: [],
|
|
502
|
-
}
|
|
503
|
-
`,
|
|
504
|
-
)
|
|
505
|
-
|
|
506
|
-
const result = await __test__.editDataCalc(projectDir, {
|
|
507
|
-
file: 'subspaces/subspace-0/data-calc/data-calculation-map.ts',
|
|
508
|
-
set: { title: 'Map' },
|
|
509
|
-
verify: false,
|
|
510
|
-
})
|
|
511
|
-
|
|
512
|
-
expect(result.outcome).toBe('fallback_recommended')
|
|
513
|
-
expect(result.isError).toBe(false)
|
|
514
|
-
expect(result.error.message).toContain('DataCalculationMap is out of scope')
|
|
515
|
-
})
|
|
516
|
-
})
|