orange-orm 4.5.4 → 4.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/docs/changelog.md CHANGED
@@ -1,4 +1,6 @@
1
1
  ## Changelog
2
+ __4.5.5__
3
+ Bugfix: Parameterized queries are case sensitive on SAP ASE . See [#123](https://github.com/alfateam/orange-orm/issues/123)
2
4
  __4.5.4__
3
5
  Bugfix: hasMany relation through references relation gives empty array . See [#122](https://github.com/alfateam/orange-orm/issues/122)
4
6
  __4.5.3__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "4.5.4",
3
+ "version": "4.5.5",
4
4
  "main": "./src/index.js",
5
5
  "browser": "./src/client/index.mjs",
6
6
  "bin": {
package/src/map.d.ts CHANGED
@@ -611,22 +611,28 @@ type AggregateStrategyBase<T> =
611
611
  where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
612
612
  };
613
613
 
614
- type FetchingStrategyBase<T> = {
614
+
615
+ type FetchingStrategyBase<T, IsMany = true> =
616
+ {
615
617
  [K in keyof T &
616
618
  keyof RemoveNever<
617
619
  AllowedColumnsAndTablesStrategy<T>
618
620
  >]?: T[K] extends ColumnSymbols
619
621
  ? boolean
620
- : boolean | FetchingStrategyBase<T[K]> | AggType<T[K]>;
621
- } & {
622
+ : boolean | FetchingStrategyBase<T[K], T[K] extends ManyRelation ? true: false> | AggType<T[K]>;
623
+ } &
624
+ (IsMany extends true ? {
625
+ limit?: number;
626
+ offset?: number;
622
627
  orderBy?:
623
628
  | OrderBy<Extract<keyof AllowedColumns<T>, string>>[]
624
629
  | OrderBy<Extract<keyof AllowedColumns<T>, string>>;
625
- limit?: number;
626
- offset?: number;
627
630
  where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
631
+ }
632
+ : {
633
+ where?: (agg: MappedColumnsAndRelations<T>) => RawFilter;
634
+ });
628
635
 
629
- };
630
636
  type ExtractAggregates<Agg> = {
631
637
  [K in keyof Agg as
632
638
  Required<Agg>[K] extends (agg: Aggregate<infer V>) => ColumnSymbols
@@ -21,6 +21,7 @@ function newGenericPool(connectionString, poolOptions) {
21
21
  return cb(err, null);
22
22
  client = _client;
23
23
  client.poolCount = 0;
24
+ client.msnodesqlv8 = mssql;
24
25
  return cb(null, client);
25
26
  }
26
27
  },
@@ -8,6 +8,12 @@ function wrapQuery(connection) {
8
8
  var params = query.parameters;
9
9
  var sql = query.sql();
10
10
  log.emitQuery({ sql, parameters: params });
11
+ const sap = connection.msnodesqlv8;
12
+ for (let i = 0; i < params.length; i++) {
13
+ const parameter = params[i];
14
+ if (typeof parameter === 'string')
15
+ params[i] = sap.VarChar(parameter);
16
+ }
11
17
 
12
18
  runOriginalQuery.call(connection, sql, params, onInnerCompleted);
13
19
  let result = [];
package/index.html DELETED
@@ -1,100 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
- <title>Orange ORM</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- </head>
9
- <body class="bg-orange-50 text-gray-800 font-sans">
10
-
11
- <!-- Logo on Neutral Background -->
12
- <div class="bg-white shadow-md py-4">
13
- <div class="max-w-6xl mx-auto px-4 flex items-center justify-center">
14
- <img src="file:///C:/Users/lars.roald/repos/rdb/docs/orange.svg" alt="Orange ORM Logo" class="w-14 h-14" />
15
- </div>
16
- </div>
17
-
18
- <!-- Hero -->
19
- <header class="bg-orange-500 text-white py-16 text-center">
20
- <div class="max-w-4xl mx-auto px-4">
21
- <h1 class="text-5xl font-bold">Orange ORM</h1>
22
- <p class="mt-3 text-lg">Elegant, minimal, and expressive ORM for JavaScript and TypeScript.</p>
23
- <div class="mt-6 space-x-4">
24
- <a href="https://github.com/alfateam/orange-orm" target="_blank"
25
- class="inline-block bg-white text-orange-600 font-semibold px-5 py-2 rounded shadow hover:bg-orange-100 transition">
26
- View on GitHub
27
- </a>
28
- <a href="#examples"
29
- class="inline-block bg-orange-600 text-white font-semibold px-5 py-2 rounded border border-white hover:bg-orange-700 transition">
30
- See Examples
31
- </a>
32
- </div>
33
- </div>
34
- </header>
35
-
36
- <!-- Main -->
37
- <main class="max-w-4xl mx-auto px-4 py-16">
38
- <section class="mb-16">
39
- <h2 class="text-3xl font-bold text-orange-600 mb-4">Why Orange ORM?</h2>
40
- <ul class="list-disc list-inside space-y-2 text-lg">
41
- <li>Simple and expressive API</li>
42
- <li>Type-safe and lightweight</li>
43
- <li>Works out of the box with popular SQL databases</li>
44
- <li>Built with modern JavaScript and TypeScript support</li>
45
- </ul>
46
- </section>
47
-
48
- <section id="examples" class="mb-16">
49
- <h2 class="text-3xl font-bold text-orange-600 mb-6">Quick Examples</h2>
50
-
51
- <div class="space-y-8">
52
- <div>
53
- <h3 class="text-xl font-semibold mb-2">Define a Model</h3>
54
- <pre class="bg-gray-100 p-4 rounded text-sm overflow-auto"><code>import { defineModel } from 'orange-orm';
55
-
56
- const User = defineModel('users', {
57
- id: 'number',
58
- name: 'string',
59
- email: 'string'
60
- });</code></pre>
61
- </div>
62
-
63
- <div>
64
- <h3 class="text-xl font-semibold mb-2">Create a Record</h3>
65
- <pre class="bg-gray-100 p-4 rounded text-sm overflow-auto"><code>await User.create({
66
- name: 'Alice',
67
- email: 'alice@example.com'
68
- });</code></pre>
69
- </div>
70
-
71
- <div>
72
- <h3 class="text-xl font-semibold mb-2">Find Records</h3>
73
- <pre class="bg-gray-100 p-4 rounded text-sm overflow-auto"><code>const users = await User.find({ where: { name: 'Alice' } });</code></pre>
74
- </div>
75
-
76
- <div>
77
- <h3 class="text-xl font-semibold mb-2">Update</h3>
78
- <pre class="bg-gray-100 p-4 rounded text-sm overflow-auto"><code>await User.update({ email: 'new@example.com' }, { where: { id: 1 } });</code></pre>
79
- </div>
80
-
81
- <div>
82
- <h3 class="text-xl font-semibold mb-2">Delete</h3>
83
- <pre class="bg-gray-100 p-4 rounded text-sm overflow-auto"><code>await User.delete({ where: { id: 1 } });</code></pre>
84
- </div>
85
- </div>
86
- </section>
87
-
88
- <section class="mb-16">
89
- <h2 class="text-3xl font-bold text-orange-600 mb-4">Get Started</h2>
90
- <pre class="bg-gray-100 p-4 rounded text-sm mb-4"><code>npm install orange-orm</code></pre>
91
- <p class="text-lg">Check the <a href="https://github.com/alfateam/orange-orm" class="text-orange-600 font-semibold underline" target="_blank">GitHub repo</a> for full documentation and examples.</p>
92
- </section>
93
- </main>
94
-
95
- <footer class="text-center text-sm text-gray-500 py-8 border-t">
96
- Built with love by <a href="https://github.com/alfateam" class="underline hover:text-orange-600" target="_blank">alfateam</a> &middot; MIT License
97
- </footer>
98
-
99
- </body>
100
- </html>