@hyperfixi/core 2.3.1 → 2.5.0
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/dist/api/dom-processor.d.ts +8 -4
- package/dist/api/hyperscript-api.d.ts +5 -1
- package/dist/ast-utils/index.js +25320 -94
- package/dist/ast-utils/index.mjs +25320 -94
- package/dist/ast-utils/interchange/types.d.ts +7 -1
- package/dist/behaviors/index.js +54 -100
- package/dist/behaviors/index.mjs +54 -100
- package/dist/bundle-generator/index.js +19 -2
- package/dist/bundle-generator/index.mjs +19 -2
- package/dist/bundle-generator/parser-templates.d.ts +1 -1
- package/dist/bundle-generator/template-capabilities.d.ts +1 -1
- package/dist/chunks/bridge-Ce2mO-nk.js +2 -0
- package/dist/chunks/browser-modular-D5vPrb2X.js +2 -0
- package/dist/chunks/feature-eventsource-BpZvPy_K.js +2 -0
- package/dist/chunks/{feature-sockets-ClOH7vk7.js → feature-sockets-CrYvjZ4j.js} +2 -2
- package/dist/chunks/feature-webworker-BSYguEIW.js +2 -0
- package/dist/chunks/index-DsBHN4zW.js +2 -0
- package/dist/commands/advanced/async.d.ts +6 -2
- package/dist/commands/advanced/js.d.ts +1 -1
- package/dist/commands/animation/start-view-transition.d.ts +24 -0
- package/dist/commands/async/fetch.d.ts +6 -1
- package/dist/commands/control-flow/repeat.d.ts +2 -0
- package/dist/commands/data/clear.d.ts +23 -0
- package/dist/commands/data/set.d.ts +6 -0
- package/dist/commands/dom/close.d.ts +19 -0
- package/dist/commands/dom/empty.d.ts +19 -0
- package/dist/commands/dom/open.d.ts +21 -0
- package/dist/commands/dom/reset.d.ts +19 -0
- package/dist/commands/dom/select.d.ts +19 -0
- package/dist/commands/dom/swap.d.ts +7 -4
- package/dist/commands/events/trigger.d.ts +1 -1
- package/dist/commands/execution/blur.d.ts +19 -0
- package/dist/commands/execution/call.d.ts +1 -2
- package/dist/commands/execution/focus.d.ts +19 -0
- package/dist/commands/helpers/element-resolution.d.ts +2 -2
- package/dist/commands/helpers/event-waiting.d.ts +1 -1
- package/dist/commands/helpers/numeric-target-parser.d.ts +7 -0
- package/dist/commands/index.d.ts +34 -2
- package/dist/commands/index.js +19353 -4845
- package/dist/commands/index.mjs +19321 -4846
- package/dist/commands/navigation/go.d.ts +3 -0
- package/dist/commands/navigation/scroll-to.d.ts +26 -0
- package/dist/commands/utility/beep.d.ts +2 -2
- package/dist/commands/utility/breakpoint.d.ts +19 -0
- package/dist/commands/utility/pick.d.ts +11 -2
- package/dist/compatibility/browser-bundle-modular.d.ts +2 -2
- package/dist/compatibility/browser-bundle-multilingual.d.ts +1 -1
- package/dist/compatibility/browser-bundle-semantic-complete.d.ts +3 -3
- package/dist/compatibility/browser-bundle.d.ts +13 -6
- package/dist/compatibility/browser-modular.d.ts +1 -3
- package/dist/core/expression-evaluator.d.ts +4 -4
- package/dist/core/expression-registry.d.ts +8 -0
- package/dist/expressions/bundles/common-expressions.d.ts +2 -2
- package/dist/expressions/bundles/core-expressions.d.ts +2 -2
- package/dist/expressions/bundles/full-expressions.d.ts +2 -2
- package/dist/expressions/bundles/index.d.ts +3 -3
- package/dist/expressions/collection/index.d.ts +35 -0
- package/dist/expressions/conversion/impl/index.d.ts +1 -1
- package/dist/expressions/index.d.ts +4 -3
- package/dist/expressions/index.js +1117 -1590
- package/dist/expressions/index.mjs +1113 -1586
- package/dist/expressions/logical/index.d.ts +2 -0
- package/dist/expressions/mathematical/index.d.ts +11 -0
- package/dist/expressions/shared/index.d.ts +1 -1
- package/dist/expressions/shared/number-utils.d.ts +1 -0
- package/dist/htmx/htmx-attribute-processor.d.ts +37 -1
- package/dist/htmx/htmx-translator.d.ts +2 -0
- package/dist/htmx/i18n-hooks.d.ts +15 -0
- package/dist/htmx/i18n-orchestrator.d.ts +15 -0
- package/dist/htmx/lang-resolver.d.ts +3 -0
- package/dist/htmx/sse.d.ts +60 -0
- package/dist/htmx/ws.d.ts +59 -0
- package/dist/hyperfixi-browser-classic-i18n.js +2 -0
- package/dist/hyperfixi-browser-minimal.js +1 -0
- package/dist/hyperfixi-browser-standard.js +2 -0
- package/dist/hyperfixi-browser.js +2 -0
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -0
- package/dist/hyperfixi-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-hybrid-hx.js +1 -0
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43592 -45060
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +43589 -45061
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/morph-adapter.d.ts +0 -13
- package/dist/lib/swap-executor.d.ts +0 -10
- package/dist/lib/view-transitions.d.ts +1 -30
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-hybrid-complete.js +1 -1
- package/dist/lokascript-hybrid-hx.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/lsp-metadata.d.ts +9 -4
- package/dist/lsp-metadata.js +187 -3
- package/dist/lsp-metadata.mjs +185 -4
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js +3 -3
- package/dist/metadata.mjs +3 -3
- package/dist/multilingual/bridge.d.ts +1 -1
- package/dist/multilingual/index.js +79 -22
- package/dist/multilingual/index.mjs +79 -22
- package/dist/parser/command-parsers/animation-commands.d.ts +1 -0
- package/dist/parser/command-parsers/utility-commands.d.ts +1 -0
- package/dist/parser/extensions.d.ts +51 -0
- package/dist/parser/full-parser.js +1223 -897
- package/dist/parser/full-parser.mjs +1223 -897
- package/dist/parser/helpers/ast-helpers.d.ts +1 -0
- package/dist/parser/helpers/parsing-helpers.d.ts +4 -0
- package/dist/parser/parser-types.d.ts +8 -28
- package/dist/parser/parser.d.ts +3 -7
- package/dist/parser/pratt-parser.d.ts +0 -3
- package/dist/parser/runtime.d.ts +4 -0
- package/dist/parser/semantic-integration.d.ts +17 -0
- package/dist/parser/types.d.ts +7 -1
- package/dist/reference/index.js +91 -0
- package/dist/reference/index.mjs +91 -0
- package/dist/registry/index.js +12867 -5876
- package/dist/registry/index.mjs +12867 -5876
- package/dist/registry/universal-types.d.ts +2 -1
- package/dist/runtime/command-adapter.d.ts +23 -16
- package/dist/runtime/plugin.d.ts +14 -0
- package/dist/runtime/runtime-base.d.ts +32 -7
- package/dist/runtime/runtime-factory.d.ts +3 -3
- package/dist/runtime/runtime.d.ts +2 -2
- package/dist/test-setup.d.ts +1 -0
- package/dist/types/base-types.d.ts +3 -0
- package/dist/types/feature-types.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +29 -23
- package/vocab/htmx/ar.js +60 -0
- package/vocab/htmx/bn.js +49 -0
- package/vocab/htmx/de.js +60 -0
- package/vocab/htmx/en.js +21 -0
- package/vocab/htmx/es.js +60 -0
- package/vocab/htmx/fr.js +59 -0
- package/vocab/htmx/he.js +40 -0
- package/vocab/htmx/hi.js +60 -0
- package/vocab/htmx/id.js +57 -0
- package/vocab/htmx/it.js +58 -0
- package/vocab/htmx/ja.js +60 -0
- package/vocab/htmx/ko.js +60 -0
- package/vocab/htmx/ms.js +35 -0
- package/vocab/htmx/pl.js +60 -0
- package/vocab/htmx/pt.js +60 -0
- package/vocab/htmx/qu.js +60 -0
- package/vocab/htmx/ru.js +60 -0
- package/vocab/htmx/sw.js +59 -0
- package/vocab/htmx/th.js +49 -0
- package/vocab/htmx/tl.js +33 -0
- package/vocab/htmx/tr.js +60 -0
- package/vocab/htmx/uk.js +60 -0
- package/vocab/htmx/vi.js +51 -0
- package/vocab/htmx/zh.js +60 -0
- package/dist/bundles/test-minimal.d.ts +0 -3
- package/dist/bundles/test-standard.d.ts +0 -3
- package/dist/chunks/bridge-Clbh_xAj.js +0 -2
- package/dist/chunks/browser-modular-DIOxQqhV.js +0 -2
- package/dist/chunks/feature-eventsource-B5F2-H1r.js +0 -2
- package/dist/chunks/feature-webworker-3bAp0ac9.js +0 -2
- package/dist/chunks/index-DcxoRUBe.js +0 -2
- package/dist/compatibility/browser-bundle-minimal.d.ts +0 -8
- package/dist/compatibility/browser-bundle-standard.d.ts +0 -8
- package/dist/compatibility/hyperscript-tests/test-adapter.d.ts +0 -13
- package/dist/core/base-expression-evaluator.d.ts +0 -74
- package/dist/core/binary-expression-evaluator.d.ts +0 -7
- package/dist/core/call-expression-evaluator.d.ts +0 -7
- package/dist/core/configurable-expression-evaluator.d.ts +0 -5
- package/dist/core/lazy-expression-evaluator.d.ts +0 -22
- package/dist/core/parser.d.ts +0 -21
- package/dist/core/selector-evaluator.d.ts +0 -15
- package/dist/core/template-literal-evaluator.d.ts +0 -5
- package/dist/expressions/comparison/index.d.ts +0 -80
- package/dist/expressions/comparison/utils.d.ts +0 -2
- package/dist/expressions/conversion/impl/bridge.d.ts +0 -117
- package/dist/expressions/logical/impl/pattern-matching.d.ts +0 -58
- package/dist/expressions/positional/impl/bridge.d.ts +0 -95
- package/dist/expressions/property/index.d.ts +0 -55
- package/dist/expressions/references/impl/bridge.d.ts +0 -54
- package/dist/extensions/index.d.ts +0 -3
- package/dist/extensions/tailwind.d.ts +0 -22
- package/dist/mod.d.ts +0 -63
- package/dist/parser/expression-parser.d.ts +0 -6
- package/dist/runtime/runtime-experimental.d.ts +0 -18
- package/dist/scripts/code-generator.d.ts +0 -64
- package/dist/scripts/generate-missing-commands.d.ts +0 -4
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{v as e,z as t}from"./feature-sockets-ClOH7vk7.js";function n(e,t,n=1e3){e.push(t),e.length>n&&e.shift()}const r=e.object({source:t.object({url:e.string().min(1),withCredentials:e.boolean().default(!1),headers:t.record(e.string(),e.string()).default({}),retry:e.object({enabled:e.boolean().default(!0),maxAttempts:e.number().default(5),delay:e.number().default(3e3),backoff:t.enum(["linear","exponential"]).default("exponential"),maxDelay:e.number().default(3e4)}).default({}),timeout:e.object({enabled:e.boolean().default(!0),duration:e.number().default(6e4)}).default({})}),eventHandlers:e.array(e.object({event:e.string().min(1),commands:e.array(e.any()).min(1),filter:e.string().optional(),options:t.object({throttle:e.number().optional(),debounce:e.number().optional()}).optional()})).default([]),messageProcessing:e.object({format:t.enum(["text","json","raw"]).default("text"),validation:t.object({enabled:e.boolean().default(!0),schema:e.any().optional()}).default({}),buffer:e.object({enabled:e.boolean().default(!0),maxSize:e.number().min(0).default(100),flushInterval:e.number().default(1e3)}).default({})}).default({}),context:e.object({variables:t.record(e.string(),e.any()).default({}),me:e.any().optional(),it:e.any().optional(),target:e.any().optional()}).default({}),options:e.object({enableAutoConnect:e.boolean().default(!0),enableMessageBuffer:e.boolean().default(!0),enableErrorHandling:e.boolean().default(!0),maxConnections:e.number().default(1),connectionTimeout:e.number().default(3e4)}).default({}),environment:t.enum(["frontend","backend","universal"]).default("frontend"),debug:e.boolean().default(!1)}),s=e.object({contextId:e.string(),timestamp:e.number(),category:e.literal("Frontend"),capabilities:e.array(e.string()),state:t.enum(["ready","connecting","connected","disconnecting","disconnected","error"]),connection:t.object({connect:e.any(),disconnect:e.any(),reconnect:e.any(),getState:e.any(),getConnectionInfo:e.any(),isConnected:e.any()}),events:e.object({addHandler:e.any(),removeHandler:e.any(),getHandlers:e.any(),emit:e.any()}),messages:e.object({getHistory:e.any(),getBuffer:e.any(),flushBuffer:e.any(),clearHistory:e.any(),subscribe:e.any(),unsubscribe:e.any()}),errors:e.object({handle:e.any(),getErrorHistory:e.any(),clearErrors:e.any(),setErrorHandler:e.any()})});class o{constructor(){this.name="eventsourceFeature",this.category="Frontend",this.description="Type-safe Server-Sent Events management feature with connection handling, message processing, and comprehensive error recovery",this.inputSchema=r,this.outputType="Context",this.evaluationHistory=[],this.connections=new Map,this.messageHistory=[],this.eventHandlers=new Map,this.messageBuffers=new Map,this.errorHistory=[],this.throttleTimers=new Map,this.debounceTimers=new Map,this.filterCache=new Map,this.metadata={category:"Frontend",complexity:"complex",sideEffects:["sse-connection","event-listening","background-processing"],dependencies:["eventsource-api","stream-processing","connection-management"],returnTypes:["Context"],examples:[{input:'{ source: { url: "/api/events" }, eventHandlers: [{ event: "message", commands: [{ name: "processUpdate" }] }] }',description:"Create Server-Sent Events connection for real-time updates",expectedOutput:"TypedEventSourceContext with SSE connection and message handling"},{input:'{ source: { url: "/api/notifications", retry: { maxAttempts: 10 } }, messageProcessing: { format: "json" } }',description:"SSE connection with automatic retry and JSON message processing",expectedOutput:"Event source context with robust reconnection and data parsing"},{input:'{ source: { url: "/api/metrics" }, messageProcessing: { buffer: { enabled: true, maxSize: 500 } } }',description:"High-volume SSE with message buffering for performance",expectedOutput:"Buffered event source for handling high-frequency updates"}],relatedExpressions:[],relatedContexts:["socketsFeature","onFeature","executionContext"],frameworkDependencies:["eventsource-api","hyperscript-runtime"],environmentRequirements:{browser:!0,server:!1,nodejs:!1},performance:{averageTime:15,complexity:"O(n)"}},this.documentation={summary:"Creates and manages Server-Sent Events connections for real-time data streaming with type-safe message handling, automatic reconnection, and comprehensive error recovery",parameters:[{name:"sourceConfig",type:"EventSourceInput",description:"SSE configuration including server URL, event handlers, message processing options, and connection settings",optional:!1,examples:['{ source: { url: "/api/events" }, eventHandlers: [{ event: "message", commands: [{ name: "update" }] }] }','{ source: { url: "/api/stream", withCredentials: true }, messageProcessing: { format: "json" } }','{ source: { url: "/api/feed" }, messageProcessing: { buffer: { enabled: true, maxSize: 100 } } }']}],returns:{type:"EventSourceContext",description:"Server-Sent Events management context with connection lifecycle, message processing, buffer management, and error recovery capabilities",examples:["context.connection.connect() → establish SSE connection","context.messages.getHistory(50) → get last 50 messages","context.connection.reconnect() → reconnect after failure","context.messages.flushBuffer() → process buffered messages"]},examples:[{title:"Basic SSE connection",code:'const sseContext = await createEventSourceFeature({ source: { url: "/api/updates" } })',explanation:"Create Server-Sent Events connection for real-time updates",output:"SSE context ready for receiving server events"},{title:"JSON message processing",code:'await sseContext.events.addHandler("user-update", { name: "updateUserInterface", args: [] })',explanation:"Add handler for specific event types with JSON parsing",output:"Event-driven SSE with structured data processing"},{title:"Buffered high-frequency events",code:"await sseContext.messages.flushBuffer() // Process accumulated messages",explanation:"Batch process high-frequency events for performance",output:"Efficient handling of rapid event streams"}],seeAlso:["socketsFeature","onFeature","streamProcessing","realTimeUpdates"],tags:["server-sent-events","real-time","streaming","events","connection-management","type-safe","enhanced-pattern"]}}async initialize(e){const t=Date.now();try{const n=this.validate(e);if(!n.isValid)return{success:!1,error:n.errors[0]};const r=await this.initializeConfig(e),s={contextId:"eventsource-"+Date.now(),timestamp:t,category:"Frontend",capabilities:["sse-connection","message-processing","event-handling","automatic-reconnection","error-recovery"],state:"ready",connection:{connect:this.createConnectionEstablisher(r),disconnect:this.createConnectionDisconnector(),reconnect:this.createConnectionReconnector(),getState:this.createStateGetter(),getConnectionInfo:this.createConnectionInfoGetter(),isConnected:this.createConnectionChecker()},events:{addHandler:this.createEventHandlerAdder(),removeHandler:this.createEventHandlerRemover(),getHandlers:this.createEventHandlerGetter(),emit:this.createEventEmitter()},messages:{getHistory:this.createMessageHistoryGetter(),getBuffer:this.createBufferGetter(),flushBuffer:this.createBufferFlusher(),clearHistory:this.createHistoryClearer(),subscribe:this.createMessageSubscriber(),unsubscribe:this.createMessageUnsubscriber()},errors:{handle:this.createErrorHandler(),getErrorHistory:this.createErrorHistoryGetter(),clearErrors:this.createErrorClearer(),setErrorHandler:this.createErrorHandlerSetter()}};return!1!==e.options?.enableAutoConnect&&await this.createConnection(e.source,e.context||{}),this.trackPerformance(t,!0,s),{success:!0,value:s,type:"object"}}catch(e){return this.trackPerformance(t,!1),{success:!1,error:{type:"runtime-error",message:"EventSource feature initialization failed: "+(e instanceof Error?e.message:e+""),suggestions:["Verify EventSource URL is accessible","Check browser supports Server-Sent Events","Ensure server supports SSE with proper headers","Validate event configuration parameters"]}}}}validate(e){try{if(!e||"object"!=typeof e)return{isValid:!1,errors:[{type:"invalid-input",message:"Input must be an object",suggestions:[]}],suggestions:["Provide a valid EventSource configuration object"]};const t=e,n=[],r=[];if(void 0!==t.messageProcessing?.buffer?.maxSize&&0>t.messageProcessing.buffer.maxSize&&(n.push({type:"invalid-input",code:"invalid-buffer-size",message:"Buffer size must be non-negative (0 = unlimited)",path:"messageProcessing.buffer.maxSize",suggestions:[]}),r.push("Set buffer maxSize to 0 for unlimited or positive number for limit")),t.eventHandlers&&Array.isArray(t.eventHandlers))for(const e of t.eventHandlers)e.commands&&Array.isArray(e.commands)&&0===e.commands.length&&(n.push({type:"empty-config",code:"empty-commands-array",message:"Event handler commands array cannot be empty",path:"eventHandlers.commands",suggestions:[]}),r.push("Add at least one command to execute for event handler"));if(n.length>0)return{isValid:!1,errors:n,suggestions:r};const s=this.inputSchema.parse(e);if(s.source&&(this.isValidEventSourceURL(s.source.url)||(n.push({type:"invalid-input",code:"invalid-eventsource-url",message:`Invalid EventSource URL: "${s.source.url}"`,path:"source.url",suggestions:[]}),r.push("Use valid HTTP/HTTPS URL for EventSource connection")),s.source.retry&&(0>s.source.retry.maxAttempts&&(n.push({type:"invalid-input",code:"invalid-retry-attempts",message:"Retry max attempts must be non-negative",path:"source.retry.maxAttempts",suggestions:[]}),r.push("Set maxAttempts to 0 for no retry or positive number for retry limit")),0>s.source.retry.delay&&(n.push({type:"invalid-input",code:"invalid-retry-delay",message:"Retry delay must be non-negative",path:"source.retry.delay",suggestions:[]}),r.push("Set retry delay to positive number in milliseconds")),s.source.retry.delay>s.source.retry.maxDelay&&(n.push({type:"validation-error",message:"Max delay must be greater than or equal to delay",path:"source.retry.maxDelay",suggestions:[]}),r.push("Set maxDelay to be greater than or equal to delay"))),s.source.timeout&&1e3>s.source.timeout.duration&&(n.push({type:"invalid-input",code:"invalid-timeout-duration",message:"Timeout duration must be at least 1000ms",path:"source.timeout.duration",suggestions:[]}),r.push("Set timeout duration to at least 1000ms for proper operation"))),s.options&&(1>s.options.maxConnections&&(n.push({type:"invalid-input",code:"invalid-max-connections",message:"maxConnections must be at least 1",path:"options.maxConnections",suggestions:[]}),r.push("Set maxConnections to at least 1")),1e3>s.options.connectionTimeout&&(n.push({type:"invalid-input",code:"invalid-connection-timeout",message:"Connection timeout must be at least 1000ms",path:"options.connectionTimeout",suggestions:[]}),r.push("Set connection timeout to at least 1000ms for proper operation"))),s.eventHandlers&&s.eventHandlers.length>0)for(const e of s.eventHandlers)if(e.options?.throttle&&e.options?.debounce&&(n.push({type:"schema-validation",code:"conflicting-performance-options",message:"Cannot use both throttle and debounce simultaneously",path:"eventHandlers.options",suggestions:[]}),r.push("Choose either throttle OR debounce, not both")),e.filter)try{Function("event","return "+e.filter)}catch(t){n.push({type:"invalid-input",code:"invalid-filter-expression",message:"Invalid filter expression: "+e.filter,path:"eventHandlers.filter",suggestions:[]}),r.push("Use valid JavaScript expression for event filtering")}return"undefined"==typeof EventSource&&(n.push({type:"runtime-error",message:"Server-Sent Events are not supported in this environment",suggestions:[]}),r.push("EventSource requires a browser environment")),{isValid:0===n.length,errors:n,suggestions:r}}catch(e){return{isValid:!1,errors:[{type:"schema-validation",suggestions:[],message:e instanceof Error?e.message:"Invalid input format"}],suggestions:["Ensure input matches EventSourceInput schema","Check source configuration structure","Verify event handlers and message processing configurations"]}}}async initializeConfig(e){return{...e.options,environment:e.environment,debug:e.debug,initialized:Date.now()}}async createConnection(e,t){const r=`connection-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,s={id:r,url:e.url,eventSource:null,state:"connecting",createdAt:Date.now(),lastMessageTime:0,messageCount:0,errorCount:0,retryAttempts:0,maxRetryAttempts:e.retry?.maxAttempts||5};try{return s.eventSource=new EventSource(e.url,{withCredentials:e.withCredentials||!1}),s.eventSource.onopen=e=>{s.state="connected",s.connectedAt=Date.now(),s.retryAttempts=0,this.handleConnectionOpen(s,e)},s.eventSource.onmessage=e=>{s.messageCount++,s.lastMessageTime=Date.now(),this.handleMessage(s,e)},s.eventSource.onerror=e=>{s.errorCount++,s.state="error",this.handleConnectionError(s,e)},this.connections.set(r,s),s}catch(t){throw s.state="error",s.errorCount++,n(this.errorHistory,{error:t,timestamp:Date.now(),context:{connection:s,sourceConfig:e}}),t}}handleConnectionOpen(e,t){this.processEventHandlers(e.id,"open",t)}handleMessage(e,t){const r={id:`msg-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,connectionId:e.id,event:t.type,data:t.data,timestamp:Date.now(),format:this.detectMessageFormat(t.data),...t.lastEventId&&{lastEventId:t.lastEventId},...t.origin&&{origin:t.origin}};n(this.messageHistory,r);const s=this.messageBuffers.get(e.id);s&&(s.messages.push(r),s.maxSize>0&&s.messages.length>s.maxSize&&s.messages.shift()),this.processEventHandlers(e.id,"message",t)}handleConnectionError(e,t){n(this.errorHistory,{error:Error("EventSource connection error"),timestamp:Date.now(),context:{connection:e,event:t}}),this.processEventHandlers(e.id,"error",t),e.maxRetryAttempts>e.retryAttempts&&this.scheduleReconnection(e)}scheduleReconnection(e){e.retryAttempts++;setTimeout(()=>{this.attemptReconnection(e)},3e3*e.retryAttempts)}async attemptReconnection(e){try{e.eventSource&&e.eventSource.close(),e.state="connecting",e.eventSource=new EventSource(e.url),e.eventSource.onopen=t=>{e.state="connected",e.connectedAt=Date.now(),e.retryAttempts=0,this.handleConnectionOpen(e,t)},e.eventSource.onmessage=t=>{e.messageCount++,e.lastMessageTime=Date.now(),this.handleMessage(e,t)},e.eventSource.onerror=t=>{e.errorCount++,e.state="error",this.handleConnectionError(e,t)}}catch(t){n(this.errorHistory,{error:t,timestamp:Date.now(),context:{connection:e,reconnectAttempt:e.retryAttempts}})}}processEventHandlers(e,t,n){const r=Array.from(this.eventHandlers.values()).filter(n=>n.connectionId===e&&n.eventType===t&&n.isActive);for(const e of r)this.executeEventHandler(e,n)}async executeEventHandler(e,t){try{if(e.filter&&!this.testEventFilter(t,e.filter))return;if(e.options?.throttle&&this.isThrottled(e.id,e.options.throttle))return;if(e.options?.debounce)return void this.applyDebounce(e.id,e.options.debounce,()=>{this.executeCommands(e.commands,{event:t})});await this.executeCommands(e.commands,{event:t}),e.executionCount++,e.lastExecutionTime=Date.now()}catch(r){n(this.errorHistory,{error:r,timestamp:Date.now(),context:{handler:e,event:t}})}}async executeCommands(e,t){const n={success:!0,executed:e.length};for(const n of e)"object"==typeof n&&n.name&&await this.executeBasicCommand(n,t);return n}async executeBasicCommand(e,t){e.name}isValidEventSourceURL(e){try{const t=new URL(e,window?.location?.href);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}}detectMessageFormat(e){if("string"==typeof e)try{return JSON.parse(e),"json"}catch{return"text"}return"raw"}testEventFilter(e,t){try{let n=this.filterCache.get(t);return n||(n=Function("event","return "+t),this.filterCache.set(t,n)),!!n(e)}catch{return!0}}isThrottled(e,t){const n=this.throttleTimers.get(e)||0,r=Date.now();return t>r-n||(this.throttleTimers.set(e,r),!1)}applyDebounce(e,t,n){const r=this.debounceTimers.get(e);r&&clearTimeout(r);const s=setTimeout(n,t);this.debounceTimers.set(e,s)}createConnectionEstablisher(e){return async t=>{const n=t||e;return await this.createConnection(n,{})}}createConnectionDisconnector(){return async e=>{const t=this.connections.get(e);return!!t&&(t.state="disconnecting",t.eventSource&&(t.eventSource.close(),t.eventSource=null),t.state="disconnected",t.disconnectedAt=Date.now(),!0)}}createConnectionReconnector(){return async e=>{const t=this.connections.get(e);return!!t&&(await this.attemptReconnection(t),!0)}}createStateGetter(){return e=>{const t=this.connections.get(e);return t?t.state:"disconnected"}}createConnectionInfoGetter(){return e=>{const t=this.connections.get(e);return t?{id:t.id,url:t.url,state:t.state,createdAt:t.createdAt,connectedAt:t.connectedAt,messageCount:t.messageCount,errorCount:t.errorCount,retryAttempts:t.retryAttempts}:null}}createConnectionChecker(){return e=>{const t=this.connections.get(e);return!!t&&"connected"===t.state}}createEventHandlerAdder(){return async(e,t,n)=>{const r=`handler-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;return this.eventHandlers.set(r,{id:r,connectionId:e,eventType:t,commands:[n],isActive:!0,executionCount:0,lastExecutionTime:0}),r}}createEventHandlerRemover(){return e=>this.eventHandlers.delete(e)}createEventHandlerGetter(){return e=>e?Array.from(this.eventHandlers.values()).filter(t=>t.connectionId===e):Array.from(this.eventHandlers.values())}createEventEmitter(){return async(e,t,n)=>!0}createMessageHistoryGetter(){return(e,t)=>{let n=this.messageHistory;return e&&(n=n.filter(t=>t.connectionId===e)),t&&(n=n.slice(-t)),n}}createBufferGetter(){return e=>{const t=this.messageBuffers.get(e);return t?t.messages.slice():[]}}createBufferFlusher(){return async e=>{const t=this.messageBuffers.get(e);if(!t||0===t.messages.length)return[];const n=t.messages.slice();return t.messages.length=0,t.lastFlushTime=Date.now(),n}}createHistoryClearer(){return e=>(this.messageHistory=e?this.messageHistory.filter(t=>t.connectionId!==e):[],!0)}createMessageSubscriber(){return async(e,t)=>{const n=`handler-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;return this.eventHandlers.set(n,{id:n,connectionId:"",eventType:e,commands:[t],isActive:!0,executionCount:0,lastExecutionTime:0}),n}}createMessageUnsubscriber(){return e=>this.eventHandlers.delete(e)}createErrorHandler(){return async(e,t)=>(n(this.errorHistory,{error:e,timestamp:Date.now(),context:t}),!0)}createErrorHistoryGetter(){return e=>e?this.errorHistory.slice(-e):this.errorHistory.slice()}createErrorClearer(){return()=>(this.errorHistory=[],!0)}createErrorHandlerSetter(){return e=>!0}dispose(){for(const e of this.connections.values())e.eventSource&&(e.eventSource.close(),e.eventSource=null);this.connections.clear();for(const e of this.debounceTimers.values())clearTimeout(e);this.debounceTimers.clear();for(const e of this.throttleTimers.values())clearTimeout(e);this.throttleTimers.clear(),this.eventHandlers.clear(),this.messageBuffers.clear(),this.filterCache.clear(),this.messageHistory=[],this.errorHistory=[],this.evaluationHistory=[]}trackPerformance(e,t,r){const s=Date.now()-e;n(this.evaluationHistory,{input:{},output:r,success:t,duration:s,timestamp:e})}getPerformanceMetrics(){return{totalInitializations:this.evaluationHistory.length,successRate:this.evaluationHistory.filter(e=>e.success).length/Math.max(this.evaluationHistory.length,1),averageDuration:this.evaluationHistory.reduce((e,t)=>e+t.duration,0)/Math.max(this.evaluationHistory.length,1),lastEvaluationTime:this.evaluationHistory[this.evaluationHistory.length-1]?.timestamp||0,evaluationHistory:this.evaluationHistory.slice(-10),totalConnections:this.connections.size,totalMessages:this.messageHistory.length,totalErrors:this.errorHistory.length,totalEventHandlers:this.eventHandlers.size,bufferedMessages:Array.from(this.messageBuffers.values()).reduce((e,t)=>e+t.messages.length,0)}}}function a(){return new o}async function i(e,t){return(new o).initialize({source:{url:"",withCredentials:!1,headers:{},retry:{enabled:!0,maxAttempts:5,delay:3e3,backoff:"exponential",maxDelay:3e4},timeout:{enabled:!0,duration:6e4},...e},eventHandlers:[],messageProcessing:{format:"text",validation:{enabled:!0},buffer:{enabled:!0,maxSize:100,flushInterval:1e3}},context:{variables:{}},options:{enableAutoConnect:!0,enableMessageBuffer:!0,enableErrorHandling:!0,maxConnections:1,connectionTimeout:3e4},environment:"frontend",debug:!1,...t})}const c=new o;export{r as EventSourceInputSchema,s as EventSourceOutputSchema,o as TypedEventSourceFeatureImplementation,i as createEventSource,a as createEventSourceFeature,c as enhancedEventSourceImplementation};
|
|
2
|
-
//# sourceMappingURL=feature-eventsource-B5F2-H1r.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{v as e,z as t}from"./feature-sockets-ClOH7vk7.js";function r(e,t,r=1e3){e.push(t),e.length>r&&e.shift()}const s=e.object({worker:t.object({script:e.string().min(1),type:t.enum(["module","classic"]).default("classic"),name:e.string().optional(),credentials:t.enum(["omit","same-origin","include"]).default("same-origin"),inline:e.boolean().default(!1)}),messaging:e.object({format:t.enum(["json","text","binary"]).default("json"),serialization:t.enum(["structured-clone","json"]).default("structured-clone"),transferables:e.array(e.string()).default([]),validation:t.object({enabled:e.boolean().default(!0),schema:e.any().optional()}).default({}),queue:e.object({enabled:e.boolean().default(!0),maxSize:e.number().min(0).default(100),persistence:e.boolean().default(!1)}).default({})}).default({}),eventHandlers:e.array(e.object({event:t.enum(["message","error","messageerror"]),commands:e.array(e.any()).min(1),filter:e.string().optional(),options:t.object({throttle:e.number().optional(),debounce:e.number().optional()}).optional()})).default([]),context:e.object({variables:t.record(e.string(),e.any()).default({}),me:e.any().optional(),it:e.any().optional(),target:e.any().optional()}).default({}),options:e.object({enableAutoStart:e.boolean().default(!0),enableMessageQueue:e.boolean().default(!0),enableErrorHandling:e.boolean().default(!0),maxWorkers:e.number().default(4),workerTimeout:e.number().default(3e4),terminationTimeout:e.number().default(5e3)}).default({}),environment:t.enum(["frontend","backend","universal"]).default("frontend"),debug:e.boolean().default(!1)}),a=e.object({contextId:e.string(),timestamp:e.number(),category:e.literal("Frontend"),capabilities:e.array(e.string()),state:t.enum(["ready","starting","running","terminating","terminated","error"]),workers:t.object({create:e.any(),terminate:e.any(),restart:e.any(),getWorker:e.any(),listWorkers:e.any(),getWorkerInfo:e.any()}),messaging:e.object({send:e.any(),sendJSON:e.any(),sendBinary:e.any(),broadcast:e.any(),getMessageHistory:e.any(),subscribe:e.any(),unsubscribe:e.any()}),events:e.object({addHandler:e.any(),removeHandler:e.any(),getHandlers:e.any(),emit:e.any()}),queue:e.object({add:e.any(),process:e.any(),getSize:e.any(),getPending:e.any(),clear:e.any()}),errors:e.object({handle:e.any(),getErrorHistory:e.any(),clearErrors:e.any(),setErrorHandler:e.any()})});class n{constructor(){this.name="webworkerFeature",this.category="Frontend",this.description="Type-safe Web Worker management feature with message handling, event processing, and comprehensive error management",this.inputSchema=s,this.outputType="Context",this.evaluationHistory=[],this.workers=new Map,this.messageHistory=[],this.eventHandlers=new Map,this.messageQueue=new Map,this.errorHistory=[],this.throttleTimers=new Map,this.debounceTimers=new Map,this.filterCache=new Map,this.metadata={category:"Frontend",complexity:"complex",sideEffects:["worker-creation","message-passing","background-execution"],dependencies:["web-worker-api","message-channel","transferable-objects"],returnTypes:["Context"],examples:[{input:'{ worker: { script: "./worker.js" }, messaging: { format: "json" } }',description:"Create a Web Worker for background JavaScript execution",expectedOutput:"TypedWebWorkerContext with worker management and message handling"},{input:'{ worker: { script: "self.onmessage = e => self.postMessage(e.data * 2)", inline: true } }',description:"Create inline worker for simple calculations",expectedOutput:"Worker context with inline script execution"},{input:'{ worker: { script: "./data-processor.js", type: "module" }, messaging: { transferables: ["ArrayBuffer"] } }',description:"Module worker with transferable object support for large data processing",expectedOutput:"High-performance worker context with zero-copy data transfer"}],relatedExpressions:[],relatedContexts:["socketsFeature","onFeature","executionContext"],frameworkDependencies:["web-worker-api","hyperscript-runtime"],environmentRequirements:{browser:!0,server:!1,nodejs:!1},performance:{averageTime:25,complexity:"O(n)"}},this.documentation={summary:"Creates and manages Web Workers for background JavaScript execution with type-safe message handling, event processing, and comprehensive error recovery",parameters:[{name:"workerConfig",type:"WebWorkerInput",description:"Web Worker configuration including script source, messaging format, event handlers, and performance options",optional:!1,examples:['{ worker: { script: "./worker.js" }, messaging: { format: "json" } }','{ worker: { script: "worker-code", inline: true }, options: { maxWorkers: 2 } }','{ worker: { script: "./module-worker.js", type: "module" }, messaging: { transferables: ["ArrayBuffer"] } }']}],returns:{type:"WebWorkerContext",description:"Web Worker management context with worker lifecycle, message handling, queue management, and error recovery capabilities",examples:["context.workers.create(config) → worker instance ID","context.messaging.sendJSON(workerId, data) → send JSON message to worker","context.queue.add(workerId, message) → queue message for worker","context.workers.terminate(workerId) → gracefully terminate worker"]},examples:[{title:"Basic worker creation",code:'const workerContext = await createWebWorkerFeature({ worker: { script: "./calc-worker.js" } })',explanation:"Create a Web Worker for background calculations",output:"Worker context with calculation worker ready"},{title:"Message passing with transferables",code:'await workerContext.messaging.sendBinary(workerId, arrayBuffer, ["ArrayBuffer"])',explanation:"Send large binary data to worker using transferable objects for zero-copy transfer",output:"High-performance message transfer without copying data"},{title:"Worker event handling",code:'await workerContext.events.addHandler(workerId, "message", { name: "processResult", args: [] })',explanation:"Add event handler for worker messages with command execution",output:"Event-driven worker communication with hyperscript integration"}],seeAlso:["socketsFeature","onFeature","messagingSystem","backgroundExecution"],tags:["webworkers","background-execution","message-passing","transferables","type-safe","enhanced-pattern"]}}async initialize(e){const t=Date.now();try{const r=this.validate(e);if(!r.isValid)return{success:!1,error:r.errors[0]};const s=await this.initializeConfig(e),a={contextId:"webworker-"+Date.now(),timestamp:t,category:"Frontend",capabilities:["worker-management","message-handling","background-execution","transferable-objects","error-recovery"],state:"ready",workers:{create:this.createWorkerCreator(s),terminate:this.createWorkerTerminator(),restart:this.createWorkerRestarter(),getWorker:this.createWorkerGetter(),listWorkers:this.createWorkerLister(),getWorkerInfo:this.createWorkerInfoGetter()},messaging:{send:this.createMessageSender(),sendJSON:this.createJSONSender(),sendBinary:this.createBinarySender(),broadcast:this.createBroadcaster(),getMessageHistory:this.createMessageHistoryGetter(),subscribe:this.createMessageSubscriber(),unsubscribe:this.createMessageUnsubscriber()},events:{addHandler:this.createEventHandlerAdder(),removeHandler:this.createEventHandlerRemover(),getHandlers:this.createEventHandlerGetter(),emit:this.createEventEmitter()},queue:{add:this.createQueueAdder(),process:this.createQueueProcessor(),getSize:this.createQueueSizeGetter(),getPending:this.createPendingGetter(),clear:this.createQueueClearer()},errors:{handle:this.createErrorHandler(),getErrorHistory:this.createErrorHistoryGetter(),clearErrors:this.createErrorClearer(),setErrorHandler:this.createErrorHandlerSetter()}};return e.worker.script&&!1!==e.options?.enableAutoStart&&await this.createWorker(e.worker,e.context||{}),this.trackPerformance(t,!0,a),{success:!0,value:a,type:"object"}}catch(e){return this.trackPerformance(t,!1),{success:!1,error:{type:"runtime-error",message:"WebWorker feature initialization failed: "+(e instanceof Error?e.message:e+""),suggestions:["Verify worker script URL is accessible","Check browser supports Web Workers","Ensure script has valid JavaScript syntax","Validate worker configuration parameters"]}}}}validate(e){try{if(!e||"object"!=typeof e)return{isValid:!1,errors:[{type:"invalid-input",message:"Input must be an object",suggestions:[]}],suggestions:["Provide a valid Web Worker configuration object"]};const t=e,r=[],s=[];if(void 0!==t.messaging?.queue?.maxSize&&0>t.messaging.queue.maxSize&&(r.push({type:"invalid-input",code:"invalid-queue-size",message:"Queue size must be non-negative (0 = unlimited)",path:"messaging.queue.maxSize",suggestions:[]}),s.push("Set queue maxSize to 0 for unlimited or positive number for limit")),t.eventHandlers&&Array.isArray(t.eventHandlers))for(const e of t.eventHandlers)e.commands&&Array.isArray(e.commands)&&0===e.commands.length&&(r.push({type:"empty-config",code:"empty-commands-array",message:"Event handler commands array cannot be empty",path:"eventHandlers.commands",suggestions:[]}),s.push("Add at least one command to execute for event handler"));if(r.length>0)return{isValid:!1,errors:r,suggestions:s};const a=this.inputSchema.parse(e);if(a.worker&&(a.worker.inline||this.isValidWorkerScript(a.worker.script)||(r.push({type:"invalid-input",code:"invalid-worker-script",message:`Invalid worker script: "${a.worker.script}"`,path:"worker.script",suggestions:[]}),s.push("Provide valid JavaScript file URL or inline script code")),a.worker.inline))try{"module"===a.worker.type&&a.worker.script.includes("import")||Function(a.worker.script)}catch(e){r.push({type:"syntax-error",code:"invalid-inline-script",message:"Invalid inline script syntax: "+a.worker.script,path:"worker.script",suggestions:[]}),s.push("Ensure inline script has valid JavaScript syntax")}if(a.options&&(1>a.options.maxWorkers&&(r.push({type:"invalid-input",code:"invalid-max-workers",message:"maxWorkers must be at least 1",path:"options.maxWorkers",suggestions:[]}),s.push("Set maxWorkers to at least 1")),1e3>a.options.workerTimeout&&(r.push({type:"invalid-input",code:"invalid-worker-timeout",message:"Worker timeout must be at least 1000ms",path:"options.workerTimeout",suggestions:[]}),s.push("Set worker timeout to at least 1000ms for proper operation")),1e3>a.options.terminationTimeout&&(r.push({type:"invalid-input",code:"invalid-termination-timeout",message:"Termination timeout must be at least 1000ms",path:"options.terminationTimeout",suggestions:[]}),s.push("Set termination timeout to at least 1000ms for graceful shutdown"))),a.eventHandlers&&a.eventHandlers.length>0)for(const e of a.eventHandlers)if(e.options?.throttle&&e.options?.debounce&&(r.push({type:"schema-validation",code:"conflicting-performance-options",message:"Cannot use both throttle and debounce simultaneously",path:"eventHandlers.options",suggestions:[]}),s.push("Choose either throttle OR debounce, not both")),e.filter)try{Function("message","return "+e.filter)}catch(t){r.push({type:"invalid-input",code:"invalid-filter-expression",message:"Invalid filter expression: "+e.filter,path:"eventHandlers.filter",suggestions:[]}),s.push("Use valid JavaScript expression for message filtering")}return"undefined"==typeof Worker&&(r.push({type:"runtime-error",message:"Web Workers are not supported in this environment",suggestions:[]}),s.push("Web Workers require a browser environment")),{isValid:0===r.length,errors:r,suggestions:s}}catch(e){return{isValid:!1,errors:[{type:"schema-validation",suggestions:[],message:e instanceof Error?e.message:"Invalid input format"}],suggestions:["Ensure input matches WebWorkerInput schema","Check worker configuration structure","Verify messaging and event handler configurations"]}}}async initializeConfig(e){return{...e.options,environment:e.environment,debug:e.debug,initialized:Date.now()}}async createWorker(e,t){const r=`worker-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;let s;if(e.inline){const t=new Blob([e.script],{type:"application/javascript"}),a=URL.createObjectURL(t);s=new Worker(a,{type:e.type||"classic",name:e.name||r}),setTimeout(()=>URL.revokeObjectURL(a),0)}else s=new Worker(e.script,{type:e.type||"classic",name:e.name||r});const a={id:r,name:e.name,worker:s,script:e.script,type:e.type||"classic",state:"starting",createdAt:Date.now(),lastMessageTime:0,messageCount:0,errorCount:0,isTerminating:!1};return s.onmessage=e=>{a.messageCount++,a.lastMessageTime=Date.now(),this.handleWorkerMessage(a,e)},s.onerror=e=>{a.errorCount++,a.state="error",this.handleWorkerError(a,e)},s.onmessageerror=e=>{a.errorCount++,this.handleWorkerMessageError(a,e)},this.workers.set(r,a),a.state="running",a}handleWorkerMessage(e,t){const s={id:`msg-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,workerId:e.id,type:"incoming",data:t.data,timestamp:Date.now(),format:this.detectMessageFormat(t.data)};r(this.messageHistory,s),this.processEventHandlers(e.id,"message",t)}handleWorkerError(e,t){r(this.errorHistory,{error:Error("Worker error: "+t.message),timestamp:Date.now(),context:{worker:e,event:t}}),this.processEventHandlers(e.id,"error",t)}handleWorkerMessageError(e,t){r(this.errorHistory,{error:Error("Worker message error: Failed to deserialize message"),timestamp:Date.now(),context:{worker:e,event:t}}),this.processEventHandlers(e.id,"messageerror",t)}processEventHandlers(e,t,r){const s=Array.from(this.eventHandlers.values()).filter(r=>r.workerId===e&&r.eventType===t&&r.isActive);for(const e of s)this.executeEventHandler(e,r)}async executeEventHandler(e,t){try{if(e.filter&&!this.testMessageFilter(t,e.filter))return;if(e.options?.throttle&&this.isThrottled(e.id,e.options.throttle))return;if(e.options?.debounce)return void this.applyDebounce(e.id,e.options.debounce,()=>{this.executeCommands(e.commands,{event:t})});await this.executeCommands(e.commands,{event:t}),e.executionCount++,e.lastExecutionTime=Date.now()}catch(s){r(this.errorHistory,{error:s,timestamp:Date.now(),context:{handler:e,event:t}})}}async executeCommands(e,t){const r={success:!0,executed:e.length};for(const r of e)"object"==typeof r&&r.name&&await this.executeBasicCommand(r,t);return r}async executeBasicCommand(e,t){e.name}isValidWorkerScript(e){return!(!e.startsWith("http://")&&!e.startsWith("https://"))||!!(e.startsWith("./")||e.startsWith("../")||e.startsWith("/"))}detectMessageFormat(e){return e instanceof ArrayBuffer||e instanceof Uint8Array?"binary":"string"==typeof e?"text":"json"}testMessageFilter(e,t){try{let r=this.filterCache.get(t);return r||(r=Function("message","return "+t),this.filterCache.set(t,r)),!!r(e)}catch{return!0}}isThrottled(e,t){const r=this.throttleTimers.get(e)||0,s=Date.now();return t>s-r||(this.throttleTimers.set(e,s),!1)}applyDebounce(e,t,r){const s=this.debounceTimers.get(e);s&&clearTimeout(s);const a=setTimeout(r,t);this.debounceTimers.set(e,a)}createWorkerCreator(e){return async t=>{if(this.workers.size>=(e.maxWorkers||4))throw Error("Maximum number of workers reached");return await this.createWorker(t,{})}}createWorkerTerminator(){return async(e,t)=>{const r=this.workers.get(e);if(!r)return!1;r.isTerminating=!0,r.state="terminating";return setTimeout(()=>{"terminating"===r.state&&(r.worker.terminate(),r.state="terminated",this.workers.delete(e))},t||5e3),!0}}createWorkerRestarter(){return async e=>{const t=this.workers.get(e);if(!t)return!1;t.worker.terminate(),this.workers.delete(e);return(await this.createWorker({script:t.script,type:t.type,name:t.name,inline:!1},{})).id}}createWorkerGetter(){return e=>this.workers.get(e)||null}createWorkerLister(){return()=>Array.from(this.workers.keys())}createWorkerInfoGetter(){return e=>{const t=this.workers.get(e);return t?{id:t.id,name:t.name,state:t.state,createdAt:t.createdAt,messageCount:t.messageCount,errorCount:t.errorCount,lastMessageTime:t.lastMessageTime}:null}}createMessageSender(){return async(e,t,s)=>{const a=this.workers.get(e);if(!a||"running"!==a.state)return!1;try{a.worker.postMessage(t,s||[]);const n={id:`msg-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,workerId:e,type:"outgoing",data:t,...s&&{transferables:s},timestamp:Date.now(),format:this.detectMessageFormat(t)};return r(this.messageHistory,n),!0}catch(s){return r(this.errorHistory,{error:s,timestamp:Date.now(),context:{workerId:e,data:t}}),!1}}}createJSONSender(){return async(e,t)=>await this.createMessageSender()(e,t)}createBinarySender(){return async(e,t)=>{const r=t instanceof ArrayBuffer?[t]:[];return await this.createMessageSender()(e,t,r)}}createBroadcaster(){return async(e,t)=>{const r=[];for(const s of this.workers.keys()){const a=await this.createMessageSender()(s,e,t);r.push(a)}return r.every(e=>e)}}createMessageHistoryGetter(){return(e,t)=>{let r=this.messageHistory;return e&&(r=r.filter(t=>t.workerId===e)),t&&(r=r.slice(-t)),r}}createMessageSubscriber(){return async(e,t)=>{const r=`handler-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;return this.eventHandlers.set(r,{id:r,workerId:"",eventType:e,commands:[t],isActive:!0,executionCount:0,lastExecutionTime:0}),r}}createMessageUnsubscriber(){return e=>this.eventHandlers.delete(e)}createEventHandlerAdder(){return async(e,t,r)=>{const s=`handler-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;return this.eventHandlers.set(s,{id:s,workerId:e,eventType:t,commands:[r],isActive:!0,executionCount:0,lastExecutionTime:0}),s}}createEventHandlerRemover(){return e=>this.eventHandlers.delete(e)}createEventHandlerGetter(){return e=>e?Array.from(this.eventHandlers.values()).filter(t=>t.workerId===e):Array.from(this.eventHandlers.values())}createEventEmitter(){return async(e,t,r)=>!0}createQueueAdder(){return async(e,t)=>{this.messageQueue.has(e)||this.messageQueue.set(e,[]);return this.messageQueue.get(e).push({id:`queued-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,workerId:e,type:"outgoing",data:t,timestamp:Date.now(),format:this.detectMessageFormat(t)}),!0}}createQueueProcessor(){return async e=>{const t=this.messageQueue.get(e);if(!t||0===t.length)return!0;const s=this.workers.get(e);if(!s||"running"!==s.state)return!1;try{for(const e of t)s.worker.postMessage(e.data),r(this.messageHistory,e);return t.length=0,!0}catch(s){return r(this.errorHistory,{error:s,timestamp:Date.now(),context:{workerId:e,queueSize:t.length}}),!1}}}createQueueSizeGetter(){return e=>{const t=this.messageQueue.get(e);return t?t.length:0}}createPendingGetter(){return e=>{const t=this.messageQueue.get(e);return t?t.slice():[]}}createQueueClearer(){return e=>{const t=this.messageQueue.get(e);return!!t&&(t.length=0,!0)}}createErrorHandler(){return async(e,t)=>(r(this.errorHistory,{error:e,timestamp:Date.now(),context:t}),!0)}createErrorHistoryGetter(){return e=>e?this.errorHistory.slice(-e):this.errorHistory.slice()}createErrorClearer(){return()=>(this.errorHistory=[],!0)}createErrorHandlerSetter(){return e=>!0}dispose(){for(const e of this.workers.values())e.worker.terminate();this.workers.clear();for(const e of this.debounceTimers.values())clearTimeout(e);this.debounceTimers.clear();for(const e of this.throttleTimers.values())clearTimeout(e);this.throttleTimers.clear(),this.eventHandlers.clear(),this.messageQueue.clear(),this.filterCache.clear(),this.messageHistory=[],this.errorHistory=[],this.evaluationHistory=[]}trackPerformance(e,t,s){const a=Date.now()-e;r(this.evaluationHistory,{input:{},output:s,success:t,duration:a,timestamp:e})}getPerformanceMetrics(){return{totalInitializations:this.evaluationHistory.length,successRate:this.evaluationHistory.filter(e=>e.success).length/Math.max(this.evaluationHistory.length,1),averageDuration:this.evaluationHistory.reduce((e,t)=>e+t.duration,0)/Math.max(this.evaluationHistory.length,1),lastEvaluationTime:this.evaluationHistory[this.evaluationHistory.length-1]?.timestamp||0,evaluationHistory:this.evaluationHistory.slice(-10),totalWorkers:this.workers.size,totalMessages:this.messageHistory.length,totalErrors:this.errorHistory.length,totalEventHandlers:this.eventHandlers.size,queuedMessages:Array.from(this.messageQueue.values()).reduce((e,t)=>e+t.length,0)}}}function o(){return new n}async function i(e,t){return(new n).initialize({worker:{script:"",type:"classic",credentials:"same-origin",inline:!1,...e},messaging:{format:"json",serialization:"structured-clone",transferables:[],validation:{enabled:!0},queue:{enabled:!0,maxSize:100,persistence:!1}},eventHandlers:[],context:{variables:{}},options:{enableAutoStart:!0,enableMessageQueue:!0,enableErrorHandling:!0,maxWorkers:4,workerTimeout:3e4,terminationTimeout:5e3},environment:"frontend",debug:!1,...t})}const c=new n;export{n as TypedWebWorkerFeatureImplementation,s as WebWorkerInputSchema,a as WebWorkerOutputSchema,i as createWebWorker,o as createWebWorkerFeature,c as enhancedWebWorkerImplementation};
|
|
2
|
-
//# sourceMappingURL=feature-webworker-3bAp0ac9.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
let n=null;async function t(){if(!n)try{n=await import("./browser-modular-DIOxQqhV.js").then(function(n){return n.n})}catch{throw Error("@lokascript/framework is required for LSE support. Install it: npm install @lokascript/framework")}return n}function r(){if(n)return!0;try{return require.resolve("@lokascript/framework"),!0}catch{return!1}}async function a(n,r){return(await t()).parseExplicit(n,r)}async function o(n){return(await t()).isExplicitSyntax(n)}async function i(n){return(await t()).renderExplicit(n)}async function e(n){return(await t()).fromInterchangeNode(n)}async function c(n){return(await t()).toProtocolJSON(n)}async function u(n){return(await t()).fromProtocolJSON(n)}async function s(n){return(await t()).validateProtocolJSON(n)}async function f(n){return(await t()).toEnvelopeJSON(n)}async function l(n){return(await t()).fromEnvelopeJSON(n)}async function w(n){return(await t()).isEnvelope(n)}async function p(n){return(await t()).semanticNodeToRuntimeAST(n)}export{l as fromEnvelopeJSON,e as fromInterchangeNode,u as fromProtocolJSON,w as isEnvelope,o as isExplicitSyntax,r as isLSEAvailable,a as parseExplicit,i as renderExplicit,p as semanticNodeToRuntimeAST,f as toEnvelopeJSON,c as toProtocolJSON,s as validateProtocolJSON};
|
|
2
|
-
//# sourceMappingURL=index-DcxoRUBe.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Runtime } from '../runtime/runtime';
|
|
2
|
-
import { parse } from '../parser/parser';
|
|
3
|
-
import { defaultAttributeProcessor } from '../dom/attribute-processor';
|
|
4
|
-
import { createContext } from '../core/context';
|
|
5
|
-
export declare function createMinimalRuntime(): Runtime;
|
|
6
|
-
declare const runtime: Runtime;
|
|
7
|
-
export { runtime, parse, createContext, defaultAttributeProcessor };
|
|
8
|
-
//# sourceMappingURL=browser-bundle-minimal.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Runtime } from '../runtime/runtime';
|
|
2
|
-
import { parse } from '../parser/parser';
|
|
3
|
-
import { defaultAttributeProcessor } from '../dom/attribute-processor';
|
|
4
|
-
import { createContext } from '../core/context';
|
|
5
|
-
export declare function createStandardRuntime(): Runtime;
|
|
6
|
-
declare const runtime: Runtime;
|
|
7
|
-
export { runtime, parse, createContext, defaultAttributeProcessor };
|
|
8
|
-
//# sourceMappingURL=browser-bundle-standard.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function createHyperScriptTestAdapter(): (src: string, ctx?: any) => Promise<any>;
|
|
2
|
-
export declare const testUtils: {
|
|
3
|
-
evalHyperScript: (src: string, ctx?: any) => Promise<any>;
|
|
4
|
-
getParseErrorFor: (src: string, ctx?: any) => string;
|
|
5
|
-
byId: (id: string) => Element | null;
|
|
6
|
-
make: (htmlStr: string) => Element;
|
|
7
|
-
clearWorkArea: () => void;
|
|
8
|
-
getWorkArea: () => Element | null;
|
|
9
|
-
promiseAnIntIn: (millis: number) => Promise<number>;
|
|
10
|
-
promiseValueBackIn: (value: any, millis: number) => Promise<any>;
|
|
11
|
-
startsWith: (str: string, expected: string) => void;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=test-adapter.d.ts.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ASTNode, ExecutionContext } from '../types/core';
|
|
2
|
-
import type { ExecutionResult } from '../types/result';
|
|
3
|
-
export declare class BaseExpressionEvaluator {
|
|
4
|
-
protected expressionRegistry: Map<string, any>;
|
|
5
|
-
constructor();
|
|
6
|
-
protected registerCategory(expressions: Record<string, any>): void;
|
|
7
|
-
protected unwrapSelectorResult<T>(value: T | T[] | NodeList): T;
|
|
8
|
-
evaluate(node: ASTNode, context: ExecutionContext): Promise<any>;
|
|
9
|
-
evaluateWithResult(node: ASTNode, context: ExecutionContext): Promise<ExecutionResult<unknown>>;
|
|
10
|
-
protected evaluateArrayLiteral(node: any, context: ExecutionContext): Promise<any[]>;
|
|
11
|
-
protected evaluateObjectLiteral(node: any, context: ExecutionContext): Promise<Record<string, any>>;
|
|
12
|
-
protected evaluateConditionalExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
13
|
-
protected evaluateTemplateLiteral(node: any, context: ExecutionContext): Promise<string>;
|
|
14
|
-
protected evaluateSimpleExpression(exprCode: string, context: ExecutionContext): Promise<any>;
|
|
15
|
-
protected resolveValue(name: string, context: ExecutionContext): Promise<any>;
|
|
16
|
-
protected evaluateIdentifier(node: {
|
|
17
|
-
name: string;
|
|
18
|
-
scope?: 'local' | 'global';
|
|
19
|
-
}, context: ExecutionContext): Promise<any>;
|
|
20
|
-
protected evaluateLiteral(node: {
|
|
21
|
-
value: any;
|
|
22
|
-
}, _context: ExecutionContext): Promise<any>;
|
|
23
|
-
protected evaluateContextReference(node: {
|
|
24
|
-
contextType: string;
|
|
25
|
-
name: string;
|
|
26
|
-
}, context: ExecutionContext): Promise<any>;
|
|
27
|
-
protected evaluateMemberExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
28
|
-
private coerceArithmeticOperand;
|
|
29
|
-
protected evaluateBinaryExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
30
|
-
protected evaluateUnaryExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
31
|
-
protected evaluateCallExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
32
|
-
private evaluateMethodCall;
|
|
33
|
-
protected evaluateSelector(node: {
|
|
34
|
-
value: string;
|
|
35
|
-
}, context: ExecutionContext): Promise<HTMLElement[]>;
|
|
36
|
-
protected evaluateAttributeAccess(node: {
|
|
37
|
-
attributeName: string;
|
|
38
|
-
}, context: ExecutionContext): string | boolean | null;
|
|
39
|
-
protected evaluateAsExpression(node: {
|
|
40
|
-
expression: any;
|
|
41
|
-
targetType: string;
|
|
42
|
-
}, context: ExecutionContext): Promise<unknown>;
|
|
43
|
-
getAvailableExpressions(): string[];
|
|
44
|
-
protected evaluateDollarExpression(node: {
|
|
45
|
-
expression: any;
|
|
46
|
-
}, context: ExecutionContext): Promise<any>;
|
|
47
|
-
protected evaluatePossessiveExpression(node: any, context: ExecutionContext): Promise<any>;
|
|
48
|
-
hasExpression(name: string): boolean;
|
|
49
|
-
protected evaluateCSSSelector(node: {
|
|
50
|
-
selectorType: string;
|
|
51
|
-
selector: string;
|
|
52
|
-
}, context: ExecutionContext): Promise<HTMLElement | HTMLElement[] | null>;
|
|
53
|
-
protected evaluateIdSelector(node: {
|
|
54
|
-
value: string;
|
|
55
|
-
}, context: ExecutionContext): Promise<Element | null>;
|
|
56
|
-
protected evaluateQueryReference(node: {
|
|
57
|
-
selector: string;
|
|
58
|
-
}, context: ExecutionContext): Promise<NodeList>;
|
|
59
|
-
protected evaluatePropertyAccess(node: {
|
|
60
|
-
object: ASTNode;
|
|
61
|
-
property: {
|
|
62
|
-
name?: string;
|
|
63
|
-
value?: string;
|
|
64
|
-
};
|
|
65
|
-
}, context: ExecutionContext): Promise<any>;
|
|
66
|
-
protected evaluatePropertyOfExpression(node: {
|
|
67
|
-
property: {
|
|
68
|
-
name?: string;
|
|
69
|
-
value?: string;
|
|
70
|
-
};
|
|
71
|
-
target: ASTNode;
|
|
72
|
-
}, context: ExecutionContext): Promise<any>;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=base-expression-evaluator.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from '../types/core';
|
|
2
|
-
import type { EvaluateFn, UnwrapFn } from './evaluator-types';
|
|
3
|
-
export declare function coerceArithmeticOperand(value: unknown): unknown;
|
|
4
|
-
export declare function evaluateBinaryExpression(node: any, context: ExecutionContext, evaluate: EvaluateFn, unwrap: UnwrapFn, expressionRegistry: Map<string, any>, evaluateSelector: (node: {
|
|
5
|
-
value: string;
|
|
6
|
-
}, context: ExecutionContext) => Promise<HTMLElement[]>): Promise<any>;
|
|
7
|
-
//# sourceMappingURL=binary-expression-evaluator.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from '../types/core';
|
|
2
|
-
import type { EvaluateFn, UnwrapFn } from './evaluator-types';
|
|
3
|
-
export declare function evaluateCallExpression(node: any, context: ExecutionContext, evaluate: EvaluateFn, unwrap: UnwrapFn, expressionRegistry: Map<string, any>, evaluateSelector: (node: {
|
|
4
|
-
value: string;
|
|
5
|
-
}, context: ExecutionContext) => Promise<HTMLElement[]>): Promise<any>;
|
|
6
|
-
export declare function evaluateMethodCall(callee: any, args: any[], context: ExecutionContext, evaluate: EvaluateFn, unwrap: UnwrapFn): Promise<any>;
|
|
7
|
-
//# sourceMappingURL=call-expression-evaluator.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { BaseExpressionEvaluator } from './base-expression-evaluator';
|
|
2
|
-
export declare class ConfigurableExpressionEvaluator extends BaseExpressionEvaluator {
|
|
3
|
-
constructor(categories: Record<string, any>[]);
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=configurable-expression-evaluator.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ASTNode, ExecutionContext } from '../types/core';
|
|
2
|
-
import { type ExpressionCategory } from '../expressions/expression-tiers';
|
|
3
|
-
import { BaseExpressionEvaluator } from './base-expression-evaluator';
|
|
4
|
-
export interface LazyExpressionEvaluatorOptions {
|
|
5
|
-
preload?: 'core' | 'common' | 'all' | 'none';
|
|
6
|
-
categories?: ExpressionCategory[];
|
|
7
|
-
}
|
|
8
|
-
export declare class LazyExpressionEvaluator extends BaseExpressionEvaluator {
|
|
9
|
-
private loadedCategories;
|
|
10
|
-
private loadPromises;
|
|
11
|
-
private options;
|
|
12
|
-
constructor(options?: LazyExpressionEvaluatorOptions);
|
|
13
|
-
private preloadExpressions;
|
|
14
|
-
private preloadTier;
|
|
15
|
-
private loadCategory;
|
|
16
|
-
private _loadCategoryImpl;
|
|
17
|
-
private getCategoryForNodeType;
|
|
18
|
-
evaluate(node: ASTNode, context: ExecutionContext): Promise<any>;
|
|
19
|
-
warmupExpressions(categories: string[]): Promise<void>;
|
|
20
|
-
getLoadedCategories(): string[];
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=lazy-expression-evaluator.d.ts.map
|
package/dist/core/parser.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface HyperscriptParser {
|
|
2
|
-
parseElementExpression(): unknown;
|
|
3
|
-
raiseParseError(tokens: TokenStream, message: string): never;
|
|
4
|
-
}
|
|
5
|
-
export interface TokenStream {
|
|
6
|
-
matchToken(token: string): boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface BaseCommand {
|
|
9
|
-
url: unknown;
|
|
10
|
-
placement: string | null;
|
|
11
|
-
target: unknown;
|
|
12
|
-
options: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
export declare function parseURL(parser: HyperscriptParser, tokens: TokenStream): unknown;
|
|
15
|
-
export declare function parseTarget(parser: HyperscriptParser, _tokens: TokenStream): unknown;
|
|
16
|
-
export declare function parseOptionValue(parser: HyperscriptParser, _tokens: TokenStream): unknown;
|
|
17
|
-
export declare function parseColon(parser: HyperscriptParser, tokens: TokenStream): void;
|
|
18
|
-
export declare function parseComma(tokens: TokenStream): boolean;
|
|
19
|
-
export declare function parseOptionalAnd(tokens: TokenStream): boolean;
|
|
20
|
-
export declare function createBaseCommand(url: unknown): BaseCommand;
|
|
21
|
-
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from '../types/core';
|
|
2
|
-
export declare function evaluateSelector(node: {
|
|
3
|
-
value: string;
|
|
4
|
-
}, context: ExecutionContext): HTMLElement[];
|
|
5
|
-
export declare function evaluateCSSSelector(node: {
|
|
6
|
-
selectorType: string;
|
|
7
|
-
selector: string;
|
|
8
|
-
}, context: ExecutionContext): HTMLElement | HTMLElement[] | null;
|
|
9
|
-
export declare function evaluateIdSelector(node: {
|
|
10
|
-
value: string;
|
|
11
|
-
}, context: ExecutionContext): Element | null;
|
|
12
|
-
export declare function evaluateQueryReference(node: {
|
|
13
|
-
selector: string;
|
|
14
|
-
}, context: ExecutionContext): NodeList;
|
|
15
|
-
//# sourceMappingURL=selector-evaluator.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from '../types/core';
|
|
2
|
-
export declare function resolveValue(name: string, context: ExecutionContext): Promise<any>;
|
|
3
|
-
export declare function evaluateSimpleExpression(exprCode: string, context: ExecutionContext): Promise<any>;
|
|
4
|
-
export declare function evaluateTemplateLiteral(node: any, context: ExecutionContext): Promise<string>;
|
|
5
|
-
//# sourceMappingURL=template-literal-evaluator.d.ts.map
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ValidationResult, TypedExecutionContext as TypedExpressionContext, EvaluationType, ExpressionMetadata, TypedResult, ExpressionCategory } from '../../types/index';
|
|
2
|
-
interface BaseTypedExpression<T> {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly category: string;
|
|
5
|
-
readonly syntax: string;
|
|
6
|
-
readonly outputType: EvaluationType;
|
|
7
|
-
readonly metadata: ExpressionMetadata;
|
|
8
|
-
evaluate(context: TypedExpressionContext, input: unknown): Promise<TypedResult<T>>;
|
|
9
|
-
validate(input: unknown): ValidationResult;
|
|
10
|
-
}
|
|
11
|
-
export declare class GreaterThanExpression implements BaseTypedExpression<boolean> {
|
|
12
|
-
readonly name = "greaterThan";
|
|
13
|
-
readonly category: ExpressionCategory;
|
|
14
|
-
readonly syntax = "left > right";
|
|
15
|
-
readonly outputType: EvaluationType;
|
|
16
|
-
readonly metadata: ExpressionMetadata;
|
|
17
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
18
|
-
validate(input: unknown): ValidationResult;
|
|
19
|
-
}
|
|
20
|
-
export declare class LessThanExpression implements BaseTypedExpression<boolean> {
|
|
21
|
-
readonly name = "lessThan";
|
|
22
|
-
readonly category: ExpressionCategory;
|
|
23
|
-
readonly syntax = "left < right";
|
|
24
|
-
readonly outputType: EvaluationType;
|
|
25
|
-
readonly metadata: ExpressionMetadata;
|
|
26
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
27
|
-
validate(input: unknown): ValidationResult;
|
|
28
|
-
}
|
|
29
|
-
export declare class GreaterThanOrEqualExpression implements BaseTypedExpression<boolean> {
|
|
30
|
-
readonly name = "greaterThanOrEqual";
|
|
31
|
-
readonly category: ExpressionCategory;
|
|
32
|
-
readonly syntax = "left >= right";
|
|
33
|
-
readonly outputType: EvaluationType;
|
|
34
|
-
readonly metadata: ExpressionMetadata;
|
|
35
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
36
|
-
validate(input: unknown): ValidationResult;
|
|
37
|
-
}
|
|
38
|
-
export declare class LessThanOrEqualExpression implements BaseTypedExpression<boolean> {
|
|
39
|
-
readonly name = "lessThanOrEqual";
|
|
40
|
-
readonly category: ExpressionCategory;
|
|
41
|
-
readonly syntax = "left <= right";
|
|
42
|
-
readonly outputType: EvaluationType;
|
|
43
|
-
readonly metadata: ExpressionMetadata;
|
|
44
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
45
|
-
validate(input: unknown): ValidationResult;
|
|
46
|
-
}
|
|
47
|
-
export declare class EqualityExpression implements BaseTypedExpression<boolean> {
|
|
48
|
-
readonly name = "equals";
|
|
49
|
-
readonly category: ExpressionCategory;
|
|
50
|
-
readonly syntax = "left == right";
|
|
51
|
-
readonly outputType: EvaluationType;
|
|
52
|
-
readonly metadata: ExpressionMetadata;
|
|
53
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
54
|
-
validate(input: unknown): ValidationResult;
|
|
55
|
-
}
|
|
56
|
-
export declare class InequalityExpression implements BaseTypedExpression<boolean> {
|
|
57
|
-
readonly name = "notEquals";
|
|
58
|
-
readonly category: ExpressionCategory;
|
|
59
|
-
readonly syntax = "left != right";
|
|
60
|
-
readonly outputType: EvaluationType;
|
|
61
|
-
readonly metadata: ExpressionMetadata;
|
|
62
|
-
evaluate(_context: TypedExpressionContext, input: unknown): Promise<TypedResult<boolean>>;
|
|
63
|
-
validate(input: unknown): ValidationResult;
|
|
64
|
-
}
|
|
65
|
-
export declare function createGreaterThanExpression(): GreaterThanExpression;
|
|
66
|
-
export declare function createLessThanExpression(): LessThanExpression;
|
|
67
|
-
export declare function createGreaterThanOrEqualExpression(): GreaterThanOrEqualExpression;
|
|
68
|
-
export declare function createLessThanOrEqualExpression(): LessThanOrEqualExpression;
|
|
69
|
-
export declare function createEqualityExpression(): EqualityExpression;
|
|
70
|
-
export declare function createInequalityExpression(): InequalityExpression;
|
|
71
|
-
export declare const comparisonExpressions: {
|
|
72
|
-
readonly greaterThan: GreaterThanExpression;
|
|
73
|
-
readonly lessThan: LessThanExpression;
|
|
74
|
-
readonly greaterThanOrEqual: GreaterThanOrEqualExpression;
|
|
75
|
-
readonly lessThanOrEqual: LessThanOrEqualExpression;
|
|
76
|
-
readonly equals: EqualityExpression;
|
|
77
|
-
readonly notEquals: InequalityExpression;
|
|
78
|
-
};
|
|
79
|
-
export {};
|
|
80
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext, TypedExpressionContext, ExpressionEvaluationOptions } from '../../../types/base-types';
|
|
2
|
-
export declare function createTypedExpressionContext(context: ExecutionContext, options?: ExpressionEvaluationOptions): TypedExpressionContext;
|
|
3
|
-
export declare function updateExecutionContext(originalContext: ExecutionContext, typedContext: TypedExpressionContext): ExecutionContext;
|
|
4
|
-
export declare class ConversionAdapter {
|
|
5
|
-
static evaluateAs(context: ExecutionContext, value: unknown, type: string): Promise<unknown>;
|
|
6
|
-
static evaluateIs(context: ExecutionContext, value: unknown, type: string): Promise<boolean>;
|
|
7
|
-
static getExpressionMetadata(expressionName: string): import("../../../types/base-types").ExpressionMetadata;
|
|
8
|
-
static getExpressionDocumentation(expressionName: string): import("../../../types/base-types").LLMDocumentation;
|
|
9
|
-
static validateExpressionInput(expressionName: string, input: unknown): import("../../../types/base-types").ValidationResult<unknown>;
|
|
10
|
-
}
|
|
11
|
-
export declare const EnhancedConversionAdapter: typeof ConversionAdapter;
|
|
12
|
-
export declare class LegacyCompatibilityLayer {
|
|
13
|
-
static asExpression: {
|
|
14
|
-
name: string;
|
|
15
|
-
category: "Conversion";
|
|
16
|
-
evaluatesTo: "Any";
|
|
17
|
-
evaluate(context: ExecutionContext, value: unknown, type: string): Promise<unknown>;
|
|
18
|
-
validate(args: unknown[]): string | null;
|
|
19
|
-
};
|
|
20
|
-
static isExpression: {
|
|
21
|
-
name: string;
|
|
22
|
-
category: "Conversion";
|
|
23
|
-
evaluatesTo: "Boolean";
|
|
24
|
-
evaluate(context: ExecutionContext, value: unknown, type: string): Promise<boolean>;
|
|
25
|
-
validate(args: unknown[]): string | null;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export declare class ExpressionMigrationUtility {
|
|
29
|
-
private static migrationMap;
|
|
30
|
-
static enableEnhanced(expressionName: string): void;
|
|
31
|
-
static disableEnhanced(expressionName: string): void;
|
|
32
|
-
static isEnhancedEnabled(expressionName: string): boolean;
|
|
33
|
-
static getMigrationStatus(): {
|
|
34
|
-
[k: string]: boolean;
|
|
35
|
-
};
|
|
36
|
-
static enableAllEnhanced(): void;
|
|
37
|
-
static disableAllEnhanced(): void;
|
|
38
|
-
}
|
|
39
|
-
export declare class ConversionUtilities {
|
|
40
|
-
static safeConvert(context: ExecutionContext, value: unknown, type: string, fallback?: unknown): Promise<{
|
|
41
|
-
success: boolean;
|
|
42
|
-
value: unknown;
|
|
43
|
-
error?: unknown;
|
|
44
|
-
}>;
|
|
45
|
-
static batchConvert(context: ExecutionContext, conversions: Array<{
|
|
46
|
-
value: unknown;
|
|
47
|
-
type: string;
|
|
48
|
-
key?: string;
|
|
49
|
-
}>): Promise<{
|
|
50
|
-
success: boolean;
|
|
51
|
-
results: Record<string, unknown>;
|
|
52
|
-
errors: Array<unknown>;
|
|
53
|
-
}>;
|
|
54
|
-
static getAvailableConversions(): {
|
|
55
|
-
String: {
|
|
56
|
-
description: string;
|
|
57
|
-
complexity: string;
|
|
58
|
-
};
|
|
59
|
-
Number: {
|
|
60
|
-
description: string;
|
|
61
|
-
complexity: string;
|
|
62
|
-
};
|
|
63
|
-
Int: {
|
|
64
|
-
description: string;
|
|
65
|
-
complexity: string;
|
|
66
|
-
};
|
|
67
|
-
Float: {
|
|
68
|
-
description: string;
|
|
69
|
-
complexity: string;
|
|
70
|
-
};
|
|
71
|
-
Boolean: {
|
|
72
|
-
description: string;
|
|
73
|
-
complexity: string;
|
|
74
|
-
};
|
|
75
|
-
Array: {
|
|
76
|
-
description: string;
|
|
77
|
-
complexity: string;
|
|
78
|
-
};
|
|
79
|
-
Object: {
|
|
80
|
-
description: string;
|
|
81
|
-
complexity: string;
|
|
82
|
-
};
|
|
83
|
-
Date: {
|
|
84
|
-
description: string;
|
|
85
|
-
complexity: string;
|
|
86
|
-
};
|
|
87
|
-
JSON: {
|
|
88
|
-
description: string;
|
|
89
|
-
complexity: string;
|
|
90
|
-
};
|
|
91
|
-
Values: {
|
|
92
|
-
description: string;
|
|
93
|
-
complexity: string;
|
|
94
|
-
};
|
|
95
|
-
'Values:Form': {
|
|
96
|
-
description: string;
|
|
97
|
-
complexity: string;
|
|
98
|
-
};
|
|
99
|
-
'Values:JSON': {
|
|
100
|
-
description: string;
|
|
101
|
-
complexity: string;
|
|
102
|
-
};
|
|
103
|
-
HTML: {
|
|
104
|
-
description: string;
|
|
105
|
-
complexity: string;
|
|
106
|
-
};
|
|
107
|
-
Fragment: {
|
|
108
|
-
description: string;
|
|
109
|
-
complexity: string;
|
|
110
|
-
};
|
|
111
|
-
'Fixed:N': {
|
|
112
|
-
description: string;
|
|
113
|
-
complexity: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { TypedExpressionContext, ExpressionCategory, EvaluationType, ExpressionMetadata, ValidationResult } from '../../../types/expression-types';
|
|
2
|
-
import type { EvaluationResult } from '../../../types/command-types';
|
|
3
|
-
import { BaseExpressionImpl } from '../../base-expression';
|
|
4
|
-
type PatternMatchInput = any;
|
|
5
|
-
type ContainsInput = any;
|
|
6
|
-
type InInput = any;
|
|
7
|
-
export declare class MatchesExpression extends BaseExpressionImpl<PatternMatchInput, boolean> {
|
|
8
|
-
readonly name = "matches";
|
|
9
|
-
readonly category: ExpressionCategory;
|
|
10
|
-
readonly syntax = "value matches pattern";
|
|
11
|
-
readonly description = "Pattern matching with CSS selectors and regular expressions";
|
|
12
|
-
readonly inputSchema: import("../../../validation/lightweight-validators").RuntimeValidator<{
|
|
13
|
-
[x: string]: unknown;
|
|
14
|
-
}>;
|
|
15
|
-
readonly outputType: EvaluationType;
|
|
16
|
-
readonly metadata: ExpressionMetadata;
|
|
17
|
-
evaluate(context: TypedExpressionContext, input: PatternMatchInput): Promise<EvaluationResult<boolean>>;
|
|
18
|
-
validate(input: unknown): ValidationResult;
|
|
19
|
-
private matchCSSSelector;
|
|
20
|
-
private isCSSSelector;
|
|
21
|
-
private isValidCSSSelector;
|
|
22
|
-
}
|
|
23
|
-
export declare class ContainsExpression extends BaseExpressionImpl<ContainsInput, boolean> {
|
|
24
|
-
readonly name = "contains";
|
|
25
|
-
readonly category: ExpressionCategory;
|
|
26
|
-
readonly syntax = "container contains item";
|
|
27
|
-
readonly description = "Tests if a container (array, string, object) contains an item";
|
|
28
|
-
readonly inputSchema: import("../../../validation/lightweight-validators").RuntimeValidator<{
|
|
29
|
-
[x: string]: unknown;
|
|
30
|
-
}>;
|
|
31
|
-
readonly outputType: EvaluationType;
|
|
32
|
-
readonly metadata: ExpressionMetadata;
|
|
33
|
-
evaluate(context: TypedExpressionContext, input: ContainsInput): Promise<EvaluationResult<boolean>>;
|
|
34
|
-
validate(input: unknown): ValidationResult;
|
|
35
|
-
}
|
|
36
|
-
export declare class InExpression extends BaseExpressionImpl<InInput, boolean> {
|
|
37
|
-
readonly name = "in";
|
|
38
|
-
readonly category: ExpressionCategory;
|
|
39
|
-
readonly syntax = "item in container";
|
|
40
|
-
readonly description = "Tests if an item is in a container (reverse of contains)";
|
|
41
|
-
readonly inputSchema: import("../../../validation/lightweight-validators").RuntimeValidator<{
|
|
42
|
-
[x: string]: unknown;
|
|
43
|
-
}>;
|
|
44
|
-
readonly outputType: EvaluationType;
|
|
45
|
-
readonly metadata: ExpressionMetadata;
|
|
46
|
-
evaluate(context: TypedExpressionContext, input: InInput): Promise<EvaluationResult<boolean>>;
|
|
47
|
-
validate(input: unknown): ValidationResult;
|
|
48
|
-
}
|
|
49
|
-
export declare function createMatchesExpression(): MatchesExpression;
|
|
50
|
-
export declare function createContainsExpression(): ContainsExpression;
|
|
51
|
-
export declare function createInExpression(): InExpression;
|
|
52
|
-
export declare const enhancedPatternMatchingExpressions: {
|
|
53
|
-
readonly matches: MatchesExpression;
|
|
54
|
-
readonly contains: ContainsExpression;
|
|
55
|
-
readonly in: InExpression;
|
|
56
|
-
};
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=pattern-matching.d.ts.map
|