@instantdb/admin 0.22.99-experimental.add-user-perm-rules.20792844601.1 → 0.22.99-experimental.add-user-perm-rules.20792984656.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/dist/commonjs/__types__/typesTests.js +63 -82
- package/dist/commonjs/__types__/typesTests.js.map +1 -1
- package/dist/commonjs/index.js +472 -453
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/subscribe.js +17 -19
- package/dist/commonjs/subscribe.js.map +1 -1
- package/dist/esm/__types__/typesTests.js +63 -82
- package/dist/esm/__types__/typesTests.js.map +1 -1
- package/dist/esm/index.js +472 -453
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/subscribe.js +17 -19
- package/dist/esm/subscribe.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const index_ts_1 = require("../index.js");
|
|
13
4
|
const schema = index_ts_1.i.schema({
|
|
@@ -18,90 +9,80 @@ const schema = index_ts_1.i.schema({
|
|
|
18
9
|
}),
|
|
19
10
|
},
|
|
20
11
|
});
|
|
21
|
-
function _testUseDatesTest() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
useDateObjects: true,
|
|
27
|
-
});
|
|
28
|
-
const data = yield db.query({ tbl: {} });
|
|
29
|
-
const item = data === null || data === void 0 ? void 0 : data.tbl[0];
|
|
30
|
-
if (item) {
|
|
31
|
-
}
|
|
12
|
+
async function _testUseDatesTest() {
|
|
13
|
+
const db = (0, index_ts_1.init)({
|
|
14
|
+
schema,
|
|
15
|
+
appId: '123',
|
|
16
|
+
useDateObjects: true,
|
|
32
17
|
});
|
|
18
|
+
const data = await db.query({ tbl: {} });
|
|
19
|
+
const item = data?.tbl[0];
|
|
20
|
+
if (item) {
|
|
21
|
+
}
|
|
33
22
|
}
|
|
34
|
-
function _testUseDatesFalseTest() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
useDateObjects: false,
|
|
40
|
-
});
|
|
41
|
-
const data = yield db.query({ tbl: {} });
|
|
42
|
-
const item = data === null || data === void 0 ? void 0 : data.tbl[0];
|
|
43
|
-
if (item) {
|
|
44
|
-
}
|
|
23
|
+
async function _testUseDatesFalseTest() {
|
|
24
|
+
const db = (0, index_ts_1.init)({
|
|
25
|
+
schema,
|
|
26
|
+
appId: '123',
|
|
27
|
+
useDateObjects: false,
|
|
45
28
|
});
|
|
29
|
+
const data = await db.query({ tbl: {} });
|
|
30
|
+
const item = data?.tbl[0];
|
|
31
|
+
if (item) {
|
|
32
|
+
}
|
|
46
33
|
}
|
|
47
|
-
function _testUseDatesUndefinedTest() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
appId: '123',
|
|
52
|
-
});
|
|
53
|
-
const data = yield db.query({ tbl: {} });
|
|
54
|
-
const item = data === null || data === void 0 ? void 0 : data.tbl[0];
|
|
55
|
-
if (item) {
|
|
56
|
-
}
|
|
34
|
+
async function _testUseDatesUndefinedTest() {
|
|
35
|
+
const db = (0, index_ts_1.init)({
|
|
36
|
+
schema,
|
|
37
|
+
appId: '123',
|
|
57
38
|
});
|
|
39
|
+
const data = await db.query({ tbl: {} });
|
|
40
|
+
const item = data?.tbl[0];
|
|
41
|
+
if (item) {
|
|
42
|
+
}
|
|
58
43
|
}
|
|
59
|
-
function _testDataNoSchema() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
appId: '123',
|
|
63
|
-
});
|
|
64
|
-
const data = yield db.query({ tbl: {} });
|
|
65
|
-
const item = data === null || data === void 0 ? void 0 : data.tbl[0];
|
|
66
|
-
if (item) {
|
|
67
|
-
}
|
|
44
|
+
async function _testDataNoSchema() {
|
|
45
|
+
const db = (0, index_ts_1.init)({
|
|
46
|
+
appId: '123',
|
|
68
47
|
});
|
|
48
|
+
const data = await db.query({ tbl: {} });
|
|
49
|
+
const item = data?.tbl[0];
|
|
50
|
+
if (item) {
|
|
51
|
+
}
|
|
69
52
|
}
|
|
70
|
-
function _testSubscribe() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (item) {
|
|
80
|
-
}
|
|
53
|
+
async function _testSubscribe() {
|
|
54
|
+
// No useDateObjects
|
|
55
|
+
(0, index_ts_1.init)({
|
|
56
|
+
appId: '123',
|
|
57
|
+
schema,
|
|
58
|
+
}).subscribeQuery({ tbl: {} }, (payload) => {
|
|
59
|
+
if (payload.type === 'ok') {
|
|
60
|
+
const item = payload.data.tbl[0];
|
|
61
|
+
if (item) {
|
|
81
62
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// UseDateObjects
|
|
66
|
+
(0, index_ts_1.init)({
|
|
67
|
+
appId: '123',
|
|
68
|
+
schema,
|
|
69
|
+
useDateObjects: true,
|
|
70
|
+
}).subscribeQuery({ tbl: {} }, (payload) => {
|
|
71
|
+
if (payload.type === 'ok') {
|
|
72
|
+
const item = payload.data.tbl[0];
|
|
73
|
+
if (item) {
|
|
93
74
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// No schema
|
|
78
|
+
(0, index_ts_1.init)({
|
|
79
|
+
appId: '123',
|
|
80
|
+
}).subscribeQuery({ tbl: {} }, (payload) => {
|
|
81
|
+
if (payload.type === 'ok') {
|
|
82
|
+
const item = payload.data.tbl[0];
|
|
83
|
+
if (item) {
|
|
103
84
|
}
|
|
104
|
-
}
|
|
85
|
+
}
|
|
105
86
|
});
|
|
106
87
|
}
|
|
107
88
|
//# sourceMappingURL=typesTests.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typesTests.js","sourceRoot":"","sources":["../../../src/__types__/typesTests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typesTests.js","sourceRoot":"","sources":["../../../src/__types__/typesTests.ts"],"names":[],"mappings":";;AACA,0CAAsC;AAEtC,MAAM,MAAM,GAAG,YAAC,CAAC,MAAM,CAAC;IACtB,QAAQ,EAAE;QACR,GAAG,EAAE,YAAC,CAAC,MAAM,CAAC;YACZ,CAAC,EAAE,YAAC,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE;YACrB,SAAS,EAAE,YAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC;KACH;CACF,CAAC,CAAC;AAEH,KAAK,UAAU,iBAAiB;IAC9B,MAAM,EAAE,GAAG,IAAA,eAAI,EAAC;QACd,MAAM;QACN,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,IAAI;KACrB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,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,MAAM;KACP,CAAC,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,IAAI,EAAE,CAAC;YAMX,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,iBAAiB;IACjB,IAAA,eAAI,EAAC;QACH,KAAK,EAAE,KAAK;QACZ,MAAM;QACN,cAAc,EAAE,IAAI;KACrB,CAAC,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,IAAI,EAAE,CAAC;YAMX,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY;IACZ,IAAA,eAAI,EAAC;QACH,KAAK,EAAE,KAAK;KACb,CAAC,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,IAAI,EAAE,CAAC;YAMX,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Equal, Expect, IsAny, NotAny } from './typeUtils.ts';\nimport { i, init } from '../index.ts';\n\nconst schema = i.schema({\n entities: {\n tbl: i.entity({\n d: i.date().indexed(),\n dOptional: i.date().optional(),\n }),\n },\n});\n\nasync function _testUseDatesTest() {\n const db = init({\n schema,\n appId: '123',\n useDateObjects: true,\n });\n\n const data = await db.query({ tbl: {} });\n const item = data?.tbl[0];\n if (item) {\n type t = typeof item.d;\n type _cases = [Expect<NotAny<t>>, Expect<Equal<t, Date>>];\n\n type tOpt = typeof item.dOptional;\n type _cases_2 = [\n Expect<NotAny<tOpt>>,\n Expect<Equal<tOpt, Date | undefined>>,\n ];\n }\n}\n\nasync function _testUseDatesFalseTest() {\n const db = init({\n schema,\n appId: '123',\n useDateObjects: false,\n });\n\n const data = await db.query({ tbl: {} });\n const item = data?.tbl[0];\n if (item) {\n type t = typeof item.d;\n type _cases = [Expect<NotAny<t>>, Expect<Equal<t, string | number>>];\n\n type tOpt = typeof item.dOptional;\n type _cases_2 = [\n Expect<NotAny<tOpt>>,\n Expect<Equal<tOpt, string | number | undefined>>,\n ];\n }\n}\n\nasync function _testUseDatesUndefinedTest() {\n const db = init({\n schema,\n appId: '123',\n });\n\n const data = await db.query({ tbl: {} });\n const item = data?.tbl[0];\n if (item) {\n type t = typeof item.d;\n type _cases = [Expect<NotAny<t>>, Expect<Equal<t, string | number>>];\n\n type tOpt = typeof item.dOptional;\n type _cases_2 = [\n Expect<NotAny<tOpt>>,\n Expect<Equal<tOpt, string | number | undefined>>,\n ];\n }\n}\n\nasync function _testDataNoSchema() {\n const db = init({\n appId: '123',\n });\n\n const data = await db.query({ tbl: {} });\n const item = data?.tbl[0];\n if (item) {\n type t = typeof item.d;\n type _cases = [Expect<IsAny<t>>, Expect<Equal<typeof item.id, string>>];\n }\n}\n\nasync function _testSubscribe() {\n // No useDateObjects\n init({\n appId: '123',\n schema,\n }).subscribeQuery({ tbl: {} }, (payload) => {\n if (payload.type === 'ok') {\n const item = payload.data.tbl[0];\n if (item) {\n type _cases = [\n Expect<Equal<typeof item.id, string>>,\n Expect<Equal<typeof item.d, string | number>>,\n Expect<Equal<typeof item.dOptional, string | number | undefined>>,\n ];\n }\n }\n });\n\n // UseDateObjects\n init({\n appId: '123',\n schema,\n useDateObjects: true,\n }).subscribeQuery({ tbl: {} }, (payload) => {\n if (payload.type === 'ok') {\n const item = payload.data.tbl[0];\n if (item) {\n type _cases = [\n Expect<Equal<typeof item.id, string>>,\n Expect<Equal<typeof item.d, Date>>,\n Expect<Equal<typeof item.dOptional, Date | undefined>>,\n ];\n }\n }\n });\n\n // No schema\n init({\n appId: '123',\n }).subscribeQuery({ tbl: {} }, (payload) => {\n if (payload.type === 'ok') {\n const item = payload.data.tbl[0];\n if (item) {\n type _cases = [\n Expect<Equal<typeof item.id, string>>,\n Expect<IsAny<typeof item.d>>,\n Expect<IsAny<typeof item.dOptional>>,\n ];\n }\n }\n });\n}\n"]}
|