@instantdb/react 0.22.73-experimental.fix-use-dates.19710508282.1 → 0.22.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instantdb/react",
3
- "version": "0.22.73-experimental.fix-use-dates.19710508282.1",
3
+ "version": "0.22.73",
4
4
  "description": "Instant DB for React",
5
5
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/react",
6
6
  "repository": {
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "eventsource": "^4.0.0",
57
- "@instantdb/version": "0.22.73-experimental.fix-use-dates.19710508282.1",
58
- "@instantdb/react-common": "0.22.73-experimental.fix-use-dates.19710508282.1",
59
- "@instantdb/core": "0.22.73-experimental.fix-use-dates.19710508282.1"
57
+ "@instantdb/core": "0.22.73",
58
+ "@instantdb/version": "0.22.73",
59
+ "@instantdb/react-common": "0.22.73"
60
60
  },
61
61
  "scripts": {
62
62
  "test": "vitest",
@@ -4,11 +4,10 @@ import { EventSource } from 'eventsource';
4
4
 
5
5
  export default class InstantReactWebDatabase<
6
6
  Schema extends InstantSchemaDef<any, any, any>,
7
- UseDates extends boolean = false,
8
- Config extends InstantConfig<Schema, UseDates> = InstantConfig<
7
+ Config extends InstantConfig<Schema, boolean> = InstantConfig<
9
8
  Schema,
10
- UseDates
9
+ boolean
11
10
  >,
12
- > extends InstantReactAbstractDatabase<Schema, UseDates, Config> {
11
+ > extends InstantReactAbstractDatabase<Schema, Config> {
13
12
  static EventSourceImpl = EventSource;
14
13
  }
package/src/init.ts CHANGED
@@ -31,21 +31,14 @@ export function init<
31
31
  Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,
32
32
  UseDates extends boolean = false,
33
33
  >(
34
- config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
35
- useDateObjects?: UseDates;
36
- },
37
- ): InstantReactWebDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>> {
38
- const configStrict = {
39
- ...config,
40
- useDateObjects: (config.useDateObjects ?? false) as UseDates,
41
- };
42
- return new InstantReactWebDatabase<
43
- Schema,
44
- UseDates,
45
- InstantConfig<Schema, UseDates>
46
- >(configStrict, {
47
- '@instantdb/react': version,
48
- });
34
+ config: InstantConfig<Schema, UseDates>,
35
+ ): InstantReactWebDatabase<Schema, InstantConfig<Schema, UseDates>> {
36
+ return new InstantReactWebDatabase<Schema, InstantConfig<Schema, UseDates>>(
37
+ config,
38
+ {
39
+ '@instantdb/react': version,
40
+ },
41
+ );
49
42
  }
50
43
 
51
44
  /**
@@ -1,91 +0,0 @@
1
- import type {
2
- Equal,
3
- Expect,
4
- IsAny,
5
- NotAny,
6
- } from '../../../core/__tests__/src/typeUtils.ts';
7
- import { i, init } from '../../src/index.ts';
8
-
9
- const schema = i.schema({
10
- entities: {
11
- tbl: i.entity({
12
- d: i.date().indexed(),
13
- dOptional: i.date().optional(),
14
- }),
15
- },
16
- });
17
-
18
- function _testUseDatesTest() {
19
- const db = init({
20
- schema,
21
- appId: '123',
22
- useDateObjects: true,
23
- });
24
-
25
- const { data } = db.useQuery({ tbl: {} });
26
- const item = data?.tbl[0];
27
- if (item) {
28
- type t = typeof item.d;
29
- type _cases = [Expect<NotAny<t>>, Expect<Equal<t, Date>>];
30
-
31
- type tOpt = typeof item.dOptional;
32
- type _cases_2 = [
33
- Expect<NotAny<tOpt>>,
34
- Expect<Equal<tOpt, Date | undefined>>,
35
- ];
36
- }
37
- }
38
-
39
- function _testUseDatesFalseTest() {
40
- const db = init({
41
- schema,
42
- appId: '123',
43
- useDateObjects: false,
44
- });
45
-
46
- const { data } = db.useQuery({ tbl: {} });
47
- const item = data?.tbl[0];
48
- if (item) {
49
- type t = typeof item.d;
50
- type _cases = [Expect<NotAny<t>>, Expect<Equal<t, string | number>>];
51
-
52
- type tOpt = typeof item.dOptional;
53
- type _cases_2 = [
54
- Expect<NotAny<tOpt>>,
55
- Expect<Equal<tOpt, string | number | undefined>>,
56
- ];
57
- }
58
- }
59
-
60
- function _testUseDatesUndefinedTest() {
61
- const db = init({
62
- schema,
63
- appId: '123',
64
- });
65
-
66
- const { data } = db.useQuery({ tbl: {} });
67
- const item = data?.tbl[0];
68
- if (item) {
69
- type t = typeof item.d;
70
- type _cases = [Expect<NotAny<t>>, Expect<Equal<t, string | number>>];
71
-
72
- type tOpt = typeof item.dOptional;
73
- type _cases_2 = [
74
- Expect<NotAny<tOpt>>,
75
- Expect<Equal<tOpt, string | number | undefined>>,
76
- ];
77
- }
78
- }
79
-
80
- function _testX() {
81
- const db = init({
82
- appId: '123',
83
- });
84
-
85
- const { data } = db.useQuery({ tbl: {} });
86
- const item = data?.tbl[0];
87
- if (item) {
88
- type t = typeof item.d;
89
- type _cases = [Expect<IsAny<t>>, Expect<Equal<typeof item.id, string>>];
90
- }
91
- }