drizzle-orm 0.12.0-beta.11 → 0.12.0-beta.13
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/column.js.map +1 -1
- package/package.json +5 -22
- package/utils.d.ts +75 -1
- package/utils.js.map +1 -1
package/column.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.js","sourceRoot":"","sources":["../src/column.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"column.js","sourceRoot":"","sources":["../src/column.ts"],"names":[],"mappings":";;;AAcA,kCAAkC;AAClC,+BAA+B;AAC/B,8CAA8C;AAC9C,kDAAkD;AAElD;;;;EAIE;AACF,MAAsB,MAAM;IAe3B,YAAqB,KAA4B,EAAE,OAA4C;QAA1E,UAAK,GAAL,KAAK,CAAuB;QAChD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;IAC1C,CAAC;IAID,kBAAkB,CAAC,KAAuB;QACzC,OAAO,KAAY,CAAC;IACrB,CAAC;IAED,gBAAgB,CAAC,KAAgB;QAChC,OAAO,KAAY,CAAC;IACrB,CAAC;CACD;AA/BD,wBA+BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-orm",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.13",
|
|
4
4
|
"description": "Drizzle ORM package for SQL databases",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -29,10 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/drizzle-team/drizzle-orm#readme",
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"drizzle-orm-mysql": ">=0.12.0 <0.13.0 || >=0.12.0-beta.0 <0.13.0-beta.0",
|
|
32
|
-
"drizzle-orm-pg": ">=0.12.0 <0.13.0 || >=0.12.0-beta.0 <0.13.0-beta.0"
|
|
33
|
-
"mysql2": ">=2 <3",
|
|
34
|
-
"pg": ">=8 <9",
|
|
35
|
-
"sqlite3": ">=5 <6"
|
|
32
|
+
"drizzle-orm-pg": ">=0.12.0 <0.13.0 || >=0.12.0-beta.0 <0.13.0-beta.0"
|
|
36
33
|
},
|
|
37
34
|
"peerDependenciesMeta": {
|
|
38
35
|
"mysql2": {
|
|
@@ -51,24 +48,10 @@
|
|
|
51
48
|
"optional": true
|
|
52
49
|
}
|
|
53
50
|
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@types/node": "*",
|
|
56
|
-
"@types/pg": "^8.6.1",
|
|
57
|
-
"@types/sqlite3": "^3.1.8",
|
|
58
|
-
"mysql2": "^2.3.3",
|
|
59
|
-
"pg": "^8.6.0",
|
|
60
|
-
"resolve-tspaths": "^0.7.0",
|
|
61
|
-
"sqlite3": "^5.0.8",
|
|
62
|
-
"ts-node": "^10.8.2",
|
|
63
|
-
"typescript": "^4.8.4",
|
|
64
|
-
"uvu": "^0.5.6"
|
|
65
|
-
},
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"type-fest": "^2.16.0"
|
|
68
|
-
},
|
|
69
51
|
"scripts": {
|
|
70
|
-
"build": "tsc",
|
|
71
|
-
"
|
|
52
|
+
"build": "concurrently -n build,test \"tsc -p tsconfig.build.json\" pnpm:test",
|
|
53
|
+
"test": "echo WARN: No tests defined!",
|
|
54
|
+
"pack": "cp ../README.md package.json dist/ && (cd dist && pnpm pack --pack-destination ..) && rm -f package.tgz && mv *.tgz package.tgz",
|
|
72
55
|
"publish:beta": "npm publish package.tgz --tag beta --git-checks false",
|
|
73
56
|
"release:beta": "pnpm build && pnpm version prerelease && pnpm run pack && pnpm publish:beta",
|
|
74
57
|
"build:int": "pnpm build && pnpm run pack"
|
package/utils.d.ts
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
|
-
import { Simplify } from 'type-fest';
|
|
2
1
|
import { SelectFieldsOrdered } from './operations';
|
|
3
2
|
export declare function mapResultRow<TResult extends Record<string, unknown>>(columns: SelectFieldsOrdered, row: unknown[], joinsNotNullable?: Record<string, boolean>): TResult;
|
|
4
3
|
export declare type OneOrMany<T> = T | T[];
|
|
5
4
|
export declare type Update<T, TUpdate> = Simplify<Omit<T, keyof TUpdate> & TUpdate>;
|
|
5
|
+
/**
|
|
6
|
+
@see Simplify
|
|
7
|
+
*/
|
|
8
|
+
export interface SimplifyOptions {
|
|
9
|
+
/**
|
|
10
|
+
Do the simplification recursively.
|
|
11
|
+
|
|
12
|
+
@default false
|
|
13
|
+
*/
|
|
14
|
+
deep?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare type Flatten<AnyType, Options extends SimplifyOptions = {}> = Options['deep'] extends true ? {
|
|
17
|
+
[KeyType in keyof AnyType]: Simplify<AnyType[KeyType], Options>;
|
|
18
|
+
} : {
|
|
19
|
+
[KeyType in keyof AnyType]: AnyType[KeyType];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
23
|
+
|
|
24
|
+
@example
|
|
25
|
+
```
|
|
26
|
+
import type {Simplify} from 'type-fest';
|
|
27
|
+
|
|
28
|
+
type PositionProps = {
|
|
29
|
+
top: number;
|
|
30
|
+
left: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type SizeProps = {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
|
39
|
+
type Props = Simplify<PositionProps & SizeProps>;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
|
|
43
|
+
|
|
44
|
+
If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
|
|
45
|
+
|
|
46
|
+
@example
|
|
47
|
+
```
|
|
48
|
+
import type {Simplify} from 'type-fest';
|
|
49
|
+
|
|
50
|
+
interface SomeInterface {
|
|
51
|
+
foo: number;
|
|
52
|
+
bar?: string;
|
|
53
|
+
baz: number | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type SomeType = {
|
|
57
|
+
foo: number;
|
|
58
|
+
bar?: string;
|
|
59
|
+
baz: number | undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
63
|
+
const someType: SomeType = literal;
|
|
64
|
+
const someInterface: SomeInterface = literal;
|
|
65
|
+
|
|
66
|
+
function fn(object: Record<string, unknown>): void {}
|
|
67
|
+
|
|
68
|
+
fn(literal); // Good: literal object type is sealed
|
|
69
|
+
fn(someType); // Good: type is sealed
|
|
70
|
+
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
71
|
+
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
75
|
+
|
|
76
|
+
@category Object
|
|
77
|
+
*/
|
|
78
|
+
export declare type Simplify<AnyType, Options extends SimplifyOptions = {}> = Flatten<AnyType> extends AnyType ? Flatten<AnyType, Options> : AnyType;
|
|
79
|
+
export {};
|
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAElC,+BAAyC;AAEzC,SAAgB,YAAY,CAC3B,OAA4B,EAC5B,GAAc,EACd,gBAA0C;IAE1C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAC5B,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,EAAE;QAClE,IAAI,OAAO,CAAC;QACZ,IAAI,gBAAgB,YAAY,eAAM,EAAE;YACvC,OAAO,GAAG,gBAAgB,CAAC;SAC3B;aAAM,IAAI,gBAAgB,YAAY,SAAG,EAAE;YAC3C,OAAO,GAAG,iBAAW,CAAC;SACtB;aAAM;YACN,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;SACnC;QACD,IAAI,CAAC,CAAC,eAAe,IAAI,GAAG,CAAC,EAAE;YAC9B,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;SAC1B;QACD,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAE,CAAC;QAC7B,GAAG,CAAC,eAAe,CAAE,CAAC,IAAI,CAAC,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC9F,OAAO,GAAG,CAAC;IACZ,CAAC,EACD,EAAE,CACF,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAY,CAAC;KAC3C;IAED,IAAI,CAAC,gBAAgB,EAAE;QACtB,OAAO,MAAiB,CAAC;KACzB;IAED,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE;QACvD,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE;YACjC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;YAC9E,IAAI,CAAC,UAAU,EAAE;gBAChB,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aACzB;SACD;QACD,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,CACS,CAAC;AACd,CAAC;AA5CD,oCA4CC"}
|