@atscript/db-sql-tools 0.1.49 → 0.1.51
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/index.cjs +26 -0
- package/dist/index.d.cts +14 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.mjs +26 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -412,6 +412,31 @@ function buildCreateView(dialect, viewName, plan, columns, resolveFieldRef) {
|
|
|
412
412
|
return sql;
|
|
413
413
|
}
|
|
414
414
|
//#endregion
|
|
415
|
+
//#region src/regex.ts
|
|
416
|
+
/**
|
|
417
|
+
* Parses a regex value that may be a RegExp object, a `/pattern/flags` string,
|
|
418
|
+
* or a raw pattern string. Returns the extracted pattern and flags.
|
|
419
|
+
*
|
|
420
|
+
* Handles the format produced by `@uniqu/url@0.1.4+` where regex values
|
|
421
|
+
* arrive as strings like `"/^Ali/i"` instead of raw patterns.
|
|
422
|
+
*/
|
|
423
|
+
function parseRegexString(value) {
|
|
424
|
+
if (value instanceof RegExp) return {
|
|
425
|
+
pattern: value.source,
|
|
426
|
+
flags: value.flags
|
|
427
|
+
};
|
|
428
|
+
const str = String(value);
|
|
429
|
+
const match = str.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
430
|
+
if (match) return {
|
|
431
|
+
pattern: match[1],
|
|
432
|
+
flags: match[2]
|
|
433
|
+
};
|
|
434
|
+
return {
|
|
435
|
+
pattern: str,
|
|
436
|
+
flags: ""
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
415
440
|
exports.AGG_FN_SQL = AGG_FN_SQL;
|
|
416
441
|
exports.EMPTY_AND = EMPTY_AND;
|
|
417
442
|
exports.EMPTY_OR = EMPTY_OR;
|
|
@@ -428,6 +453,7 @@ exports.createFilterVisitor = createFilterVisitor;
|
|
|
428
453
|
exports.defaultValueForType = defaultValueForType;
|
|
429
454
|
exports.defaultValueToSqlLiteral = defaultValueToSqlLiteral;
|
|
430
455
|
exports.finalizeParams = finalizeParams;
|
|
456
|
+
exports.parseRegexString = parseRegexString;
|
|
431
457
|
exports.queryNodeToSql = queryNodeToSql;
|
|
432
458
|
exports.queryOpToSql = queryOpToSql;
|
|
433
459
|
exports.refActionToSql = refActionToSql;
|
package/dist/index.d.cts
CHANGED
|
@@ -100,4 +100,17 @@ declare function buildAggregateSelect(dialect: SqlDialect, table: string, where:
|
|
|
100
100
|
*/
|
|
101
101
|
declare function buildAggregateCount(dialect: SqlDialect, table: string, where: TSqlFragment, controls: DbControls): TSqlFragment;
|
|
102
102
|
//#endregion
|
|
103
|
-
|
|
103
|
+
//#region src/regex.d.ts
|
|
104
|
+
/**
|
|
105
|
+
* Parses a regex value that may be a RegExp object, a `/pattern/flags` string,
|
|
106
|
+
* or a raw pattern string. Returns the extracted pattern and flags.
|
|
107
|
+
*
|
|
108
|
+
* Handles the format produced by `@uniqu/url@0.1.4+` where regex values
|
|
109
|
+
* arrive as strings like `"/^Ali/i"` instead of raw patterns.
|
|
110
|
+
*/
|
|
111
|
+
declare function parseRegexString(value: unknown): {
|
|
112
|
+
pattern: string;
|
|
113
|
+
flags: string;
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { AGG_FN_SQL, EMPTY_AND, EMPTY_OR, type SqlDialect, type TSqlFragment, buildAggregateCount, buildAggregateSelect, buildCreateView, buildDelete, buildInsert, buildProjection, buildSelect, buildUpdate, buildWhere, createFilterVisitor, defaultValueForType, defaultValueToSqlLiteral, finalizeParams, parseRegexString, queryNodeToSql, queryOpToSql, refActionToSql, sqlStringLiteral, toSqlValue };
|
package/dist/index.d.mts
CHANGED
|
@@ -100,4 +100,17 @@ declare function buildAggregateSelect(dialect: SqlDialect, table: string, where:
|
|
|
100
100
|
*/
|
|
101
101
|
declare function buildAggregateCount(dialect: SqlDialect, table: string, where: TSqlFragment, controls: DbControls): TSqlFragment;
|
|
102
102
|
//#endregion
|
|
103
|
-
|
|
103
|
+
//#region src/regex.d.ts
|
|
104
|
+
/**
|
|
105
|
+
* Parses a regex value that may be a RegExp object, a `/pattern/flags` string,
|
|
106
|
+
* or a raw pattern string. Returns the extracted pattern and flags.
|
|
107
|
+
*
|
|
108
|
+
* Handles the format produced by `@uniqu/url@0.1.4+` where regex values
|
|
109
|
+
* arrive as strings like `"/^Ali/i"` instead of raw patterns.
|
|
110
|
+
*/
|
|
111
|
+
declare function parseRegexString(value: unknown): {
|
|
112
|
+
pattern: string;
|
|
113
|
+
flags: string;
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { AGG_FN_SQL, EMPTY_AND, EMPTY_OR, type SqlDialect, type TSqlFragment, buildAggregateCount, buildAggregateSelect, buildCreateView, buildDelete, buildInsert, buildProjection, buildSelect, buildUpdate, buildWhere, createFilterVisitor, defaultValueForType, defaultValueToSqlLiteral, finalizeParams, parseRegexString, queryNodeToSql, queryOpToSql, refActionToSql, sqlStringLiteral, toSqlValue };
|
package/dist/index.mjs
CHANGED
|
@@ -411,4 +411,29 @@ function buildCreateView(dialect, viewName, plan, columns, resolveFieldRef) {
|
|
|
411
411
|
return sql;
|
|
412
412
|
}
|
|
413
413
|
//#endregion
|
|
414
|
-
|
|
414
|
+
//#region src/regex.ts
|
|
415
|
+
/**
|
|
416
|
+
* Parses a regex value that may be a RegExp object, a `/pattern/flags` string,
|
|
417
|
+
* or a raw pattern string. Returns the extracted pattern and flags.
|
|
418
|
+
*
|
|
419
|
+
* Handles the format produced by `@uniqu/url@0.1.4+` where regex values
|
|
420
|
+
* arrive as strings like `"/^Ali/i"` instead of raw patterns.
|
|
421
|
+
*/
|
|
422
|
+
function parseRegexString(value) {
|
|
423
|
+
if (value instanceof RegExp) return {
|
|
424
|
+
pattern: value.source,
|
|
425
|
+
flags: value.flags
|
|
426
|
+
};
|
|
427
|
+
const str = String(value);
|
|
428
|
+
const match = str.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
429
|
+
if (match) return {
|
|
430
|
+
pattern: match[1],
|
|
431
|
+
flags: match[2]
|
|
432
|
+
};
|
|
433
|
+
return {
|
|
434
|
+
pattern: str,
|
|
435
|
+
flags: ""
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
export { AGG_FN_SQL, EMPTY_AND, EMPTY_OR, buildAggregateCount, buildAggregateSelect, buildCreateView, buildDelete, buildInsert, buildProjection, buildSelect, buildUpdate, buildWhere, createFilterVisitor, defaultValueForType, defaultValueToSqlLiteral, finalizeParams, parseRegexString, queryNodeToSql, queryOpToSql, refActionToSql, sqlStringLiteral, toSqlValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/db-sql-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"description": "Shared SQL builder utilities for @atscript database adapters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@uniqu/core": "^0.1.4",
|
|
41
|
-
"unplugin-atscript": "^0.1.
|
|
41
|
+
"unplugin-atscript": "^0.1.48"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@uniqu/core": "^0.1.4",
|
|
45
|
-
"@atscript/db": "^0.1.
|
|
45
|
+
"@atscript/db": "^0.1.51"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "vp pack",
|