eny-ai 1.0.0 → 2.0.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/V2_README.md +414 -0
- package/dist/chunk-2NUS77CI.js +195 -0
- package/dist/chunk-5KPALVCK.js +280 -0
- package/dist/{chunk-2WFUL4XJ.js → chunk-5PZUUNHS.js} +717 -751
- package/dist/{chunk-E4KJZEXX.js → chunk-AJH2I5ZI.js} +5 -0
- package/dist/chunk-LVJ3GJRQ.js +360 -0
- package/dist/{chunk-PNKVD2UK.js → chunk-MXA7TAAG.js} +11 -1
- package/dist/cli.js +5 -4
- package/dist/firebase.cjs +296 -0
- package/dist/firebase.d.cts +136 -0
- package/dist/firebase.d.ts +136 -0
- package/dist/firebase.js +17 -0
- package/dist/hooks.cjs +236 -0
- package/dist/hooks.d.cts +184 -0
- package/dist/hooks.d.ts +184 -0
- package/dist/hooks.js +31 -0
- package/dist/index.cjs +1622 -1092
- package/dist/index.d.cts +16 -195
- package/dist/index.d.ts +16 -195
- package/dist/index.js +68 -262
- package/dist/runtime.cjs +366 -0
- package/dist/runtime.d.cts +229 -0
- package/dist/runtime.d.ts +229 -0
- package/dist/runtime.js +25 -0
- package/dist/symbols.js +2 -2
- package/examples/app-simbolico-completo.tsx +249 -0
- package/examples/nextjs-integration.tsx +446 -0
- package/examples/v2-demo.tsx +377 -0
- package/package.json +23 -11
- package/dist/react/index.cjs +0 -342
- package/dist/react/index.d.cts +0 -751
- package/dist/react/index.d.ts +0 -751
- package/dist/react/index.js +0 -284
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/runtime.ts
|
|
21
|
+
var runtime_exports = {};
|
|
22
|
+
__export(runtime_exports, {
|
|
23
|
+
ENYRuntime: () => ENYRuntime,
|
|
24
|
+
eny: () => eny,
|
|
25
|
+
filterArray: () => filterArray,
|
|
26
|
+
func: () => func,
|
|
27
|
+
lambda: () => lambda,
|
|
28
|
+
mapArray: () => mapArray,
|
|
29
|
+
reduceArray: () => reduceArray,
|
|
30
|
+
state: () => state,
|
|
31
|
+
substate: () => substate
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(runtime_exports);
|
|
34
|
+
var ENYRuntime = class {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.context = {};
|
|
37
|
+
this.hooks = /* @__PURE__ */ new Map();
|
|
38
|
+
this.effects = [];
|
|
39
|
+
// ════════════════════════════════════════════════════════════════
|
|
40
|
+
// SÍMBOLOS HTTP/ASYNC
|
|
41
|
+
// ════════════════════════════════════════════════════════════════
|
|
42
|
+
/**
|
|
43
|
+
* http - HTTP methods
|
|
44
|
+
* http.GET(url), http.POST(url, data), etc
|
|
45
|
+
* Alias: ⇄
|
|
46
|
+
*/
|
|
47
|
+
this.http = {
|
|
48
|
+
GET: async (url) => {
|
|
49
|
+
const res = await fetch(url);
|
|
50
|
+
return res.json();
|
|
51
|
+
},
|
|
52
|
+
POST: async (url, data) => {
|
|
53
|
+
const res = await fetch(url, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: { "Content-Type": "application/json" },
|
|
56
|
+
body: JSON.stringify(data)
|
|
57
|
+
});
|
|
58
|
+
return res.json();
|
|
59
|
+
},
|
|
60
|
+
PUT: async (url, data) => {
|
|
61
|
+
const res = await fetch(url, {
|
|
62
|
+
method: "PUT",
|
|
63
|
+
headers: { "Content-Type": "application/json" },
|
|
64
|
+
body: JSON.stringify(data)
|
|
65
|
+
});
|
|
66
|
+
return res.json();
|
|
67
|
+
},
|
|
68
|
+
DELETE: async (url) => {
|
|
69
|
+
const res = await fetch(url, { method: "DELETE" });
|
|
70
|
+
return res.json();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// ════════════════════════════════════════════════════════════════
|
|
74
|
+
// SÍMBOLOS MEMÓRIA/STORAGE
|
|
75
|
+
// ════════════════════════════════════════════════════════════════
|
|
76
|
+
/**
|
|
77
|
+
* storage - Memory/Storage access
|
|
78
|
+
* storage.get(key), storage.set(key, value)
|
|
79
|
+
* Alias: 𝓜
|
|
80
|
+
*/
|
|
81
|
+
this.storage = {
|
|
82
|
+
get: (key) => localStorage.getItem(key),
|
|
83
|
+
set: (key, value) => localStorage.setItem(key, JSON.stringify(value)),
|
|
84
|
+
remove: (key) => localStorage.removeItem(key),
|
|
85
|
+
clear: () => localStorage.clear(),
|
|
86
|
+
session: {
|
|
87
|
+
get: (key) => sessionStorage.getItem(key),
|
|
88
|
+
set: (key, value) => sessionStorage.setItem(key, JSON.stringify(value))
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// ════════════════════════════════════════════════════════════════
|
|
92
|
+
// SÍMBOLOS SEGURANÇA
|
|
93
|
+
// ════════════════════════════════════════════════════════════════
|
|
94
|
+
/**
|
|
95
|
+
* validate - Validation helpers
|
|
96
|
+
* validate.email(str), validate.min(len)
|
|
97
|
+
* Alias: 🛡
|
|
98
|
+
*/
|
|
99
|
+
this.validate = {
|
|
100
|
+
email: (str) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str),
|
|
101
|
+
min: (len) => (str) => str.length >= len,
|
|
102
|
+
max: (len) => (str) => str.length <= len,
|
|
103
|
+
regex: (pattern) => (str) => pattern.test(str),
|
|
104
|
+
required: (val) => val != null && val !== "",
|
|
105
|
+
equals: (expected) => (actual) => actual === expected
|
|
106
|
+
};
|
|
107
|
+
this.crypto = {
|
|
108
|
+
lock: (obj) => Object.freeze(obj),
|
|
109
|
+
unlock: (obj) => Object.assign({}, obj)
|
|
110
|
+
};
|
|
111
|
+
// ════════════════════════════════════════════════════════════════
|
|
112
|
+
// SÍMBOLOS NAVEGAÇÃO
|
|
113
|
+
// ════════════════════════════════════════════════════════════════
|
|
114
|
+
/**
|
|
115
|
+
* router - Router/Navigation
|
|
116
|
+
* router.navigate(path), router.back()
|
|
117
|
+
* Alias: 🧭
|
|
118
|
+
*/
|
|
119
|
+
this.router = {
|
|
120
|
+
navigate: (path) => window.location.href = path,
|
|
121
|
+
back: () => window.history.back(),
|
|
122
|
+
forward: () => window.history.forward(),
|
|
123
|
+
reload: () => window.location.reload(),
|
|
124
|
+
params: () => new URLSearchParams(window.location.search)
|
|
125
|
+
};
|
|
126
|
+
// ════════════════════════════════════════════════════════════════
|
|
127
|
+
// SISTEMA DE LOGS
|
|
128
|
+
// ════════════════════════════════════════════════════════════════
|
|
129
|
+
/**
|
|
130
|
+
* logger - Logging system
|
|
131
|
+
* logger.info(msg), logger.error(msg), logger.warn(msg)
|
|
132
|
+
* Alias: 📜
|
|
133
|
+
*/
|
|
134
|
+
this.logger = {
|
|
135
|
+
info: (msg, data) => console.log(`\u2139\uFE0F ${msg}`, data),
|
|
136
|
+
error: (msg, data) => console.error(`\u274C ${msg}`, data),
|
|
137
|
+
warn: (msg, data) => console.warn(`\u26A0\uFE0F ${msg}`, data),
|
|
138
|
+
log: (msg, data) => console.log(`\u{1F4DC} ${msg}`, data)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// ════════════════════════════════════════════════════════════════
|
|
142
|
+
// SÍMBOLOS BÁSICOS - ESTADO
|
|
143
|
+
// ════════════════════════════════════════════════════════════════
|
|
144
|
+
/**
|
|
145
|
+
* Σ - Cria estado global
|
|
146
|
+
* Σ('user', { name: 'João' })
|
|
147
|
+
*/
|
|
148
|
+
\u03A3(key, initialValue) {
|
|
149
|
+
if (!this.context[key]) {
|
|
150
|
+
this.context[key] = initialValue;
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
get: () => this.context[key],
|
|
154
|
+
set: (value) => {
|
|
155
|
+
this.context[key] = value;
|
|
156
|
+
this.notify();
|
|
157
|
+
},
|
|
158
|
+
value: this.context[key]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* σ - Sub-estado (local)
|
|
163
|
+
* σ(parent, 'field')
|
|
164
|
+
*/
|
|
165
|
+
\u03C3(parent, field) {
|
|
166
|
+
return {
|
|
167
|
+
get: () => parent[field],
|
|
168
|
+
set: (value) => {
|
|
169
|
+
parent[field] = value;
|
|
170
|
+
},
|
|
171
|
+
value: parent[field]
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* ⊤ e ⊥ - Booleanos
|
|
176
|
+
*/
|
|
177
|
+
get TRUE() {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
get FALSE() {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
// Aliases simbólicos para compatibilidade
|
|
184
|
+
get trueValue() {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
get falseValue() {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Ø - Nulo/Vazio
|
|
192
|
+
*/
|
|
193
|
+
get \u00D8() {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
// ════════════════════════════════════════════════════════════════
|
|
197
|
+
// SÍMBOLOS FUNCIONAIS - FUNÇÕES
|
|
198
|
+
// ════════════════════════════════════════════════════════════════
|
|
199
|
+
/**
|
|
200
|
+
* func - Define função normal
|
|
201
|
+
* func('myFunc', (a, b) => a + b)
|
|
202
|
+
*/
|
|
203
|
+
func(name, fn) {
|
|
204
|
+
const wrapped = fn;
|
|
205
|
+
this.context[name] = wrapped;
|
|
206
|
+
return wrapped;
|
|
207
|
+
}
|
|
208
|
+
// Alias: ƒ
|
|
209
|
+
get \u0192() {
|
|
210
|
+
return this.func.bind(this);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* lambda - Arrow function/Lambda
|
|
214
|
+
* lambda(fn) - wraps e memoiza
|
|
215
|
+
*/
|
|
216
|
+
lambda(fn) {
|
|
217
|
+
return fn;
|
|
218
|
+
}
|
|
219
|
+
// Alias: λ
|
|
220
|
+
get \u03BB() {
|
|
221
|
+
return this.lambda.bind(this);
|
|
222
|
+
}
|
|
223
|
+
// ════════════════════════════════════════════════════════════════
|
|
224
|
+
// SÍMBOLOS DE ARRAY - ITERAÇÃO
|
|
225
|
+
// ════════════════════════════════════════════════════════════════
|
|
226
|
+
/**
|
|
227
|
+
* map - Map operator
|
|
228
|
+
* arr.map((item) => item * 2)
|
|
229
|
+
* Alias: ↦
|
|
230
|
+
*/
|
|
231
|
+
map(arr, fn) {
|
|
232
|
+
return arr.map((item) => fn(item));
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* filter - Filter operator
|
|
236
|
+
* arr.filter((item) => item > 5)
|
|
237
|
+
* Alias: ⊳
|
|
238
|
+
*/
|
|
239
|
+
filter(arr, predicate) {
|
|
240
|
+
return arr.filter((item) => predicate(item));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* reduce - Reduce operator
|
|
244
|
+
* arr.reduce((acc, item) => acc + item, 0)
|
|
245
|
+
* Alias: ⊲
|
|
246
|
+
*/
|
|
247
|
+
reduce(arr, reducer, initial = 0) {
|
|
248
|
+
return arr.reduce((acc, item) => reducer(acc, item), initial);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* find - Find operator
|
|
252
|
+
* arr.find((item) => item.id === 5)
|
|
253
|
+
* Alias: ⊙
|
|
254
|
+
*/
|
|
255
|
+
find(arr, predicate) {
|
|
256
|
+
return arr.find((item) => predicate(item));
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* every - Every operator
|
|
260
|
+
* arr.every((item) => item > 0)
|
|
261
|
+
* Alias: ∀
|
|
262
|
+
*/
|
|
263
|
+
every(arr, predicate) {
|
|
264
|
+
return arr.every((item) => predicate(item));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* some - Some operator
|
|
268
|
+
* arr.some((item) => item > 0)
|
|
269
|
+
* Alias: ∃
|
|
270
|
+
*/
|
|
271
|
+
some(arr, predicate) {
|
|
272
|
+
return arr.some((item) => predicate(item));
|
|
273
|
+
}
|
|
274
|
+
// ════════════════════════════════════════════════════════════════
|
|
275
|
+
// SÍMBOLOS OPERADORES
|
|
276
|
+
// ════════════════════════════════════════════════════════════════
|
|
277
|
+
/**
|
|
278
|
+
* assign - Assignment operator
|
|
279
|
+
* Alias: ←
|
|
280
|
+
*/
|
|
281
|
+
assign(target, value) {
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* and - AND operator
|
|
286
|
+
* Alias: ∧
|
|
287
|
+
*/
|
|
288
|
+
and(a, b) {
|
|
289
|
+
return a && b;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* or - OR operator
|
|
293
|
+
* Alias: ∨
|
|
294
|
+
*/
|
|
295
|
+
or(a, b) {
|
|
296
|
+
return a || b;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* not - NOT operator
|
|
300
|
+
* Alias: ¬
|
|
301
|
+
*/
|
|
302
|
+
not(a) {
|
|
303
|
+
return !a;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* merge - Merge/Spread operator
|
|
307
|
+
* Alias: ⊕
|
|
308
|
+
*/
|
|
309
|
+
merge(...objs) {
|
|
310
|
+
return Object.assign({}, ...objs);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* encode - Basic encoding/decoding
|
|
314
|
+
* Alias: 🔑 🔒 🔓
|
|
315
|
+
*/
|
|
316
|
+
encode(data) {
|
|
317
|
+
return btoa(data);
|
|
318
|
+
}
|
|
319
|
+
// ════════════════════════════════════════════════════════════════
|
|
320
|
+
// INTERNALS
|
|
321
|
+
// ════════════════════════════════════════════════════════════════
|
|
322
|
+
notify() {
|
|
323
|
+
this.effects.forEach((effect) => effect());
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* effect - Register effect function
|
|
327
|
+
* Alias: ⚡
|
|
328
|
+
*/
|
|
329
|
+
effect(fn, deps = []) {
|
|
330
|
+
this.effects.push(() => fn());
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Obter todo contexto
|
|
334
|
+
*/
|
|
335
|
+
getContext() {
|
|
336
|
+
return { ...this.context };
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Limpar runtime
|
|
340
|
+
*/
|
|
341
|
+
clear() {
|
|
342
|
+
this.context = {};
|
|
343
|
+
this.hooks.clear();
|
|
344
|
+
this.effects = [];
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var eny = new ENYRuntime();
|
|
348
|
+
var state = eny.\u03A3.bind(eny);
|
|
349
|
+
var substate = eny.\u03C3.bind(eny);
|
|
350
|
+
var func = eny.func.bind(eny);
|
|
351
|
+
var lambda = eny.lambda.bind(eny);
|
|
352
|
+
var mapArray = eny.map.bind(eny);
|
|
353
|
+
var filterArray = eny.filter.bind(eny);
|
|
354
|
+
var reduceArray = eny.reduce.bind(eny);
|
|
355
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
356
|
+
0 && (module.exports = {
|
|
357
|
+
ENYRuntime,
|
|
358
|
+
eny,
|
|
359
|
+
filterArray,
|
|
360
|
+
func,
|
|
361
|
+
lambda,
|
|
362
|
+
mapArray,
|
|
363
|
+
reduceArray,
|
|
364
|
+
state,
|
|
365
|
+
substate
|
|
366
|
+
});
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🧠 ENY-AI RUNTIME v2.0
|
|
3
|
+
* Interprete simbólico universal
|
|
4
|
+
* Executa 90% código simbólico SEM build
|
|
5
|
+
*/
|
|
6
|
+
interface SymbolContext {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
declare class ENYRuntime {
|
|
10
|
+
private context;
|
|
11
|
+
private hooks;
|
|
12
|
+
private effects;
|
|
13
|
+
/**
|
|
14
|
+
* Σ - Cria estado global
|
|
15
|
+
* Σ('user', { name: 'João' })
|
|
16
|
+
*/
|
|
17
|
+
Σ(key: string, initialValue: any): {
|
|
18
|
+
get: () => any;
|
|
19
|
+
set: (value: any) => void;
|
|
20
|
+
value: any;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* σ - Sub-estado (local)
|
|
24
|
+
* σ(parent, 'field')
|
|
25
|
+
*/
|
|
26
|
+
σ(parent: any, field: string): {
|
|
27
|
+
get: () => any;
|
|
28
|
+
set: (value: any) => void;
|
|
29
|
+
value: any;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* ⊤ e ⊥ - Booleanos
|
|
33
|
+
*/
|
|
34
|
+
get TRUE(): boolean;
|
|
35
|
+
get FALSE(): boolean;
|
|
36
|
+
get trueValue(): boolean;
|
|
37
|
+
get falseValue(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Ø - Nulo/Vazio
|
|
40
|
+
*/
|
|
41
|
+
get Ø(): null;
|
|
42
|
+
/**
|
|
43
|
+
* func - Define função normal
|
|
44
|
+
* func('myFunc', (a, b) => a + b)
|
|
45
|
+
*/
|
|
46
|
+
func(name: string, fn: Function): Function;
|
|
47
|
+
get ƒ(): (name: string, fn: Function) => Function;
|
|
48
|
+
/**
|
|
49
|
+
* lambda - Arrow function/Lambda
|
|
50
|
+
* lambda(fn) - wraps e memoiza
|
|
51
|
+
*/
|
|
52
|
+
lambda(fn: Function): Function;
|
|
53
|
+
get λ(): (fn: Function) => Function;
|
|
54
|
+
/**
|
|
55
|
+
* map - Map operator
|
|
56
|
+
* arr.map((item) => item * 2)
|
|
57
|
+
* Alias: ↦
|
|
58
|
+
*/
|
|
59
|
+
map(arr: any[], fn: Function): any[];
|
|
60
|
+
/**
|
|
61
|
+
* filter - Filter operator
|
|
62
|
+
* arr.filter((item) => item > 5)
|
|
63
|
+
* Alias: ⊳
|
|
64
|
+
*/
|
|
65
|
+
filter(arr: any[], predicate: Function): any[];
|
|
66
|
+
/**
|
|
67
|
+
* reduce - Reduce operator
|
|
68
|
+
* arr.reduce((acc, item) => acc + item, 0)
|
|
69
|
+
* Alias: ⊲
|
|
70
|
+
*/
|
|
71
|
+
reduce(arr: any[], reducer: Function, initial?: any): any;
|
|
72
|
+
/**
|
|
73
|
+
* find - Find operator
|
|
74
|
+
* arr.find((item) => item.id === 5)
|
|
75
|
+
* Alias: ⊙
|
|
76
|
+
*/
|
|
77
|
+
find(arr: any[], predicate: Function): any;
|
|
78
|
+
/**
|
|
79
|
+
* every - Every operator
|
|
80
|
+
* arr.every((item) => item > 0)
|
|
81
|
+
* Alias: ∀
|
|
82
|
+
*/
|
|
83
|
+
every(arr: any[], predicate: Function): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* some - Some operator
|
|
86
|
+
* arr.some((item) => item > 0)
|
|
87
|
+
* Alias: ∃
|
|
88
|
+
*/
|
|
89
|
+
some(arr: any[], predicate: Function): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* assign - Assignment operator
|
|
92
|
+
* Alias: ←
|
|
93
|
+
*/
|
|
94
|
+
assign(target: any, value: any): any;
|
|
95
|
+
/**
|
|
96
|
+
* and - AND operator
|
|
97
|
+
* Alias: ∧
|
|
98
|
+
*/
|
|
99
|
+
and(a: any, b: any): any;
|
|
100
|
+
/**
|
|
101
|
+
* or - OR operator
|
|
102
|
+
* Alias: ∨
|
|
103
|
+
*/
|
|
104
|
+
or(a: any, b: any): any;
|
|
105
|
+
/**
|
|
106
|
+
* not - NOT operator
|
|
107
|
+
* Alias: ¬
|
|
108
|
+
*/
|
|
109
|
+
not(a: any): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* merge - Merge/Spread operator
|
|
112
|
+
* Alias: ⊕
|
|
113
|
+
*/
|
|
114
|
+
merge(...objs: any[]): any;
|
|
115
|
+
/**
|
|
116
|
+
* http - HTTP methods
|
|
117
|
+
* http.GET(url), http.POST(url, data), etc
|
|
118
|
+
* Alias: ⇄
|
|
119
|
+
*/
|
|
120
|
+
http: {
|
|
121
|
+
GET: (url: string) => Promise<any>;
|
|
122
|
+
POST: (url: string, data: any) => Promise<any>;
|
|
123
|
+
PUT: (url: string, data: any) => Promise<any>;
|
|
124
|
+
DELETE: (url: string) => Promise<any>;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* storage - Memory/Storage access
|
|
128
|
+
* storage.get(key), storage.set(key, value)
|
|
129
|
+
* Alias: 𝓜
|
|
130
|
+
*/
|
|
131
|
+
storage: {
|
|
132
|
+
get: (key: string) => string | null;
|
|
133
|
+
set: (key: string, value: any) => void;
|
|
134
|
+
remove: (key: string) => void;
|
|
135
|
+
clear: () => void;
|
|
136
|
+
session: {
|
|
137
|
+
get: (key: string) => string | null;
|
|
138
|
+
set: (key: string, value: any) => void;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* validate - Validation helpers
|
|
143
|
+
* validate.email(str), validate.min(len)
|
|
144
|
+
* Alias: 🛡
|
|
145
|
+
*/
|
|
146
|
+
validate: {
|
|
147
|
+
email: (str: string) => boolean;
|
|
148
|
+
min: (len: number) => (str: string) => boolean;
|
|
149
|
+
max: (len: number) => (str: string) => boolean;
|
|
150
|
+
regex: (pattern: RegExp) => (str: string) => boolean;
|
|
151
|
+
required: (val: any) => boolean;
|
|
152
|
+
equals: (expected: any) => (actual: any) => boolean;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* encode - Basic encoding/decoding
|
|
156
|
+
* Alias: 🔑 🔒 🔓
|
|
157
|
+
*/
|
|
158
|
+
encode(data: string): string;
|
|
159
|
+
crypto: {
|
|
160
|
+
lock: (obj: any) => any;
|
|
161
|
+
unlock: (obj: any) => any;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* router - Router/Navigation
|
|
165
|
+
* router.navigate(path), router.back()
|
|
166
|
+
* Alias: 🧭
|
|
167
|
+
*/
|
|
168
|
+
router: {
|
|
169
|
+
navigate: (path: string) => string;
|
|
170
|
+
back: () => void;
|
|
171
|
+
forward: () => void;
|
|
172
|
+
reload: () => void;
|
|
173
|
+
params: () => URLSearchParams;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* logger - Logging system
|
|
177
|
+
* logger.info(msg), logger.error(msg), logger.warn(msg)
|
|
178
|
+
* Alias: 📜
|
|
179
|
+
*/
|
|
180
|
+
logger: {
|
|
181
|
+
info: (msg: string, data?: any) => void;
|
|
182
|
+
error: (msg: string, data?: any) => void;
|
|
183
|
+
warn: (msg: string, data?: any) => void;
|
|
184
|
+
log: (msg: string, data?: any) => void;
|
|
185
|
+
};
|
|
186
|
+
private notify;
|
|
187
|
+
/**
|
|
188
|
+
* effect - Register effect function
|
|
189
|
+
* Alias: ⚡
|
|
190
|
+
*/
|
|
191
|
+
effect(fn: Function, deps?: any[]): void;
|
|
192
|
+
/**
|
|
193
|
+
* Obter todo contexto
|
|
194
|
+
*/
|
|
195
|
+
getContext(): {
|
|
196
|
+
[key: string]: any;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Limpar runtime
|
|
200
|
+
*/
|
|
201
|
+
clear(): void;
|
|
202
|
+
}
|
|
203
|
+
declare const eny: ENYRuntime;
|
|
204
|
+
/**
|
|
205
|
+
* Aliases para uso direto com nomes válidos ASCII
|
|
206
|
+
* Para símbolos emoji, use: eny.method() ou destructure
|
|
207
|
+
*
|
|
208
|
+
* Exemplos:
|
|
209
|
+
* const sum = eny.Σ.bind(eny) // State creation
|
|
210
|
+
* const mapFn = eny.map.bind(eny) // Array mapping (alias: ↦)
|
|
211
|
+
* const filterFn = eny.filter.bind(eny) // Array filtering (alias: ⊳)
|
|
212
|
+
*/
|
|
213
|
+
declare const state: (key: string, initialValue: any) => {
|
|
214
|
+
get: () => any;
|
|
215
|
+
set: (value: any) => void;
|
|
216
|
+
value: any;
|
|
217
|
+
};
|
|
218
|
+
declare const substate: (parent: any, field: string) => {
|
|
219
|
+
get: () => any;
|
|
220
|
+
set: (value: any) => void;
|
|
221
|
+
value: any;
|
|
222
|
+
};
|
|
223
|
+
declare const func: (name: string, fn: Function) => Function;
|
|
224
|
+
declare const lambda: (fn: Function) => Function;
|
|
225
|
+
declare const mapArray: (arr: any[], fn: Function) => any[];
|
|
226
|
+
declare const filterArray: (arr: any[], predicate: Function) => any[];
|
|
227
|
+
declare const reduceArray: (arr: any[], reducer: Function, initial?: any) => any;
|
|
228
|
+
|
|
229
|
+
export { ENYRuntime, type SymbolContext, eny, filterArray, func, lambda, mapArray, reduceArray, state, substate };
|