data-finder-ts 0.1.3 → 0.1.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.
Files changed (62) hide show
  1. package/README.md +17 -55
  2. package/dist/chunk-BGEX377Q.js +230 -0
  3. package/dist/chunk-BGEX377Q.js.map +1 -0
  4. package/dist/chunk-BKPWV3OF.js +962 -0
  5. package/dist/chunk-BKPWV3OF.js.map +1 -0
  6. package/dist/{chunk-EYXBYV2X.js → chunk-GPHWC533.js} +2 -2
  7. package/dist/chunk-KAK75RVS.js +198 -0
  8. package/dist/chunk-KAK75RVS.js.map +1 -0
  9. package/dist/chunk-MGEL5RWM.js +628 -0
  10. package/dist/chunk-MGEL5RWM.js.map +1 -0
  11. package/dist/chunk-PF6EJZHB.js +1015 -0
  12. package/dist/chunk-PF6EJZHB.js.map +1 -0
  13. package/dist/datafinder/attribute.cjs +595 -18
  14. package/dist/datafinder/attribute.cjs.map +1 -1
  15. package/dist/datafinder/attribute.d.cts +73 -10
  16. package/dist/datafinder/attribute.d.ts +73 -10
  17. package/dist/datafinder/attribute.js +2 -2
  18. package/dist/datafinder/runner.cjs +1589 -288
  19. package/dist/datafinder/runner.cjs.map +1 -1
  20. package/dist/datafinder/runner.d.cts +41 -7
  21. package/dist/datafinder/runner.d.ts +41 -7
  22. package/dist/datafinder/runner.js +12 -6
  23. package/dist/datafinder/sql-generator.cjs +1484 -281
  24. package/dist/datafinder/sql-generator.cjs.map +1 -1
  25. package/dist/datafinder/sql-generator.d.cts +19 -14
  26. package/dist/datafinder/sql-generator.d.ts +19 -14
  27. package/dist/datafinder/sql-generator.js +9 -7
  28. package/dist/datafinder/typed-attributes.cjs +856 -93
  29. package/dist/datafinder/typed-attributes.cjs.map +1 -1
  30. package/dist/datafinder/typed-attributes.d.cts +3 -135
  31. package/dist/datafinder/typed-attributes.d.ts +3 -135
  32. package/dist/datafinder/typed-attributes.js +3 -3
  33. package/dist/dialect-CogGPm_y.d.cts +38 -0
  34. package/dist/dialect-aaG1bDi5.d.ts +38 -0
  35. package/dist/index.cjs +2080 -480
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +119 -14
  38. package/dist/index.d.ts +119 -14
  39. package/dist/index.js +362 -12
  40. package/dist/index.js.map +1 -1
  41. package/dist/model/milestoning.cjs +529 -0
  42. package/dist/model/milestoning.cjs.map +1 -1
  43. package/dist/model/milestoning.js +2 -2
  44. package/dist/model/relational.cjs +608 -12
  45. package/dist/model/relational.cjs.map +1 -1
  46. package/dist/model/relational.d.cts +456 -47
  47. package/dist/model/relational.d.ts +456 -47
  48. package/dist/model/relational.js +61 -3
  49. package/dist/typed-attributes-CUTf_6Ru.d.ts +328 -0
  50. package/dist/typed-attributes-CdWXq_78.d.cts +328 -0
  51. package/package.json +5 -2
  52. package/dist/chunk-3SSWFES4.js +0 -448
  53. package/dist/chunk-3SSWFES4.js.map +0 -1
  54. package/dist/chunk-5K2Z3YDY.js +0 -393
  55. package/dist/chunk-5K2Z3YDY.js.map +0 -1
  56. package/dist/chunk-6QTCGJWX.js +0 -98
  57. package/dist/chunk-6QTCGJWX.js.map +0 -1
  58. package/dist/chunk-DFYZVBII.js +0 -652
  59. package/dist/chunk-DFYZVBII.js.map +0 -1
  60. package/dist/chunk-V647VNMY.js +0 -135
  61. package/dist/chunk-V647VNMY.js.map +0 -1
  62. /package/dist/{chunk-EYXBYV2X.js.map → chunk-GPHWC533.js.map} +0 -0
@@ -1,135 +1,3 @@
1
- import { Attribute } from './attribute.js';
2
- import { JoinTreeNodeOperation, Operation, DateExtractOperation, DateArithmeticOperation, DateDiffOperation, AggregateOperation, ScalarFunctionOperation } from '../model/relational.js';
3
-
4
- declare class StringAttribute extends Attribute {
5
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
6
- upper(): ScalarFunctionOperation;
7
- lower(): ScalarFunctionOperation;
8
- strip(): ScalarFunctionOperation;
9
- lstrip(): ScalarFunctionOperation;
10
- rstrip(): ScalarFunctionOperation;
11
- length(): ScalarFunctionOperation;
12
- reverse(): ScalarFunctionOperation;
13
- left(n: number): ScalarFunctionOperation;
14
- right(n: number): ScalarFunctionOperation;
15
- repeat(n: number): ScalarFunctionOperation;
16
- replace(fromStr: string, toStr: string): ScalarFunctionOperation;
17
- substring(start: number, length?: number): ScalarFunctionOperation;
18
- eq(value: string): Operation;
19
- ne(value: string): Operation;
20
- contains(value: string): Operation;
21
- startsWith(prefix: string): Operation;
22
- endsWith(suffix: string): Operation;
23
- notContains(value: string): Operation;
24
- }
25
- declare abstract class NumericAttribute extends Attribute {
26
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
27
- sum(): AggregateOperation;
28
- min(): AggregateOperation;
29
- max(): AggregateOperation;
30
- average(): AggregateOperation;
31
- abs(): ScalarFunctionOperation;
32
- ceil(): ScalarFunctionOperation;
33
- floor(): ScalarFunctionOperation;
34
- sqrt(): ScalarFunctionOperation;
35
- mod(n: number): ScalarFunctionOperation;
36
- power(n: number): ScalarFunctionOperation;
37
- round(d?: number): ScalarFunctionOperation;
38
- }
39
- declare class DoubleAttribute extends NumericAttribute {
40
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
41
- eq(value: number): Operation;
42
- ne(value: number): Operation;
43
- gt(value: number): Operation;
44
- lt(value: number): Operation;
45
- gte(value: number): Operation;
46
- lte(value: number): Operation;
47
- }
48
- declare const FloatAttribute: typeof DoubleAttribute;
49
- type FloatAttribute = DoubleAttribute;
50
- declare class DecimalAttribute extends NumericAttribute {
51
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
52
- eq(value: number): Operation;
53
- ne(value: number): Operation;
54
- gt(value: number): Operation;
55
- lt(value: number): Operation;
56
- gte(value: number): Operation;
57
- lte(value: number): Operation;
58
- }
59
- declare class IntegerAttribute extends NumericAttribute {
60
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
61
- eq(value: number): Operation;
62
- ne(value: number): Operation;
63
- gt(value: number): Operation;
64
- lt(value: number): Operation;
65
- gte(value: number): Operation;
66
- lte(value: number): Operation;
67
- }
68
- declare class BooleanAttribute extends Attribute {
69
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
70
- eq(value: boolean): Operation;
71
- isTrue(): Operation;
72
- isFalse(): Operation;
73
- }
74
- declare class DateAttribute extends Attribute {
75
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
76
- eq(value: Date | string): Operation;
77
- ne(value: Date | string): Operation;
78
- gt(value: Date | string): Operation;
79
- lt(value: Date | string): Operation;
80
- gte(value: Date | string): Operation;
81
- lte(value: Date | string): Operation;
82
- year(): DateExtractOperation;
83
- month(): DateExtractOperation;
84
- day(): DateExtractOperation;
85
- quarter(): DateExtractOperation;
86
- week(): DateExtractOperation;
87
- dayOfWeek(): DateExtractOperation;
88
- addDays(n: number): DateArithmeticOperation;
89
- addMonths(n: number): DateArithmeticOperation;
90
- addYears(n: number): DateArithmeticOperation;
91
- subtractDays(n: number): DateArithmeticOperation;
92
- subtractMonths(n: number): DateArithmeticOperation;
93
- subtractYears(n: number): DateArithmeticOperation;
94
- diffDays(other: Date): DateDiffOperation;
95
- diffMonths(other: Date): DateDiffOperation;
96
- diffYears(other: Date): DateDiffOperation;
97
- }
98
- declare class DateTimeAttribute extends Attribute {
99
- constructor(displayName: string, columnName: string, columnDbType: string, owner: string, parent?: JoinTreeNodeOperation);
100
- eq(value: Date | string): Operation;
101
- ne(value: Date | string): Operation;
102
- gt(value: Date | string): Operation;
103
- lt(value: Date | string): Operation;
104
- gte(value: Date | string): Operation;
105
- lte(value: Date | string): Operation;
106
- year(): DateExtractOperation;
107
- month(): DateExtractOperation;
108
- day(): DateExtractOperation;
109
- hour(): DateExtractOperation;
110
- minute(): DateExtractOperation;
111
- second(): DateExtractOperation;
112
- quarter(): DateExtractOperation;
113
- week(): DateExtractOperation;
114
- dayOfWeek(): DateExtractOperation;
115
- addDays(n: number): DateArithmeticOperation;
116
- addMonths(n: number): DateArithmeticOperation;
117
- addYears(n: number): DateArithmeticOperation;
118
- addHours(n: number): DateArithmeticOperation;
119
- addMinutes(n: number): DateArithmeticOperation;
120
- addSeconds(n: number): DateArithmeticOperation;
121
- subtractDays(n: number): DateArithmeticOperation;
122
- subtractMonths(n: number): DateArithmeticOperation;
123
- subtractYears(n: number): DateArithmeticOperation;
124
- subtractHours(n: number): DateArithmeticOperation;
125
- subtractMinutes(n: number): DateArithmeticOperation;
126
- subtractSeconds(n: number): DateArithmeticOperation;
127
- diffDays(other: Date): DateDiffOperation;
128
- diffMonths(other: Date): DateDiffOperation;
129
- diffYears(other: Date): DateDiffOperation;
130
- diffHours(other: Date): DateDiffOperation;
131
- diffMinutes(other: Date): DateDiffOperation;
132
- diffSeconds(other: Date): DateDiffOperation;
133
- }
134
-
135
- export { BooleanAttribute, DateAttribute, DateTimeAttribute, DecimalAttribute, DoubleAttribute, FloatAttribute, IntegerAttribute, NumericAttribute, StringAttribute };
1
+ import './attribute.js';
2
+ export { B as BooleanAttribute, D as DateAttribute, a as DateTimeAttribute, b as DecimalAttribute, c as DoubleAttribute, F as FloatAttribute, I as IntegerAttribute, N as NumericAttribute, S as StringAttribute } from '../typed-attributes-CUTf_6Ru.js';
3
+ import '../model/relational.js';
@@ -8,9 +8,9 @@ import {
8
8
  IntegerAttribute,
9
9
  NumericAttribute,
10
10
  StringAttribute
11
- } from "../chunk-5K2Z3YDY.js";
12
- import "../chunk-V647VNMY.js";
13
- import "../chunk-3SSWFES4.js";
11
+ } from "../chunk-MGEL5RWM.js";
12
+ import "../chunk-BGEX377Q.js";
13
+ import "../chunk-PF6EJZHB.js";
14
14
  export {
15
15
  BooleanAttribute,
16
16
  DateAttribute,
@@ -0,0 +1,38 @@
1
+ import { SortDirection, DatePart } from './model/relational.cjs';
2
+
3
+ /**
4
+ * The SQL a query is written in. The generator writes Postgres by default; a dialect says where another database
5
+ * differs, so the same query can be sent to DuckDB or Databricks.
6
+ *
7
+ * Only what differs is here. Everything the databases share (joins, CASE, window functions, COUNT(DISTINCT), LIKE ...
8
+ * ESCAPE, `||`, typed date literals, `INTERVAL '7' DAY`, ...) is written once by the generator.
9
+ */
10
+
11
+ type DialectName = 'postgres' | 'duckdb' | 'databricks';
12
+ interface SqlDialect {
13
+ readonly name: DialectName;
14
+ /** A name as an identifier, used for the names of the result's columns. */
15
+ quoteIdentifier(name: string): string;
16
+ /** A string as a literal that can never end early, whatever it holds. */
17
+ stringLiteral(value: string): string;
18
+ /**
19
+ * ` ASC` or ` DESC`, with the null placement spelled out where the database's default differs from Postgres
20
+ * (nulls last when ascending, first when descending), so a sort gives the same order everywhere.
21
+ */
22
+ orderDirection(direction: SortDirection): string;
23
+ /** The type a float constant is cast to, so it comes back as a double and not a decimal. */
24
+ readonly doubleType: string;
25
+ /** The day of the week of a date or timestamp, 0 = Sunday through 6 = Saturday. */
26
+ dayOfWeek(expression: string): string;
27
+ /** Whole `unit`s from `from` to `to`; both are SQL expressions. */
28
+ dateDiff(unit: DatePart, from: string, to: string): string;
29
+ /** The values of a group joined with `separator` (an SQL literal), in the order given (each with its direction). */
30
+ stringAgg(expression: string, separator: string, orderBy: string[]): string;
31
+ }
32
+ declare const POSTGRES: SqlDialect;
33
+ declare const DUCKDB: SqlDialect;
34
+ declare const DATABRICKS: SqlDialect;
35
+ /** A dialect by name, or as given. */
36
+ declare function dialectOf(dialect: DialectName | SqlDialect): SqlDialect;
37
+
38
+ export { DATABRICKS as D, POSTGRES as P, type SqlDialect as S, DUCKDB as a, type DialectName as b, dialectOf as d };
@@ -0,0 +1,38 @@
1
+ import { SortDirection, DatePart } from './model/relational.js';
2
+
3
+ /**
4
+ * The SQL a query is written in. The generator writes Postgres by default; a dialect says where another database
5
+ * differs, so the same query can be sent to DuckDB or Databricks.
6
+ *
7
+ * Only what differs is here. Everything the databases share (joins, CASE, window functions, COUNT(DISTINCT), LIKE ...
8
+ * ESCAPE, `||`, typed date literals, `INTERVAL '7' DAY`, ...) is written once by the generator.
9
+ */
10
+
11
+ type DialectName = 'postgres' | 'duckdb' | 'databricks';
12
+ interface SqlDialect {
13
+ readonly name: DialectName;
14
+ /** A name as an identifier, used for the names of the result's columns. */
15
+ quoteIdentifier(name: string): string;
16
+ /** A string as a literal that can never end early, whatever it holds. */
17
+ stringLiteral(value: string): string;
18
+ /**
19
+ * ` ASC` or ` DESC`, with the null placement spelled out where the database's default differs from Postgres
20
+ * (nulls last when ascending, first when descending), so a sort gives the same order everywhere.
21
+ */
22
+ orderDirection(direction: SortDirection): string;
23
+ /** The type a float constant is cast to, so it comes back as a double and not a decimal. */
24
+ readonly doubleType: string;
25
+ /** The day of the week of a date or timestamp, 0 = Sunday through 6 = Saturday. */
26
+ dayOfWeek(expression: string): string;
27
+ /** Whole `unit`s from `from` to `to`; both are SQL expressions. */
28
+ dateDiff(unit: DatePart, from: string, to: string): string;
29
+ /** The values of a group joined with `separator` (an SQL literal), in the order given (each with its direction). */
30
+ stringAgg(expression: string, separator: string, orderBy: string[]): string;
31
+ }
32
+ declare const POSTGRES: SqlDialect;
33
+ declare const DUCKDB: SqlDialect;
34
+ declare const DATABRICKS: SqlDialect;
35
+ /** A dialect by name, or as given. */
36
+ declare function dialectOf(dialect: DialectName | SqlDialect): SqlDialect;
37
+
38
+ export { DATABRICKS as D, POSTGRES as P, type SqlDialect as S, DUCKDB as a, type DialectName as b, dialectOf as d };