@truto/sqlite-builder 2.0.1 → 2.0.2-canary.10

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/sql.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import type { SqlFragment, SqlQuery, SqlValue } from './types';
2
- /**
3
- * Convert a value to its SQLite representation
4
- */
5
- declare function sqlValue(value: SqlValue): unknown;
6
- /**
7
- * Validate and quote a SQL identifier or array of identifiers/fragments
8
- */
9
- declare function sqlIdent(identifier: string | readonly (string | SqlFragment)[]): SqlFragment;
10
- /**
11
- * Create SQL IN clause from array
12
- */
13
- declare function sqlIn(array: readonly unknown[]): SqlFragment;
14
- /**
15
- * Create raw SQL fragment (DANGEROUS - must not contain user input).
16
- *
17
- * This is the library's single, explicit trust boundary: whatever string is
18
- * passed here becomes SQL verbatim. Only ever pass developer-authored,
19
- * constant SQL. Never pass user input. For dynamic WHERE clauses use
20
- * compileFilter(); for identifiers use sql.ident().
21
- */
22
- declare function sqlRaw(rawSql: string): SqlFragment;
23
- /**
24
- * Create SQL fragment for BLOB data (for validated binary data)
25
- */
26
- declare function sqlBlob(data: Buffer | Uint8Array): SqlFragment;
27
- /**
28
- * Join SQL fragments with a separator.
29
- *
30
- * Fragments must be library-minted (branded) fragments. The separator may be:
31
- * - a string: treated as a structural connector and validated by
32
- * assertSafeSeparator() so any connector is supported safely; or
33
- * - a SqlFragment: its text becomes the connector and its values are
34
- * interleaved between fragments, allowing fully parameterized separators.
35
- */
36
- declare function sqlJoin(fragments: readonly SqlFragment[], separator?: string | SqlFragment): SqlFragment;
37
- /**
38
- * Main SQL tagged template function
39
- */
40
- declare function sql(strings: TemplateStringsArray, ...values: unknown[]): SqlQuery;
41
- declare namespace sql {
42
- export var value: typeof sqlValue;
43
- export var ident: typeof sqlIdent;
44
- var _a: typeof sqlIn;
45
- export var raw: typeof sqlRaw;
46
- export var blob: typeof sqlBlob;
47
- export var join: typeof sqlJoin;
48
- export { _a as in };
49
- }
50
- export { sql };
51
- //# sourceMappingURL=sql.d.ts.map
package/dist/sql.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../src/sql.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAgB9D;;GAEG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAwB1C;AAiCD;;GAEG;AACH,iBAAS,QAAQ,CACf,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,GACrD,WAAW,CAoDb;AAED;;GAEG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,WAAW,CAoBrD;AAED;;;;;;;GAOG;AACH,iBAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAM3C;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAMvD;AA2DD;;;;;;;;GAQG;AACH,iBAAS,OAAO,CACd,SAAS,EAAE,SAAS,WAAW,EAAE,EACjC,SAAS,GAAE,MAAM,GAAG,WAAkB,GACrC,WAAW,CA6Cb;AA6ED;;GAEG;AACH,iBAAS,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAgD1E;kBAhDQ,GAAG;;;;;;;;;AA0DZ,OAAO,EAAE,GAAG,EAAE,CAAA"}
package/dist/types.d.ts DELETED
@@ -1,74 +0,0 @@
1
- /**
2
- * The result of a SQL tagged template
3
- */
4
- export interface SqlQuery {
5
- readonly text: string;
6
- readonly values: readonly unknown[];
7
- }
8
- /**
9
- * Valid SQL value types that can be safely interpolated
10
- */
11
- export type SqlValue = string | number | boolean | null | undefined | Date | Buffer | Uint8Array;
12
- /**
13
- * A SQL fragment that can be joined with other fragments
14
- */
15
- export interface SqlFragment {
16
- readonly text: string;
17
- readonly values: readonly unknown[];
18
- }
19
- /**
20
- * Comparison operators for JSON filters
21
- */
22
- export interface ComparisonOperators {
23
- /** Greater than */
24
- gt?: SqlValue;
25
- /** Greater than or equal */
26
- gte?: SqlValue;
27
- /** Less than */
28
- lt?: SqlValue;
29
- /** Less than or equal */
30
- lte?: SqlValue;
31
- /** Not equal */
32
- ne?: SqlValue;
33
- /** IN array */
34
- in?: readonly SqlValue[];
35
- /** NOT IN array */
36
- nin?: readonly SqlValue[];
37
- /** LIKE pattern */
38
- like?: string;
39
- /** Case-insensitive LIKE */
40
- ilike?: string;
41
- /** Regular expression pattern */
42
- regex?: string;
43
- /** Field exists check (true = IS NOT NULL, false = IS NULL) */
44
- exists?: boolean;
45
- }
46
- /**
47
- * A field condition can be a direct value or an object with operators
48
- */
49
- export type FieldCondition = SqlValue | ComparisonOperators;
50
- /**
51
- * Logical operators for combining filters
52
- */
53
- export interface LogicalOperators {
54
- /** All conditions must match */
55
- and?: readonly JsonFilter[];
56
- /** Any condition must match */
57
- or?: readonly JsonFilter[];
58
- }
59
- /**
60
- * A JSON filter for compiling to SQL WHERE clauses
61
- * Can be a field-to-condition mapping with implicit AND, explicit logical operators,
62
- * or alias blocks (keys starting with $) containing nested filters
63
- */
64
- export type JsonFilter = LogicalOperators & {
65
- [field: string]: FieldCondition | readonly JsonFilter[] | JsonFilter | undefined;
66
- };
67
- /**
68
- * Result of compiling a JSON filter to SQL
69
- */
70
- export interface FilterResult {
71
- readonly text: string;
72
- readonly values: readonly unknown[];
73
- }
74
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,SA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