tina4-nodejs 3.13.91 → 3.13.94
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/CLAUDE.md +16 -3
- package/README.md +1 -1
- package/package.json +12 -9
- package/packages/cli/dist/bin.js +1312 -987
- package/packages/core/dist/index.js +1312 -987
- package/packages/core/src/auth.ts +141 -21
- package/packages/core/src/devMailbox.ts +20 -44
- package/packages/core/src/index.ts +2 -2
- package/packages/core/src/messenger.ts +72 -0
- package/packages/core/src/queueBackends/kafkaBackend.ts +108 -12
- package/packages/core/src/sessionHandlers/childError.ts +72 -0
- package/packages/core/src/sessionHandlers/mongoClient.ts +9 -3
- package/packages/core/src/sessionHandlers/redisHandler.ts +18 -5
- package/packages/core/src/sessionHandlers/respClient.ts +5 -1
- package/packages/frond/dist/index.js +74 -31
- package/packages/frond/src/engine.ts +99 -33
- package/packages/orm/dist/index.js +3102 -2777
- package/packages/orm/src/adapters/sqlite.ts +4 -1
- package/packages/orm/src/database.ts +108 -8
- package/types/cli/src/bin.d.ts +92 -0
- package/types/cli/src/commands/build.d.ts +2 -0
- package/types/cli/src/commands/generate.d.ts +47 -0
- package/types/cli/src/commands/init.d.ts +1 -0
- package/types/cli/src/commands/metrics.d.ts +6 -0
- package/types/cli/src/commands/migrate.d.ts +1 -0
- package/types/cli/src/commands/migrateCreate.d.ts +1 -0
- package/types/cli/src/commands/migrateRollback.d.ts +1 -0
- package/types/cli/src/commands/migrateStatus.d.ts +1 -0
- package/types/cli/src/commands/queue.d.ts +20 -0
- package/types/cli/src/commands/routes.d.ts +1 -0
- package/types/cli/src/commands/seed.d.ts +1 -0
- package/types/cli/src/commands/serve.d.ts +6 -0
- package/types/cli/src/commands/test.d.ts +1 -0
- package/types/core/src/ai.d.ts +64 -0
- package/types/core/src/api.d.ts +262 -0
- package/types/core/src/auth.d.ts +154 -0
- package/types/core/src/authGate.d.ts +20 -0
- package/types/core/src/background.d.ts +34 -0
- package/types/core/src/cache.d.ts +160 -0
- package/types/core/src/constants.d.ts +38 -0
- package/types/core/src/container.d.ts +44 -0
- package/types/core/src/context/chunker.d.ts +31 -0
- package/types/core/src/context/index.d.ts +93 -0
- package/types/core/src/devAdmin.d.ts +179 -0
- package/types/core/src/devMailbox.d.ts +54 -0
- package/types/core/src/docs.d.ts +141 -0
- package/types/core/src/docsAutoDiscovery.d.ts +6 -0
- package/types/core/src/dotenv.d.ts +65 -0
- package/types/core/src/env.d.ts +28 -0
- package/types/core/src/errorOverlay.d.ts +36 -0
- package/types/core/src/events.d.ts +75 -0
- package/types/core/src/fakeData.d.ts +55 -0
- package/types/core/src/feedback.d.ts +90 -0
- package/types/core/src/graphql.d.ts +207 -0
- package/types/core/src/health.d.ts +22 -0
- package/types/core/src/htmlElement.d.ts +75 -0
- package/types/core/src/i18n.d.ts +37 -0
- package/types/core/src/index.d.ts +93 -0
- package/types/core/src/job.d.ts +39 -0
- package/types/core/src/logger.d.ts +123 -0
- package/types/core/src/mcp.d.ts +248 -0
- package/types/core/src/messenger.d.ts +191 -0
- package/types/core/src/metrics.d.ts +77 -0
- package/types/core/src/middleware.d.ts +207 -0
- package/types/core/src/mqtt.d.ts +257 -0
- package/types/core/src/mqttMessage.d.ts +67 -0
- package/types/core/src/plan.d.ts +96 -0
- package/types/core/src/projectIndex.d.ts +56 -0
- package/types/core/src/queue.d.ts +219 -0
- package/types/core/src/queueBackends/kafkaBackend.d.ts +117 -0
- package/types/core/src/queueBackends/liteBackend.d.ts +119 -0
- package/types/core/src/queueBackends/mongoBackend.d.ts +97 -0
- package/types/core/src/queueBackends/rabbitmqBackend.d.ts +55 -0
- package/types/core/src/rateLimiter.d.ts +49 -0
- package/types/core/src/request.d.ts +25 -0
- package/types/core/src/response.d.ts +28 -0
- package/types/core/src/routeDiscovery.d.ts +12 -0
- package/types/core/src/router.d.ts +355 -0
- package/types/core/src/scss.d.ts +19 -0
- package/types/core/src/server.d.ts +131 -0
- package/types/core/src/service.d.ts +115 -0
- package/types/core/src/session.d.ts +256 -0
- package/types/core/src/sessionHandlers/childError.d.ts +34 -0
- package/types/core/src/sessionHandlers/databaseHandler.d.ts +42 -0
- package/types/core/src/sessionHandlers/mongoClient.d.ts +24 -0
- package/types/core/src/sessionHandlers/mongoHandler.d.ts +61 -0
- package/types/core/src/sessionHandlers/redisHandler.d.ts +60 -0
- package/types/core/src/sessionHandlers/respClient.d.ts +22 -0
- package/types/core/src/sessionHandlers/valkeyHandler.d.ts +65 -0
- package/types/core/src/static.d.ts +2 -0
- package/types/core/src/test.d.ts +94 -0
- package/types/core/src/testClient.d.ts +36 -0
- package/types/core/src/testing.d.ts +58 -0
- package/types/core/src/types.d.ts +219 -0
- package/types/core/src/validator.d.ts +52 -0
- package/types/core/src/websocket.d.ts +376 -0
- package/types/core/src/websocketBackplane.d.ts +166 -0
- package/types/core/src/websocketConnection.d.ts +54 -0
- package/types/core/src/wsdl.d.ts +101 -0
- package/types/frond/src/engine.d.ts +263 -0
- package/types/frond/src/index.d.ts +2 -0
- package/types/orm/src/adapters/firebird.d.ts +138 -0
- package/types/orm/src/adapters/mongodb.d.ts +81 -0
- package/types/orm/src/adapters/mssql.d.ts +70 -0
- package/types/orm/src/adapters/mysql.d.ts +66 -0
- package/types/orm/src/adapters/odbc.d.ts +97 -0
- package/types/orm/src/adapters/postgres.d.ts +85 -0
- package/types/orm/src/adapters/sqlite.d.ts +56 -0
- package/types/orm/src/autoCrud.d.ts +73 -0
- package/types/orm/src/baseModel.d.ts +391 -0
- package/types/orm/src/cachedDatabase.d.ts +177 -0
- package/types/orm/src/database.d.ts +609 -0
- package/types/orm/src/databaseResult.d.ts +85 -0
- package/types/orm/src/docstore.d.ts +182 -0
- package/types/orm/src/fakeData.d.ts +22 -0
- package/types/orm/src/index.d.ts +40 -0
- package/types/orm/src/migration.d.ts +275 -0
- package/types/orm/src/model.d.ts +7 -0
- package/types/orm/src/query.d.ts +14 -0
- package/types/orm/src/queryBuilder.d.ts +173 -0
- package/types/orm/src/realtime/index.d.ts +7 -0
- package/types/orm/src/realtime/models/attachment.d.ts +43 -0
- package/types/orm/src/realtime/models/channel.d.ts +32 -0
- package/types/orm/src/realtime/models/channelMember.d.ts +32 -0
- package/types/orm/src/realtime/models/message.d.ts +36 -0
- package/types/orm/src/realtime/models/workspace.d.ts +26 -0
- package/types/orm/src/realtime/realtime.d.ts +24 -0
- package/types/orm/src/realtime/storage.d.ts +61 -0
- package/types/orm/src/seeder.d.ts +118 -0
- package/types/orm/src/sqlTranslator.d.ts +134 -0
- package/types/orm/src/types.d.ts +138 -0
- package/types/orm/src/validation.d.ts +6 -0
- package/types/swagger/src/generator.d.ts +46 -0
- package/types/swagger/src/index.d.ts +2 -0
- package/types/swagger/src/ui.d.ts +11 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tina4 WSDL/SOAP — SOAP 1.1 / WSDL 1.1 service base class.
|
|
3
|
+
*
|
|
4
|
+
* Auto-generates WSDL definitions and handles SOAP XML requests.
|
|
5
|
+
* Zero external dependencies — uses simple string parsing for XML.
|
|
6
|
+
*
|
|
7
|
+
* Matches the PHP reference implementation (Tina4\WSDL).
|
|
8
|
+
*
|
|
9
|
+
* import { WSDLService, WSDLOperation } from "@tina4/core";
|
|
10
|
+
*
|
|
11
|
+
* class Calculator extends WSDLService {
|
|
12
|
+
* serviceName = "Calculator";
|
|
13
|
+
* serviceUrl = "/api/calculator";
|
|
14
|
+
*
|
|
15
|
+
* @WSDLOperation({ output: { Result: "int" } })
|
|
16
|
+
* async Add(a: number, b: number): Promise<Record<string, unknown>> {
|
|
17
|
+
* return { Result: a + b };
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export interface WSDLOperationMeta {
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
input?: Record<string, string>;
|
|
25
|
+
output?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
interface WSDLOperationConfig {
|
|
28
|
+
description?: string;
|
|
29
|
+
input?: Record<string, string>;
|
|
30
|
+
output?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Decorator function for marking methods as WSDL operations.
|
|
34
|
+
*
|
|
35
|
+
* @WSDLOperation({ description: "Add two numbers", input: { a: "int", b: "int" }, output: { Result: "int" } })
|
|
36
|
+
* async Add(a: number, b: number): Promise<Record<string, unknown>> { ... }
|
|
37
|
+
*/
|
|
38
|
+
export declare function WSDLOperation(config?: WSDLOperationConfig): (_target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
39
|
+
export declare abstract class WSDLService {
|
|
40
|
+
abstract serviceName: string;
|
|
41
|
+
abstract serviceUrl: string;
|
|
42
|
+
protected namespace: string;
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle hook: called before operation invocation.
|
|
45
|
+
* Override to validate, log, or modify the incoming request.
|
|
46
|
+
*/
|
|
47
|
+
protected onRequest(_request: unknown): void;
|
|
48
|
+
/**
|
|
49
|
+
* Lifecycle hook: called after operation returns.
|
|
50
|
+
* Override to transform, audit, or enrich the result.
|
|
51
|
+
* Must return the (possibly modified) result.
|
|
52
|
+
*/
|
|
53
|
+
protected onResult(result: Record<string, unknown>): Record<string, unknown>;
|
|
54
|
+
/** Discovered operations (populated on first use). */
|
|
55
|
+
private _operations;
|
|
56
|
+
/**
|
|
57
|
+
* Discover operations by scanning for methods with _wsdlOp metadata.
|
|
58
|
+
*/
|
|
59
|
+
private discoverOperations;
|
|
60
|
+
/**
|
|
61
|
+
* Map a type name to an XSD type string.
|
|
62
|
+
*/
|
|
63
|
+
private typeToXsd;
|
|
64
|
+
/**
|
|
65
|
+
* Convert a string value from XML to the target type.
|
|
66
|
+
*/
|
|
67
|
+
private convertValue;
|
|
68
|
+
/**
|
|
69
|
+
* Generate WSDL 1.1 XML document.
|
|
70
|
+
*/
|
|
71
|
+
generateWSDL(endpointUrl?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Handle incoming SOAP request (parse XML, dispatch to method, return SOAP response).
|
|
74
|
+
*/
|
|
75
|
+
handle(soapXml?: string): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Register this service's routes on a router.
|
|
78
|
+
* GET /service-url?wsdl -> WSDL XML
|
|
79
|
+
* POST /service-url -> Handle SOAP request
|
|
80
|
+
*/
|
|
81
|
+
register(router: {
|
|
82
|
+
addRoute?: (method: string, path: string, handler: (req: unknown, res: unknown) => void) => void;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* Handle GET request — return WSDL XML.
|
|
86
|
+
*/
|
|
87
|
+
private handleGetRequest;
|
|
88
|
+
/**
|
|
89
|
+
* Handle POST request — process SOAP XML.
|
|
90
|
+
*/
|
|
91
|
+
private handlePostRequest;
|
|
92
|
+
/**
|
|
93
|
+
* Build a SOAP response XML envelope.
|
|
94
|
+
*/
|
|
95
|
+
private soapResponse;
|
|
96
|
+
/**
|
|
97
|
+
* Build a SOAP fault response XML.
|
|
98
|
+
*/
|
|
99
|
+
private soapFault;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export type FilterFn = (value: unknown, ...args: unknown[]) => unknown;
|
|
2
|
+
export type TestFn = (value: unknown) => boolean;
|
|
3
|
+
/** A minimal request shape a {% live %} data provider receives. */
|
|
4
|
+
export interface LiveRequest {
|
|
5
|
+
headers?: Record<string, unknown>;
|
|
6
|
+
params?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
/** A {% live %} data provider — re-runs with the live request each refresh. */
|
|
9
|
+
export type LiveProvider = (req: LiveRequest) => Record<string, unknown>;
|
|
10
|
+
/** Result of respondLive — a pure {status, body} descriptor a route applies. */
|
|
11
|
+
export interface LiveResponse {
|
|
12
|
+
status: number;
|
|
13
|
+
body: string;
|
|
14
|
+
}
|
|
15
|
+
/** WebSocket broadcaster hook wired by @tina4/core so pushLive can broadcast. */
|
|
16
|
+
export type LiveBroadcaster = (wsPath: string | null, name: string, envelope: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Hard cap on the template caches — `compiled` and `compiledStrings`
|
|
19
|
+
* (ADR-0004, parity with PHP/Python/Ruby TEMPLATE_CACHE_MAX).
|
|
20
|
+
*
|
|
21
|
+
* An entry here is a whole token list, so the cap sits well below what a
|
|
22
|
+
* per-expression memo would justify. 256 is far above any real application's
|
|
23
|
+
* template count, so a normal app never evicts. The cap exists for the
|
|
24
|
+
* workload that genuinely grows without limit for the life of a worker:
|
|
25
|
+
* `renderString` keys on md5(source), so an app that builds template strings
|
|
26
|
+
* dynamically adds an entry per distinct string.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TEMPLATE_CACHE_MAX = 256;
|
|
29
|
+
/**
|
|
30
|
+
* Set the session ID used by formToken() / form_token() for CSRF session binding.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setFormTokenSessionId(sessionId: string): void;
|
|
33
|
+
export declare class Frond {
|
|
34
|
+
private static classFilters;
|
|
35
|
+
private static classGlobals;
|
|
36
|
+
private static classTests;
|
|
37
|
+
private static liveFragments;
|
|
38
|
+
private static liveSources;
|
|
39
|
+
private static liveWsPaths;
|
|
40
|
+
private static liveBroadcaster;
|
|
41
|
+
/**
|
|
42
|
+
* Register a custom filter at the class level — available to every
|
|
43
|
+
* future ``new Frond()`` instance. Callable as ``Frond.addFilter()``
|
|
44
|
+
* (static) or ``frond.addFilter()`` (instance). See instance method
|
|
45
|
+
* below for the dual-call semantics.
|
|
46
|
+
*/
|
|
47
|
+
static addFilter(name: string, fn: FilterFn): void;
|
|
48
|
+
/**
|
|
49
|
+
* Register a global variable available in all templates of every
|
|
50
|
+
* future instance. Callable as ``Frond.addGlobal()`` (static) or
|
|
51
|
+
* ``frond.addGlobal()`` (instance).
|
|
52
|
+
*/
|
|
53
|
+
static addGlobal(name: string, value: unknown): void;
|
|
54
|
+
/**
|
|
55
|
+
* Register a custom test (``{% if x is positive %}``) at the class
|
|
56
|
+
* level. Callable as ``Frond.addTest()`` (static) or
|
|
57
|
+
* ``frond.addTest()`` (instance).
|
|
58
|
+
*/
|
|
59
|
+
static addTest(name: string, fn: TestFn): void;
|
|
60
|
+
/**
|
|
61
|
+
* Clear the class-level globals/filters/tests registries.
|
|
62
|
+
* Useful in test fixtures to prevent leaking state between tests.
|
|
63
|
+
* Does NOT affect built-in filters or globals — only user-registered
|
|
64
|
+
* ones via Frond.addFilter / addGlobal / addTest.
|
|
65
|
+
*/
|
|
66
|
+
static clearRegistry(): void;
|
|
67
|
+
private templateDir;
|
|
68
|
+
private filters;
|
|
69
|
+
private globals;
|
|
70
|
+
private tests;
|
|
71
|
+
private _sandbox;
|
|
72
|
+
private _allowedFilters;
|
|
73
|
+
private _allowedTags;
|
|
74
|
+
private _allowedVars;
|
|
75
|
+
private fragmentCache;
|
|
76
|
+
private _autoEscape;
|
|
77
|
+
/**
|
|
78
|
+
* Token pre-compilation cache for file templates.
|
|
79
|
+
*
|
|
80
|
+
* `cachedAt` is captured so the TINA4_TEMPLATE_CACHE_TTL env var can
|
|
81
|
+
* force re-compilation after N seconds even in production. TTL of 0
|
|
82
|
+
* means "no time-based invalidation" — entries live forever.
|
|
83
|
+
*/
|
|
84
|
+
private compiled;
|
|
85
|
+
/** Token pre-compilation cache for string templates */
|
|
86
|
+
private compiledStrings;
|
|
87
|
+
/**
|
|
88
|
+
* Bound reference to `applyFilters`, stashed into the render context as
|
|
89
|
+
* `__frond_apply_filters__` so the module-level `evalExpr` can resolve a
|
|
90
|
+
* filter pipe using THIS instance's registered filters. Bound once. (#171)
|
|
91
|
+
*/
|
|
92
|
+
private readonly _applyFiltersBound;
|
|
93
|
+
getTemplateDir(): string;
|
|
94
|
+
constructor(templateDir?: string);
|
|
95
|
+
sandbox(filters?: string[], tags?: string[], vars?: string[]): Frond;
|
|
96
|
+
unsandbox(): Frond;
|
|
97
|
+
/**
|
|
98
|
+
* Register a custom filter. The filter is persisted at class level
|
|
99
|
+
* so new instances created by hot-reload inherit it automatically;
|
|
100
|
+
* the live instance's local filter map also receives the addition
|
|
101
|
+
* immediately. Mirrors Python's _ClassOrInstanceMethod dual-call.
|
|
102
|
+
*/
|
|
103
|
+
addFilter(name: string, fn: FilterFn): void;
|
|
104
|
+
/**
|
|
105
|
+
* Register a global variable available in all templates. Persisted
|
|
106
|
+
* at class level — see ``addFilter`` for the dual-call semantics.
|
|
107
|
+
*/
|
|
108
|
+
addGlobal(name: string, value: unknown): void;
|
|
109
|
+
/**
|
|
110
|
+
* Register a custom test. Persisted at class level — see
|
|
111
|
+
* ``addFilter`` for the dual-call semantics.
|
|
112
|
+
*/
|
|
113
|
+
addTest(name: string, fn: TestFn): void;
|
|
114
|
+
/**
|
|
115
|
+
* Read the cache TTL in seconds. `TINA4_TEMPLATE_CACHE_TTL=0` (the
|
|
116
|
+
* default) keeps the existing "cache forever in prod" behaviour — any
|
|
117
|
+
* positive value invalidates compiled tokens after N seconds, useful
|
|
118
|
+
* when running long-lived servers behind a slow file sync where mtime
|
|
119
|
+
* isn't a reliable freshness signal.
|
|
120
|
+
*/
|
|
121
|
+
private cacheTtlSeconds;
|
|
122
|
+
render(template: string, data?: Record<string, unknown>): string;
|
|
123
|
+
renderString(source: string, data?: Record<string, unknown>): string;
|
|
124
|
+
/** Clear all compiled template caches. */
|
|
125
|
+
clearCache(): void;
|
|
126
|
+
/** Render a debug dump of a value as HTML — parity with PHP/Ruby/Python.
|
|
127
|
+
* Gated on TINA4_DEBUG=true. Returns empty string in production. */
|
|
128
|
+
renderDump(value: unknown): string;
|
|
129
|
+
private load;
|
|
130
|
+
/** Execute pre-tokenized template against context. */
|
|
131
|
+
private executeCached;
|
|
132
|
+
/** Execute with both source and pre-tokenized tokens available. */
|
|
133
|
+
private executeWithSource;
|
|
134
|
+
private execute;
|
|
135
|
+
private extractBlocks;
|
|
136
|
+
private renderWithBlocks;
|
|
137
|
+
private renderTokens;
|
|
138
|
+
/**
|
|
139
|
+
* May this filter RUN under the current sandbox?
|
|
140
|
+
*
|
|
141
|
+
* The escaping decision has to ask this rather than read the filter name out of
|
|
142
|
+
* the source. Node carries safety as a FLAG rather than as a value-level marker
|
|
143
|
+
* (Python and Ruby return a SafeString, PHP prepends a RAW_MARKER -- all three
|
|
144
|
+
* produced only by actually running the filter), so here the name alone was
|
|
145
|
+
* enough to suppress auto-escaping even when the filter was denied and skipped.
|
|
146
|
+
*/
|
|
147
|
+
private filterPermitted;
|
|
148
|
+
/**
|
|
149
|
+
* May this tag run under the current sandbox?
|
|
150
|
+
*
|
|
151
|
+
* One gate for every tag, so the allow-list governs the whole tag vocabulary
|
|
152
|
+
* instead of the four names that happened to be checked individually.
|
|
153
|
+
*/
|
|
154
|
+
private tagPermitted;
|
|
155
|
+
/**
|
|
156
|
+
* Consume a denied tag WITHOUT running it, returning the index past its body.
|
|
157
|
+
*
|
|
158
|
+
* Advancing a single token past a body-owning tag would leave the body's tokens
|
|
159
|
+
* to render at the TOP level, leaking exactly the content the sandbox denied.
|
|
160
|
+
*/
|
|
161
|
+
private skipDeniedTag;
|
|
162
|
+
private skipBlock;
|
|
163
|
+
/**
|
|
164
|
+
* Apply a parsed filter chain to an already-evaluated value. This is the
|
|
165
|
+
* instance-aware filter engine used by `evalExpr` (via the
|
|
166
|
+
* `__frond_apply_filters__` hook in the render context) so filters resolve
|
|
167
|
+
* with this Frond's registered/custom filters at ANY nesting depth — inside
|
|
168
|
+
* concat operands, ternary branches, and parenthesised sub-expressions — not
|
|
169
|
+
* only at the top-level {{ }} output. Mirrors the filter loop in
|
|
170
|
+
* `evalVarRaw`: `first`/`last` tail-paths, registered `this.filters`, and the
|
|
171
|
+
* trailing-comparison form (`length != 1`). Auto-escaping stays the caller's
|
|
172
|
+
* concern (`evalVarInner`). (#171)
|
|
173
|
+
*/
|
|
174
|
+
private applyFilters;
|
|
175
|
+
private evalVar;
|
|
176
|
+
private evalVarRaw;
|
|
177
|
+
private evalVarInner;
|
|
178
|
+
private handleIf;
|
|
179
|
+
private handleFor;
|
|
180
|
+
private handleSet;
|
|
181
|
+
private handleInclude;
|
|
182
|
+
private handleMacro;
|
|
183
|
+
/**
|
|
184
|
+
* Parse a macro parameter list into [name, default] pairs.
|
|
185
|
+
*
|
|
186
|
+
* Handles: name, name="default", name='default'. Splitting on "," alone left a
|
|
187
|
+
* defaulted parameter literally NAMED `greeting='Hello'`, so the body's
|
|
188
|
+
* {{ greeting }} matched nothing (rendered empty) AND the caller's positional
|
|
189
|
+
* argument was stored under that junk key and lost. Mirrors the Python master's
|
|
190
|
+
* _parse_macro_params. The default is null when none is declared.
|
|
191
|
+
*/
|
|
192
|
+
static parseMacroParams(rawParams: string): Array<[string, string | null]>;
|
|
193
|
+
/**
|
|
194
|
+
* {% import "file" as alias %} -- load EVERY macro in a file under one namespace.
|
|
195
|
+
*
|
|
196
|
+
* The alias is bound as a plain object of macro functions, so {{ alias.greet(x) }}
|
|
197
|
+
* resolves through the engine's existing dotted-call path and each macro keeps the
|
|
198
|
+
* same argument binding, default handling and SafeString output as any other macro.
|
|
199
|
+
* A namespace object (not a class) is deliberate: a function stored as a class
|
|
200
|
+
* attribute binds as a method and would inject the namespace as the first argument,
|
|
201
|
+
* which is exactly the argument-shift bug the Python master carried (fixed there
|
|
202
|
+
* with types.SimpleNamespace). Both import forms must render identically.
|
|
203
|
+
*/
|
|
204
|
+
private handleImportAs;
|
|
205
|
+
private handleFromImport;
|
|
206
|
+
private handleCache;
|
|
207
|
+
/**
|
|
208
|
+
* Handle {% live "name" poll N | sse | ws "path" [src "url"] %}...{% endlive %}.
|
|
209
|
+
*
|
|
210
|
+
* Server-rendered live region. The body renders once for first paint, is
|
|
211
|
+
* registered under <name> so GET /__frond/live/<name> (or a liveSource
|
|
212
|
+
* provider) can re-render it, and is wrapped in a marker element that
|
|
213
|
+
* frond.js wires to the chosen transport (poll / sse / ws). Mirrors the
|
|
214
|
+
* Python master's _handle_live and PHP/Ruby handleLive.
|
|
215
|
+
*/
|
|
216
|
+
private handleLive;
|
|
217
|
+
/**
|
|
218
|
+
* Re-render a registered {% live %} fragment by name with fresh data.
|
|
219
|
+
* Returns the rendered HTML, or null if no fragment is registered under that
|
|
220
|
+
* name yet (its page has not rendered). GET /__frond/live/<name> calls this
|
|
221
|
+
* after resolving the provider data.
|
|
222
|
+
*/
|
|
223
|
+
static renderLive(name: string, data?: Record<string, unknown>): string | null;
|
|
224
|
+
/** Register a data provider for a {% live %} block. Invoked with the live
|
|
225
|
+
* request on every refresh so auth re-applies. Mirrors Python's @live_source. */
|
|
226
|
+
static liveSource(name: string, fn: LiveProvider): void;
|
|
227
|
+
/** The provider registered for a live block, or null. */
|
|
228
|
+
static getLiveSource(name: string): LiveProvider | null;
|
|
229
|
+
/** Whether a live fragment has been registered (its page rendered). */
|
|
230
|
+
static hasLiveFragment(name: string): boolean;
|
|
231
|
+
/** The ws path a live block declared (data-ws), or null. */
|
|
232
|
+
static getLiveWsPath(name: string): string | null;
|
|
233
|
+
/**
|
|
234
|
+
* Resolve GET /__frond/live/{name}: run the provider with the live request
|
|
235
|
+
* (auth re-applies), re-render the fragment, and return a pure {status, body}
|
|
236
|
+
* descriptor the route handler applies to the response. 404 for an unknown
|
|
237
|
+
* name / unrendered fragment. Mirrors Python's live_endpoint / PHP respondLive.
|
|
238
|
+
*/
|
|
239
|
+
static respondLive(req: LiveRequest, name: string): LiveResponse;
|
|
240
|
+
/** Wire the WebSocket broadcaster used by pushLive. Called once by @tina4/core
|
|
241
|
+
* at server boot (frond is a zero-dep leaf and cannot import core). */
|
|
242
|
+
static setLiveBroadcaster(fn: LiveBroadcaster | null): void;
|
|
243
|
+
/**
|
|
244
|
+
* Re-render the '<name>' live fragment and push it to connected clients.
|
|
245
|
+
* Broadcasts a {type,name,html} envelope over WebSocket to the block's
|
|
246
|
+
* declared data-ws path (else a room named <name>). Returns the rendered
|
|
247
|
+
* HTML, or null if the fragment is not registered. Mirrors Python push_live
|
|
248
|
+
* / PHP pushLive. The broadcast is best-effort — a missing/failed broadcaster
|
|
249
|
+
* never throws into the caller.
|
|
250
|
+
*/
|
|
251
|
+
static pushLive(name: string, data?: Record<string, unknown>): string | null;
|
|
252
|
+
/**
|
|
253
|
+
* {% set name %}...{% endset %} -- render the body and bind it.
|
|
254
|
+
*
|
|
255
|
+
* Emits nothing itself. The captured value is a SafeString because it is
|
|
256
|
+
* template output that has already been escaped on the way in; re-escaping it
|
|
257
|
+
* at {{ name }} would double-encode every entity. Twig and Jinja2 both mark the
|
|
258
|
+
* capture safe. Returns the index just past {% endset %}.
|
|
259
|
+
*/
|
|
260
|
+
private handleSetBlock;
|
|
261
|
+
private handleSpaceless;
|
|
262
|
+
private handleAutoescape;
|
|
263
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tina4 Firebird Adapter — uses the `node-firebird` package (optional peer dependency).
|
|
3
|
+
*
|
|
4
|
+
* Install: npm install node-firebird
|
|
5
|
+
* URL format: firebird://user:pass@host:port/path/to/database.fdb
|
|
6
|
+
*/
|
|
7
|
+
import type { DatabaseAdapter, DatabaseResult, ColumnInfo, FieldDefinition } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Turn a URL path component into a Firebird database identifier.
|
|
10
|
+
*
|
|
11
|
+
* Firebird is the awkward one — it needs either an absolute file path on the
|
|
12
|
+
* server, a Windows drive-letter path, or an alias name. The classic URI form
|
|
13
|
+
* uses a double-slash to keep the leading "/" of an absolute path through
|
|
14
|
+
* URL parsing:
|
|
15
|
+
*
|
|
16
|
+
* firebird://host:port//firebird/data/app.fdb -> /firebird/data/app.fdb
|
|
17
|
+
*
|
|
18
|
+
* But that double slash is unintuitive to anyone used to the way
|
|
19
|
+
* postgres / mysql / mssql encode the database name. We accept five
|
|
20
|
+
* equivalent forms and normalise all of them:
|
|
21
|
+
*
|
|
22
|
+
* - `//abs/path/db.fdb` -> `/abs/path/db.fdb` (classic double-slash)
|
|
23
|
+
* - `/abs/path/db.fdb` -> `/abs/path/db.fdb` (single-slash, what most people type)
|
|
24
|
+
* - `/C:/Data/db.fdb` -> `C:/Data/db.fdb` (Windows, leading URL slash dropped)
|
|
25
|
+
* - `/C%3A/Data/db.fdb` -> `C:/Data/db.fdb` (Windows with URL-encoded colon)
|
|
26
|
+
* - `/employee` -> `employee` (alias — single token)
|
|
27
|
+
*
|
|
28
|
+
* Aliases are detected as the leftover case: a single token with no
|
|
29
|
+
* slashes. Anything path-like is kept as a path.
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeFirebirdDbIdentifier(rawPath: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the Firebird connection charset (php #160 / parity with the Python
|
|
34
|
+
* master's `_resolve_firebird_charset`).
|
|
35
|
+
*
|
|
36
|
+
* The adapter used to pass NO charset, deferring to the driver's implicit
|
|
37
|
+
* default, which double-encodes UTF-8 bytes stored under a legacy `NONE`
|
|
38
|
+
* database. This resolves the charset from, in precedence order:
|
|
39
|
+
*
|
|
40
|
+
* 1. the connection URL query — `firebird://host:port/path?charset=NONE`
|
|
41
|
+
* 2. an explicit `charset` on the FirebirdConfig object passed to the adapter
|
|
42
|
+
* 3. the `TINA4_DATABASE_CHARSET` environment variable
|
|
43
|
+
* 4. the `UTF8` default
|
|
44
|
+
*
|
|
45
|
+
* Pure config resolution over its inputs (URL string, explicit charset, env) —
|
|
46
|
+
* it opens NO connection, so it is unit-testable without a live server.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveFirebirdCharset(connectionString: string, explicitCharset?: string): string;
|
|
49
|
+
export interface FirebirdConfig {
|
|
50
|
+
host?: string;
|
|
51
|
+
port?: number;
|
|
52
|
+
user?: string;
|
|
53
|
+
password?: string;
|
|
54
|
+
database?: string;
|
|
55
|
+
role?: string;
|
|
56
|
+
pageSize?: number;
|
|
57
|
+
/** Connection charset. Overridden by a `?charset=` URL query; see resolveFirebirdCharset. */
|
|
58
|
+
charset?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare class FirebirdAdapter implements DatabaseAdapter {
|
|
61
|
+
private config;
|
|
62
|
+
private db;
|
|
63
|
+
private transaction;
|
|
64
|
+
private _lastInsertId;
|
|
65
|
+
constructor(config: FirebirdConfig | string);
|
|
66
|
+
/** Connect to Firebird. Must be called before using the adapter. */
|
|
67
|
+
connect(): Promise<void>;
|
|
68
|
+
private parseUrl;
|
|
69
|
+
private ensureConnected;
|
|
70
|
+
/** Translate SQL for Firebird dialect. */
|
|
71
|
+
translateSql(sql: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* The handle every statement runs on. While an explicit transaction is open
|
|
74
|
+
* (startTransactionAsync set `this.transaction`), statements MUST run on that
|
|
75
|
+
* transaction object so they are undone by rollbackAsync() / persisted by
|
|
76
|
+
* commitAsync() — node-firebird's transaction exposes the same
|
|
77
|
+
* query()/execute() as the connection. With no transaction open we run on
|
|
78
|
+
* `this.db`, whose per-statement work auto-commits on the connection.
|
|
79
|
+
*
|
|
80
|
+
* This matches the Python master's contract (tina4_python/database/firebird.py):
|
|
81
|
+
* there, ALL statements run on the single connection and start_transaction()
|
|
82
|
+
* merely suppresses the per-statement autocommit in execute() so the batch
|
|
83
|
+
* stays open until commit()/rollback(). node-firebird has no such suppression
|
|
84
|
+
* hook — its `db.query/execute` always auto-commit — so the equivalent is to
|
|
85
|
+
* route statements through the transaction object instead. Same observable
|
|
86
|
+
* behaviour: an open transaction is atomic and rolls back cleanly.
|
|
87
|
+
*
|
|
88
|
+
* Previously every statement ran on `this.db` unconditionally, so the
|
|
89
|
+
* transaction created by startTransactionAsync() never saw a single statement
|
|
90
|
+
* — rollbackAsync() rolled back an EMPTY transaction and the already
|
|
91
|
+
* auto-committed write survived (silent no-op). Twin of the PHP pdo_firebird
|
|
92
|
+
* bug fixed in 3.13.86.
|
|
93
|
+
*/
|
|
94
|
+
private statementHandle;
|
|
95
|
+
private queryPromise;
|
|
96
|
+
private executePromise;
|
|
97
|
+
execute(sql: string, params?: unknown[]): unknown;
|
|
98
|
+
executeMany(sql: string, paramsList: unknown[][]): {
|
|
99
|
+
totalAffected: number;
|
|
100
|
+
lastId?: number | bigint;
|
|
101
|
+
};
|
|
102
|
+
executeManyAsync(sql: string, paramsList: unknown[][]): Promise<{
|
|
103
|
+
totalAffected: number;
|
|
104
|
+
lastId?: number | bigint;
|
|
105
|
+
}>;
|
|
106
|
+
executeAsync(sql: string, params?: unknown[]): Promise<unknown>;
|
|
107
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): T[];
|
|
108
|
+
queryAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
109
|
+
/** Ensure BLOB columns are readable — node-firebird may return callback-based
|
|
110
|
+
* blob readers. Convert to Buffer. Regular buffers pass through unchanged. */
|
|
111
|
+
private decodeBlobs;
|
|
112
|
+
fetch<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): T[];
|
|
113
|
+
fetchAsync<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): Promise<T[]>;
|
|
114
|
+
fetchOne<T = Record<string, unknown>>(sql: string, params?: unknown[]): T | null;
|
|
115
|
+
fetchOneAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T | null>;
|
|
116
|
+
insert(table: string, data: Record<string, unknown> | Record<string, unknown>[]): DatabaseResult;
|
|
117
|
+
insertAsync(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<DatabaseResult>;
|
|
118
|
+
update(table: string, data: Record<string, unknown>, filter: Record<string, unknown>, params?: unknown[]): DatabaseResult;
|
|
119
|
+
updateAsync(table: string, data: Record<string, unknown>, filter: Record<string, unknown>): Promise<DatabaseResult>;
|
|
120
|
+
delete(table: string, filter: Record<string, unknown>, params?: unknown[]): DatabaseResult;
|
|
121
|
+
deleteAsync(table: string, filter: Record<string, unknown>): Promise<DatabaseResult>;
|
|
122
|
+
startTransaction(): void;
|
|
123
|
+
startTransactionAsync(): Promise<void>;
|
|
124
|
+
commit(): void;
|
|
125
|
+
commitAsync(): Promise<void>;
|
|
126
|
+
rollback(): void;
|
|
127
|
+
rollbackAsync(): Promise<void>;
|
|
128
|
+
tables(): string[];
|
|
129
|
+
tablesAsync(): Promise<string[]>;
|
|
130
|
+
columns(table: string): ColumnInfo[];
|
|
131
|
+
columnsAsync(table: string): Promise<ColumnInfo[]>;
|
|
132
|
+
lastInsertId(): number | bigint | null;
|
|
133
|
+
close(): void;
|
|
134
|
+
tableExists(name: string): boolean;
|
|
135
|
+
tableExistsAsync(name: string): Promise<boolean>;
|
|
136
|
+
createTable(name: string, columns: Record<string, FieldDefinition>): void;
|
|
137
|
+
createTableAsync(name: string, columns: Record<string, FieldDefinition>): Promise<void>;
|
|
138
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tina4 MongoDB Adapter — uses the `mongodb` package (optional peer dependency).
|
|
3
|
+
*
|
|
4
|
+
* Install: npm install mongodb
|
|
5
|
+
* URL format: mongodb://host:port/dbname or mongodb+srv://user:pass@host/dbname
|
|
6
|
+
*/
|
|
7
|
+
import type { DatabaseAdapter, DatabaseResult, ColumnInfo, FieldDefinition } from "../types.js";
|
|
8
|
+
export interface MongoConfig {
|
|
9
|
+
host?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
user?: string;
|
|
12
|
+
password?: string;
|
|
13
|
+
database?: string;
|
|
14
|
+
connectionString?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class MongodbAdapter implements DatabaseAdapter {
|
|
17
|
+
private config;
|
|
18
|
+
private client;
|
|
19
|
+
private db;
|
|
20
|
+
private session;
|
|
21
|
+
private _lastInsertId;
|
|
22
|
+
private _inTransaction;
|
|
23
|
+
private _connectionString;
|
|
24
|
+
private _dbName;
|
|
25
|
+
constructor(config: MongoConfig | string);
|
|
26
|
+
/** Connect to MongoDB. Must be called before using the adapter. */
|
|
27
|
+
connect(): Promise<void>;
|
|
28
|
+
private ensureConnected;
|
|
29
|
+
/** Execute a SQL-like statement translated to a MongoDB operation. */
|
|
30
|
+
execute(sql: string, params?: unknown[]): unknown;
|
|
31
|
+
executeAsync(sql: string, params?: unknown[]): Promise<unknown>;
|
|
32
|
+
executeMany(sql: string, paramsList: unknown[][]): {
|
|
33
|
+
totalAffected: number;
|
|
34
|
+
lastId?: number | bigint;
|
|
35
|
+
};
|
|
36
|
+
executeManyAsync(sql: string, paramsList: unknown[][]): Promise<{
|
|
37
|
+
totalAffected: number;
|
|
38
|
+
lastId?: number | bigint;
|
|
39
|
+
}>;
|
|
40
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): T[];
|
|
41
|
+
queryAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
42
|
+
fetch<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): T[];
|
|
43
|
+
fetchAsync<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): Promise<T[]>;
|
|
44
|
+
fetchOne<T = Record<string, unknown>>(sql: string, params?: unknown[]): T | null;
|
|
45
|
+
fetchOneAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T | null>;
|
|
46
|
+
insert(table: string, data: Record<string, unknown> | Record<string, unknown>[]): DatabaseResult;
|
|
47
|
+
insertAsync(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<DatabaseResult>;
|
|
48
|
+
update(table: string, data: Record<string, unknown>, filter: Record<string, unknown>): DatabaseResult;
|
|
49
|
+
updateAsync(table: string, data: Record<string, unknown>, filter: Record<string, unknown>): Promise<DatabaseResult>;
|
|
50
|
+
delete(table: string, filter: Record<string, unknown> | string | Record<string, unknown>[]): DatabaseResult;
|
|
51
|
+
deleteAsync(table: string, filter: Record<string, unknown> | string | Record<string, unknown>[]): Promise<DatabaseResult>;
|
|
52
|
+
startTransaction(): void;
|
|
53
|
+
startTransactionAsync(): Promise<void>;
|
|
54
|
+
commit(): void;
|
|
55
|
+
commitAsync(): Promise<void>;
|
|
56
|
+
rollback(): void;
|
|
57
|
+
rollbackAsync(): Promise<void>;
|
|
58
|
+
tables(): string[];
|
|
59
|
+
tablesAsync(): Promise<string[]>;
|
|
60
|
+
columns(table: string): ColumnInfo[];
|
|
61
|
+
/**
|
|
62
|
+
* Infer column schema by sampling a document from the collection.
|
|
63
|
+
* MongoDB is schema-less; this returns field names and inferred JS types.
|
|
64
|
+
*/
|
|
65
|
+
columnsAsync(table: string): Promise<ColumnInfo[]>;
|
|
66
|
+
lastInsertId(): number | bigint | null;
|
|
67
|
+
close(): void;
|
|
68
|
+
tableExists(name: string): boolean;
|
|
69
|
+
tableExistsAsync(name: string): Promise<boolean>;
|
|
70
|
+
createTable(name: string, columns: Record<string, FieldDefinition>): void;
|
|
71
|
+
/**
|
|
72
|
+
* Create a MongoDB collection with optional JSON schema validation derived
|
|
73
|
+
* from the Tina4 field definitions.
|
|
74
|
+
*/
|
|
75
|
+
createTableAsync(name: string, columns: Record<string, FieldDefinition>): Promise<void>;
|
|
76
|
+
/** Get column info as a plain array (legacy migration support). */
|
|
77
|
+
getTableColumnsAsync(table: string): Promise<Array<{
|
|
78
|
+
name: string;
|
|
79
|
+
type: string;
|
|
80
|
+
}>>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tina4 MSSQL Adapter — uses the `tedious` package (optional peer dependency).
|
|
3
|
+
*
|
|
4
|
+
* Install: npm install tedious
|
|
5
|
+
* URL format: mssql://user:pass@host:port/database
|
|
6
|
+
*/
|
|
7
|
+
import type { DatabaseAdapter, DatabaseResult, ColumnInfo, FieldDefinition } from "../types.js";
|
|
8
|
+
export interface MssqlConfig {
|
|
9
|
+
host?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
user?: string;
|
|
12
|
+
password?: string;
|
|
13
|
+
database?: string;
|
|
14
|
+
connectionString?: string;
|
|
15
|
+
options?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export declare class MssqlAdapter implements DatabaseAdapter {
|
|
18
|
+
private config;
|
|
19
|
+
private connection;
|
|
20
|
+
private _lastInsertId;
|
|
21
|
+
private _inTransaction;
|
|
22
|
+
constructor(config: MssqlConfig | string);
|
|
23
|
+
/** Connect to MSSQL. Must be called before using the adapter. */
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
private parseUrl;
|
|
26
|
+
private ensureConnected;
|
|
27
|
+
/** Translate SQL for MSSQL dialect. */
|
|
28
|
+
translateSql(sql: string): string;
|
|
29
|
+
private execSqlPromise;
|
|
30
|
+
/** Convert ? placeholders to @p0, @p1, ... for tedious. */
|
|
31
|
+
private convertPlaceholders;
|
|
32
|
+
execute(sql: string, params?: unknown[]): unknown;
|
|
33
|
+
executeMany(sql: string, paramsList: unknown[][]): {
|
|
34
|
+
totalAffected: number;
|
|
35
|
+
lastId?: number | bigint;
|
|
36
|
+
};
|
|
37
|
+
executeManyAsync(sql: string, paramsList: unknown[][]): Promise<{
|
|
38
|
+
totalAffected: number;
|
|
39
|
+
lastId?: number | bigint;
|
|
40
|
+
}>;
|
|
41
|
+
executeAsync(sql: string, params?: unknown[]): Promise<unknown>;
|
|
42
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): T[];
|
|
43
|
+
queryAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
44
|
+
fetch<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): T[];
|
|
45
|
+
fetchAsync<T = Record<string, unknown>>(sql: string, params?: unknown[], limit?: number, skip?: number): Promise<T[]>;
|
|
46
|
+
fetchOne<T = Record<string, unknown>>(sql: string, params?: unknown[]): T | null;
|
|
47
|
+
fetchOneAsync<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T | null>;
|
|
48
|
+
insert(table: string, data: Record<string, unknown> | Record<string, unknown>[]): DatabaseResult;
|
|
49
|
+
insertAsync(table: string, data: Record<string, unknown> | Record<string, unknown>[]): Promise<DatabaseResult>;
|
|
50
|
+
update(table: string, data: Record<string, unknown>, filter: Record<string, unknown>, params?: unknown[]): DatabaseResult;
|
|
51
|
+
updateAsync(table: string, data: Record<string, unknown>, filter: Record<string, unknown>): Promise<DatabaseResult>;
|
|
52
|
+
delete(table: string, filter: Record<string, unknown>, params?: unknown[]): DatabaseResult;
|
|
53
|
+
deleteAsync(table: string, filter: Record<string, unknown>): Promise<DatabaseResult>;
|
|
54
|
+
startTransaction(): void;
|
|
55
|
+
startTransactionAsync(): Promise<void>;
|
|
56
|
+
commit(): void;
|
|
57
|
+
commitAsync(): Promise<void>;
|
|
58
|
+
rollback(): void;
|
|
59
|
+
rollbackAsync(): Promise<void>;
|
|
60
|
+
tables(): string[];
|
|
61
|
+
tablesAsync(): Promise<string[]>;
|
|
62
|
+
columns(table: string): ColumnInfo[];
|
|
63
|
+
columnsAsync(table: string): Promise<ColumnInfo[]>;
|
|
64
|
+
lastInsertId(): number | bigint | null;
|
|
65
|
+
close(): void;
|
|
66
|
+
tableExists(name: string): boolean;
|
|
67
|
+
tableExistsAsync(name: string): Promise<boolean>;
|
|
68
|
+
createTable(name: string, columns: Record<string, FieldDefinition>): void;
|
|
69
|
+
createTableAsync(name: string, columns: Record<string, FieldDefinition>): Promise<void>;
|
|
70
|
+
}
|