@zintrust/core 2.5.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"D1MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/D1MigrateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"D1MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/D1MigrateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA4IrE;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;cACO,YAAY;EAgCtB,CAAC"}
|
|
@@ -36,7 +36,11 @@ const buildExecutionContext = (options) => {
|
|
|
36
36
|
const projectRoot = process.cwd();
|
|
37
37
|
const dbName = getDbName(projectRoot, options);
|
|
38
38
|
const env = typeof options['env'] === 'string' ? options['env'].trim() : undefined;
|
|
39
|
-
const config = typeof options['config'] === 'string' ? options['config'].trim() : undefined
|
|
39
|
+
const config = (typeof options['config'] === 'string' ? options['config'].trim() : undefined) ??
|
|
40
|
+
(typeof options['wrangler-config'] === 'string'
|
|
41
|
+
? options['wrangler-config'].trim()
|
|
42
|
+
: undefined) ??
|
|
43
|
+
(typeof options['wc'] === 'string' ? options['wc'].trim() : undefined);
|
|
40
44
|
const migrationsRelDir = isWorkerCommand
|
|
41
45
|
? path.join('database', 'migrations', 'd1')
|
|
42
46
|
: WranglerConfig.getD1MigrationsDir(projectRoot, dbName);
|
|
@@ -114,7 +118,9 @@ export const D1MigrateCommand = Object.freeze({
|
|
|
114
118
|
.option('--remote', 'Run against remote D1 database (production)')
|
|
115
119
|
.option('--database <name>', 'Wrangler D1 identifier. Accepts database_name or binding; defaults to the configured wrangler d1_databases entry when available.')
|
|
116
120
|
.option('--env <name>', 'Wrangler environment to use (e.g., staging, production)')
|
|
117
|
-
.option('--config <path>', 'Path to wrangler config file (e.g., wrangler.dev.jsonc)')
|
|
121
|
+
.option('--config <path>', 'Path to wrangler config file (e.g., wrangler.dev.jsonc)')
|
|
122
|
+
.option('--wrangler-config <path>', 'Path to wrangler config file (e.g., wrangler.dev.jsonc)')
|
|
123
|
+
.option('--wc <path>', 'Path to wrangler config file (e.g., wrangler.dev.jsonc)');
|
|
118
124
|
};
|
|
119
125
|
const cmd = BaseCommand.create({
|
|
120
126
|
name: 'd1:migrate',
|
|
@@ -146,7 +146,7 @@ const DashboardFactory = Object.freeze({
|
|
|
146
146
|
return dashboard;
|
|
147
147
|
},
|
|
148
148
|
});
|
|
149
|
-
const DashboardCallable = function
|
|
149
|
+
const DashboardCallable = function () {
|
|
150
150
|
return DashboardFactory.create();
|
|
151
151
|
};
|
|
152
152
|
export const Dashboard = Object.assign(DashboardCallable, DashboardFactory);
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v2.5.
|
|
2
|
+
* @zintrust/core v2.5.5
|
|
3
3
|
*
|
|
4
4
|
* ZinTrust Framework - Production-Grade TypeScript Backend
|
|
5
5
|
* Built for performance, type safety, and exceptional developer experience
|
|
6
6
|
*
|
|
7
7
|
* Build Information:
|
|
8
|
-
* Built: 2026-06-
|
|
8
|
+
* Built: 2026-06-12T12:50:49.048Z
|
|
9
9
|
* Node: >=20.0.0
|
|
10
10
|
* License: MIT
|
|
11
11
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Available at runtime for debugging and health checks
|
|
22
22
|
*/
|
|
23
23
|
export const ZINTRUST_VERSION = '0.1.41';
|
|
24
|
-
export const ZINTRUST_BUILD_DATE = '2026-06-
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-06-12T12:50:49.011Z'; // Replaced during build
|
|
25
25
|
export { Application } from './boot/Application.js';
|
|
26
26
|
export { AwsSigV4 } from './common/index.js';
|
|
27
27
|
export { SignedRequest } from './security/SignedRequest.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"D1Adapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/D1Adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"D1Adapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/D1Adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAEV,cAAc,EAGd,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AA+F9B;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;oBAEa,cAAc,GAAG,gBAAgB;EAoKjD,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -7,8 +7,8 @@ import { Logger } from '../../config/logger.js';
|
|
|
7
7
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
8
|
import { isObject } from '../../helper/index.js';
|
|
9
9
|
import { AdaptersEnum } from '../../migrations/enum/index.js';
|
|
10
|
-
import { BaseAdapter } from '../DatabaseAdapter.js';
|
|
11
10
|
import { createReadSessionScope, openSession } from '../adapters/D1ReadSession.js';
|
|
11
|
+
import { BaseAdapter } from '../DatabaseAdapter.js';
|
|
12
12
|
import { QueryBuilder } from '../QueryBuilder.js';
|
|
13
13
|
const isRecord = (value) => isObject(value);
|
|
14
14
|
const toNumber = (value) => {
|
|
@@ -67,6 +67,25 @@ const extractServedBy = (value) => {
|
|
|
67
67
|
function getD1Binding(_config) {
|
|
68
68
|
return Cloudflare.getD1Binding(_config);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Normalize D1 bind parameters to handle integer-to-TEXT column compatibility.
|
|
72
|
+
*
|
|
73
|
+
* Workerd's D1 API binds every JavaScript number parameter as a float64 (REAL).
|
|
74
|
+
* When SQLite compares a REAL operand against a column with TEXT affinity,
|
|
75
|
+
* the operand is cast using the column's affinity, producing '2.0' — which
|
|
76
|
+
* never equals a stored '2' from PHP/PDO.
|
|
77
|
+
*
|
|
78
|
+
* This function converts integer-valued numbers to their canonical decimal
|
|
79
|
+
* string representation to match PHP/PDO behavior for TEXT columns.
|
|
80
|
+
*
|
|
81
|
+
* @param parameters - The bind parameters array
|
|
82
|
+
* @returns Normalized parameters with integers as strings
|
|
83
|
+
*/
|
|
84
|
+
function normalizeD1BindParameters(parameters) {
|
|
85
|
+
if (!Array.isArray(parameters))
|
|
86
|
+
return parameters;
|
|
87
|
+
return parameters.map((value) => typeof value === 'number' && Number.isInteger(value) ? String(value) : value);
|
|
88
|
+
}
|
|
70
89
|
/**
|
|
71
90
|
* D1 adapter implementation
|
|
72
91
|
*/
|
|
@@ -108,10 +127,11 @@ export const D1Adapter = Object.freeze({
|
|
|
108
127
|
if (!connected)
|
|
109
128
|
throw ErrorFactory.createConnectionError('Database not connected');
|
|
110
129
|
const db = resolveExecutor();
|
|
130
|
+
const normalizedParams = normalizeD1BindParameters(parameters);
|
|
111
131
|
try {
|
|
112
132
|
const stmt = db.prepare(sql);
|
|
113
133
|
if (isMutatingSql(sql)) {
|
|
114
|
-
const runResult = await stmt.bind(...
|
|
134
|
+
const runResult = await stmt.bind(...normalizedParams).run();
|
|
115
135
|
const runRecord = runResult;
|
|
116
136
|
const meta = extractMeta(runRecord.meta);
|
|
117
137
|
return {
|
|
@@ -121,7 +141,7 @@ export const D1Adapter = Object.freeze({
|
|
|
121
141
|
...extractServedBy(runRecord.meta),
|
|
122
142
|
};
|
|
123
143
|
}
|
|
124
|
-
const result = await stmt.bind(...
|
|
144
|
+
const result = await stmt.bind(...normalizedParams).all();
|
|
125
145
|
const rawResult = result;
|
|
126
146
|
const rows = BaseAdapter.normalizeRows(rawResult.results ?? []);
|
|
127
147
|
const metaValue = rawResult.meta;
|
|
@@ -141,9 +161,10 @@ export const D1Adapter = Object.freeze({
|
|
|
141
161
|
if (!connected)
|
|
142
162
|
throw ErrorFactory.createConnectionError('Database not connected');
|
|
143
163
|
const db = resolveExecutor();
|
|
164
|
+
const normalizedParams = normalizeD1BindParameters(parameters);
|
|
144
165
|
try {
|
|
145
166
|
const stmt = db.prepare(sql);
|
|
146
|
-
const result = await stmt.bind(...
|
|
167
|
+
const result = await stmt.bind(...normalizedParams).first();
|
|
147
168
|
return result === null ? null : BaseAdapter.normalizeRow(result);
|
|
148
169
|
}
|
|
149
170
|
catch (error) {
|
|
@@ -204,10 +225,11 @@ export const D1Adapter = Object.freeze({
|
|
|
204
225
|
throw ErrorFactory.createConnectionError('Database not connected');
|
|
205
226
|
}
|
|
206
227
|
const db = resolveExecutor();
|
|
228
|
+
const normalizedParams = normalizeD1BindParameters(parameters ?? []);
|
|
207
229
|
try {
|
|
208
230
|
Logger.warn(`Raw SQL Query executed: ${sql}`, Logger.withTraceSkipContext({ sql, parameters }));
|
|
209
231
|
const stmt = db.prepare(sql);
|
|
210
|
-
const result = await stmt.bind(...
|
|
232
|
+
const result = await stmt.bind(...normalizedParams).all();
|
|
211
233
|
return result.results ?? [];
|
|
212
234
|
}
|
|
213
235
|
catch (error) {
|