@instantdb/react 0.22.72 → 0.22.73-experimental.fix-use-dates.19710580517.1
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/__tests__/src/typesTests.ts +91 -0
- package/dist/commonjs/InstantReactWebDatabase.d.ts +1 -1
- package/dist/commonjs/InstantReactWebDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactWebDatabase.js.map +1 -1
- package/dist/commonjs/init.d.ts +3 -1
- package/dist/commonjs/init.d.ts.map +1 -1
- package/dist/commonjs/init.js +3 -1
- package/dist/commonjs/init.js.map +1 -1
- package/dist/esm/InstantReactWebDatabase.d.ts +1 -1
- package/dist/esm/InstantReactWebDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactWebDatabase.js.map +1 -1
- package/dist/esm/init.d.ts +3 -1
- package/dist/esm/init.d.ts.map +1 -1
- package/dist/esm/init.js +3 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/standalone/index.js +14 -12
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +4 -4
- package/src/InstantReactWebDatabase.ts +4 -3
- package/src/init.ts +15 -8
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InstantConfig, InstantSchemaDef } from '@instantdb/core';
|
|
2
2
|
import { InstantReactAbstractDatabase } from '@instantdb/react-common';
|
|
3
3
|
import { EventSource } from 'eventsource';
|
|
4
|
-
export default class InstantReactWebDatabase<Schema extends InstantSchemaDef<any, any, any>, Config extends InstantConfig<Schema,
|
|
4
|
+
export default class InstantReactWebDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean = false, Config extends InstantConfig<Schema, UseDates> = InstantConfig<Schema, UseDates>> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {
|
|
5
5
|
static EventSourceImpl: typeof EventSource;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=InstantReactWebDatabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstantReactWebDatabase.d.ts","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,uBAAuB,CAC1C,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"InstantReactWebDatabase.d.ts","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,uBAAuB,CAC1C,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,SAAS,OAAO,GAAG,KAAK,EAChC,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,aAAa,CAC5D,MAAM,EACN,QAAQ,CACT,CACD,SAAQ,4BAA4B,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC9D,MAAM,CAAC,eAAe,qBAAe;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstantReactWebDatabase.js","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":";;AACA,0DAAuE;AACvE,6CAA0C;AAE1C,MAAqB,
|
|
1
|
+
{"version":3,"file":"InstantReactWebDatabase.js","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":";;AACA,0DAAuE;AACvE,6CAA0C;AAE1C,MAAqB,uBAOnB,SAAQ,2CAAsD;;AACvD,uCAAe,GAAG,yBAAW,CAAC;kBARlB,uBAAuB","sourcesContent":["import type { InstantConfig, InstantSchemaDef } from '@instantdb/core';\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\nimport { EventSource } from 'eventsource';\n\nexport default class InstantReactWebDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n Config extends InstantConfig<Schema, UseDates> = InstantConfig<\n Schema,\n UseDates\n >,\n> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {\n static EventSourceImpl = EventSource;\n}\n"]}
|
package/dist/commonjs/init.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ import InstantReactWebDatabase from './InstantReactWebDatabase.ts';
|
|
|
20
20
|
*
|
|
21
21
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
22
22
|
*/
|
|
23
|
-
export declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: InstantConfig<Schema, UseDates>
|
|
23
|
+
export declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
24
|
+
useDateObjects?: UseDates;
|
|
25
|
+
}): InstantReactWebDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>>;
|
|
24
26
|
/**
|
|
25
27
|
* @deprecated
|
|
26
28
|
* `init_experimental` is deprecated. You can replace it with `init`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,GAAG;IAChE,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC3B,GACA,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAY5E;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,aAAO,CAAC"}
|
package/dist/commonjs/init.js
CHANGED
|
@@ -28,7 +28,9 @@ const version_ts_1 = __importDefault(require("./version.js"));
|
|
|
28
28
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
29
29
|
*/
|
|
30
30
|
function init(config) {
|
|
31
|
-
|
|
31
|
+
var _a;
|
|
32
|
+
const configStrict = Object.assign(Object.assign({}, config), { useDateObjects: ((_a = config.useDateObjects) !== null && _a !== void 0 ? _a : false) });
|
|
33
|
+
return new InstantReactWebDatabase_ts_1.default(configStrict, {
|
|
32
34
|
'@instantdb/react': version_ts_1.default,
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;;;;AA6BA,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;;;;AA6BA,oBAmBC;AA1CD,8FAAmE;AACnE,8DAAmC;AAEnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,IAAI,CAIlB,MAEC;;IAED,MAAM,YAAY,mCACb,MAAM,KACT,cAAc,EAAE,CAAC,MAAA,MAAM,CAAC,cAAc,mCAAI,KAAK,CAAa,GAC7D,CAAC;IACF,OAAO,IAAI,oCAAuB,CAIhC,YAAY,EAAE;QACd,kBAAkB,EAAE,oBAAO;KAC5B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC","sourcesContent":["import type {\n InstantConfig,\n InstantSchemaDef,\n InstantUnknownSchema,\n} from '@instantdb/core';\n\nimport InstantReactWebDatabase from './InstantReactWebDatabase.ts';\nimport version from './version.ts';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/react\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/react\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nexport function init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): InstantReactWebDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>> {\n const configStrict = {\n ...config,\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n return new InstantReactWebDatabase<\n Schema,\n UseDates,\n InstantConfig<Schema, UseDates>\n >(configStrict, {\n '@instantdb/react': version,\n });\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/react\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/react\"\n * const db = init({ ... });\n */\nexport const init_experimental = init;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InstantConfig, InstantSchemaDef } from '@instantdb/core';
|
|
2
2
|
import { InstantReactAbstractDatabase } from '@instantdb/react-common';
|
|
3
3
|
import { EventSource } from 'eventsource';
|
|
4
|
-
export default class InstantReactWebDatabase<Schema extends InstantSchemaDef<any, any, any>, Config extends InstantConfig<Schema,
|
|
4
|
+
export default class InstantReactWebDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean = false, Config extends InstantConfig<Schema, UseDates> = InstantConfig<Schema, UseDates>> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {
|
|
5
5
|
static EventSourceImpl: typeof EventSource;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=InstantReactWebDatabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstantReactWebDatabase.d.ts","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,uBAAuB,CAC1C,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"InstantReactWebDatabase.d.ts","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,uBAAuB,CAC1C,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,SAAS,OAAO,GAAG,KAAK,EAChC,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,aAAa,CAC5D,MAAM,EACN,QAAQ,CACT,CACD,SAAQ,4BAA4B,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC9D,MAAM,CAAC,eAAe,qBAAe;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstantReactWebDatabase.js","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAqB,
|
|
1
|
+
{"version":3,"file":"InstantReactWebDatabase.js","sourceRoot":"","sources":["../../src/InstantReactWebDatabase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAqB,uBAOnB,SAAQ,4BAAsD;;AACvD,uCAAe,GAAG,WAAW,CAAC;eARlB,uBAAuB","sourcesContent":["import type { InstantConfig, InstantSchemaDef } from '@instantdb/core';\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\nimport { EventSource } from 'eventsource';\n\nexport default class InstantReactWebDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n Config extends InstantConfig<Schema, UseDates> = InstantConfig<\n Schema,\n UseDates\n >,\n> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {\n static EventSourceImpl = EventSource;\n}\n"]}
|
package/dist/esm/init.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ import InstantReactWebDatabase from './InstantReactWebDatabase.ts';
|
|
|
20
20
|
*
|
|
21
21
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
22
22
|
*/
|
|
23
|
-
export declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: InstantConfig<Schema, UseDates>
|
|
23
|
+
export declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
|
|
24
|
+
useDateObjects?: UseDates;
|
|
25
|
+
}): InstantReactWebDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>>;
|
|
24
26
|
/**
|
|
25
27
|
* @deprecated
|
|
26
28
|
* `init_experimental` is deprecated. You can replace it with `init`.
|
package/dist/esm/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,GAAG;IAChE,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC3B,GACA,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAY5E;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,aAAO,CAAC"}
|
package/dist/esm/init.js
CHANGED
|
@@ -21,7 +21,9 @@ import version from "./version.js";
|
|
|
21
21
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
22
22
|
*/
|
|
23
23
|
export function init(config) {
|
|
24
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
const configStrict = Object.assign(Object.assign({}, config), { useDateObjects: ((_a = config.useDateObjects) !== null && _a !== void 0 ? _a : false) });
|
|
26
|
+
return new InstantReactWebDatabase(configStrict, {
|
|
25
27
|
'@instantdb/react': version,
|
|
26
28
|
});
|
|
27
29
|
}
|
package/dist/esm/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,IAAI,CAIlB,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,IAAI,CAIlB,MAEC;;IAED,MAAM,YAAY,mCACb,MAAM,KACT,cAAc,EAAE,CAAC,MAAA,MAAM,CAAC,cAAc,mCAAI,KAAK,CAAa,GAC7D,CAAC;IACF,OAAO,IAAI,uBAAuB,CAIhC,YAAY,EAAE;QACd,kBAAkB,EAAE,OAAO;KAC5B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC","sourcesContent":["import type {\n InstantConfig,\n InstantSchemaDef,\n InstantUnknownSchema,\n} from '@instantdb/core';\n\nimport InstantReactWebDatabase from './InstantReactWebDatabase.ts';\nimport version from './version.ts';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/react\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/react\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nexport function init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): InstantReactWebDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>> {\n const configStrict = {\n ...config,\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n return new InstantReactWebDatabase<\n Schema,\n UseDates,\n InstantConfig<Schema, UseDates>\n >(configStrict, {\n '@instantdb/react': version,\n });\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/react\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/react\"\n * const db = init({ ... });\n */\nexport const init_experimental = init;\n"]}
|
package/dist/standalone/index.js
CHANGED
|
@@ -3550,7 +3550,7 @@ function Nr(t) {
|
|
|
3550
3550
|
}, e;
|
|
3551
3551
|
}, {});
|
|
3552
3552
|
}
|
|
3553
|
-
const Bn = "v0.22.
|
|
3553
|
+
const Bn = "v0.22.73-experimental.fix-use-dates.19710580517.1";
|
|
3554
3554
|
function fu(t, e) {
|
|
3555
3555
|
return {
|
|
3556
3556
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -6153,11 +6153,12 @@ function fc(t, e) {
|
|
|
6153
6153
|
return ei(t._reactor.config.schema) !== ei(e);
|
|
6154
6154
|
}
|
|
6155
6155
|
function lc(t, e, n, r, i) {
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6156
|
+
var s;
|
|
6157
|
+
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[wn(o)];
|
|
6158
|
+
if (a)
|
|
6159
|
+
return fc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
|
|
6160
|
+
const u = new Ku(Object.assign(Object.assign(Object.assign({}, ic), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), d = new dc(u);
|
|
6161
|
+
return mn[wn(o)] = d, hc(o.appId, o.devtool), d;
|
|
6161
6162
|
}
|
|
6162
6163
|
function hc(t, e) {
|
|
6163
6164
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -7388,12 +7389,13 @@ const Qn = class Qn extends Cc {
|
|
|
7388
7389
|
Qn.EventSourceImpl = kt;
|
|
7389
7390
|
let In = Qn;
|
|
7390
7391
|
function xc(t) {
|
|
7391
|
-
|
|
7392
|
-
t,
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7392
|
+
const e = {
|
|
7393
|
+
...t,
|
|
7394
|
+
useDateObjects: t.useDateObjects ?? !1
|
|
7395
|
+
};
|
|
7396
|
+
return new In(e, {
|
|
7397
|
+
"@instantdb/react": Bn
|
|
7398
|
+
});
|
|
7397
7399
|
}
|
|
7398
7400
|
const qc = xc;
|
|
7399
7401
|
function Wc({
|