shelving 1.68.3 → 1.68.4
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.
|
@@ -38,15 +38,15 @@ function getCollection(firestore, { collection }) {
|
|
|
38
38
|
}
|
|
39
39
|
/** Create a corresponding `QueryReference` from a Query. */
|
|
40
40
|
function getQuery(firestore, ref) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
return firestoreQuery(getCollection(firestore, ref), ...yieldQueryConstraints(ref));
|
|
42
|
+
}
|
|
43
|
+
function* yieldQueryConstraints({ sorts, filters, limit }) {
|
|
43
44
|
for (const { key, direction } of sorts)
|
|
44
|
-
|
|
45
|
+
yield firestoreOrderBy(key === "id" ? ID : key, DIRECTIONS[direction]);
|
|
45
46
|
for (const { operator, key, value } of filters)
|
|
46
|
-
|
|
47
|
+
yield firestoreWhere(key === "id" ? ID : key, OPERATORS[operator], value);
|
|
47
48
|
if (typeof limit === "number")
|
|
48
|
-
|
|
49
|
-
return firestoreQuery(getCollection(firestore, ref), ...constraints);
|
|
49
|
+
yield firestoreLimit(limit);
|
|
50
50
|
}
|
|
51
51
|
function getEntities(snapshot) {
|
|
52
52
|
return snapshot.docs.map(getEntity);
|
|
@@ -37,15 +37,15 @@ function getCollection(firestore, { collection }) {
|
|
|
37
37
|
}
|
|
38
38
|
/** Create a corresponding `QueryReference` from a Query. */
|
|
39
39
|
function getQuery(firestore, ref) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
return firestoreQuery(getCollection(firestore, ref), ...yieldQueryConstraints(ref));
|
|
41
|
+
}
|
|
42
|
+
function* yieldQueryConstraints({ sorts, filters, limit }) {
|
|
42
43
|
for (const { key, direction } of sorts)
|
|
43
|
-
|
|
44
|
+
yield firestoreOrderBy(key === "id" ? ID : key, DIRECTIONS[direction]);
|
|
44
45
|
for (const { operator, key, value } of filters)
|
|
45
|
-
|
|
46
|
+
yield firestoreWhere(key === "id" ? ID : key, OPERATORS[operator], value);
|
|
46
47
|
if (typeof limit === "number")
|
|
47
|
-
|
|
48
|
-
return firestoreQuery(getCollection(firestore, ref), ...constraints);
|
|
48
|
+
yield firestoreLimit(limit);
|
|
49
49
|
}
|
|
50
50
|
function getEntities(snapshot) {
|
|
51
51
|
return snapshot.docs.map(getEntity);
|
package/markup/rules.js
CHANGED
|
@@ -12,7 +12,7 @@ const MATCH_INDENT = /^ {1,2}/gm;
|
|
|
12
12
|
*/
|
|
13
13
|
export const HEADING_RULE = {
|
|
14
14
|
regexp: getLineRegExp(`(#{1,6}) +(${MATCH_LINE.source})`),
|
|
15
|
-
render: ([, prefix = "", children = ""]) => ({ type: `h${prefix.length}`, key: null, props: { children } }),
|
|
15
|
+
render: ([, prefix = "", children = ""]) => ({ type: `h${prefix.length}`, key: null, ref: null, props: { children } }),
|
|
16
16
|
contexts: ["block"],
|
|
17
17
|
childContext: "inline",
|
|
18
18
|
};
|
|
@@ -25,7 +25,7 @@ export const HEADING_RULE = {
|
|
|
25
25
|
*/
|
|
26
26
|
export const HORIZONTAL_RULE = {
|
|
27
27
|
regexp: getLineRegExp(`([${BULLETS}])(?: *\\1){2,}`),
|
|
28
|
-
render: () => ({ type: "hr", key: null, props: {} }),
|
|
28
|
+
render: () => ({ type: "hr", key: null, ref: null, props: {} }),
|
|
29
29
|
contexts: ["block"],
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
@@ -40,7 +40,7 @@ export const UNORDERED_LIST_RULE = {
|
|
|
40
40
|
regexp: getBlockRegExp(`${UNORDERED}(${MATCH_BLOCK.source})`),
|
|
41
41
|
render: ([, list = ""]) => {
|
|
42
42
|
const children = list.split(SPLIT_UL_ITEMS).map(_mapUnorderedItem);
|
|
43
|
-
return { type: "ul", key: null, props: { children } };
|
|
43
|
+
return { type: "ul", key: null, ref: null, props: { children } };
|
|
44
44
|
},
|
|
45
45
|
contexts: ["block", "list"],
|
|
46
46
|
childContext: "list",
|
|
@@ -48,7 +48,7 @@ export const UNORDERED_LIST_RULE = {
|
|
|
48
48
|
const SPLIT_UL_ITEMS = new RegExp(`\\n+${UNORDERED}`, "g");
|
|
49
49
|
const _mapUnorderedItem = (item, key) => {
|
|
50
50
|
const children = item.replace(MATCH_INDENT, "");
|
|
51
|
-
return { type: "li", key, props: { children } };
|
|
51
|
+
return { type: "li", key, ref: null, props: { children } };
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
54
|
* Ordered list.
|
|
@@ -60,7 +60,7 @@ export const ORDERED_LIST_RULE = {
|
|
|
60
60
|
regexp: getBlockRegExp(`(${ORDERED}${MATCH_BLOCK.source})`),
|
|
61
61
|
render: ([, list = ""]) => {
|
|
62
62
|
const children = list.split(SPLIT_OL_ITEMS).map(_mapOrderedItem);
|
|
63
|
-
return { type: "ol", key: null, props: { children } };
|
|
63
|
+
return { type: "ol", key: null, ref: null, props: { children } };
|
|
64
64
|
},
|
|
65
65
|
contexts: ["block", "list"],
|
|
66
66
|
childContext: "list",
|
|
@@ -73,7 +73,7 @@ const _mapOrderedItem = (item, key) => {
|
|
|
73
73
|
.slice(firstSpace + 1)
|
|
74
74
|
.trimStart()
|
|
75
75
|
.replace(MATCH_INDENT, "");
|
|
76
|
-
return { type: "li", key, props: { value, children } };
|
|
76
|
+
return { type: "li", key, ref: null, props: { value, children } };
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Blockquote block.
|
|
@@ -86,6 +86,7 @@ export const BLOCKQUOTE_RULE = {
|
|
|
86
86
|
render: ([, quote = ""]) => ({
|
|
87
87
|
type: "blockquote",
|
|
88
88
|
key: null,
|
|
89
|
+
ref: null,
|
|
89
90
|
props: { children: quote.replace(BLOCKQUOTE_LINES, "") },
|
|
90
91
|
}),
|
|
91
92
|
contexts: ["block", "list"],
|
|
@@ -105,10 +106,12 @@ export const FENCED_CODE_RULE = {
|
|
|
105
106
|
render: ([, , file, children]) => ({
|
|
106
107
|
type: "pre",
|
|
107
108
|
key: null,
|
|
109
|
+
ref: null,
|
|
108
110
|
props: {
|
|
109
111
|
children: {
|
|
110
112
|
type: "code",
|
|
111
113
|
key: null,
|
|
114
|
+
ref: null,
|
|
112
115
|
props: { "data-file": file || undefined, children },
|
|
113
116
|
},
|
|
114
117
|
},
|
|
@@ -121,7 +124,7 @@ export const FENCED_CODE_RULE = {
|
|
|
121
124
|
*/
|
|
122
125
|
export const PARAGRAPH_RULE = {
|
|
123
126
|
regexp: getBlockRegExp(` *(${MATCH_BLOCK.source})`),
|
|
124
|
-
render: ([, children]) => ({ type: `p`, key: null, props: { children } }),
|
|
127
|
+
render: ([, children]) => ({ type: `p`, key: null, ref: null, props: { children } }),
|
|
125
128
|
contexts: ["block"],
|
|
126
129
|
childContext: "inline",
|
|
127
130
|
priority: -10, // Lower precedence than other blocks so it matches last and paragraphs can be broken by other blocks.
|
|
@@ -152,6 +155,7 @@ export const LINK_RULE = {
|
|
|
152
155
|
render: ([, title, href = ""], { rel }) => ({
|
|
153
156
|
type: "a",
|
|
154
157
|
key: null,
|
|
158
|
+
ref: null,
|
|
155
159
|
props: { children: title || formatUrl(href), href, rel },
|
|
156
160
|
}),
|
|
157
161
|
contexts: ["inline", "list"],
|
|
@@ -182,6 +186,7 @@ export const AUTOLINK_RULE = {
|
|
|
182
186
|
render: ([, href = "", title], { rel }) => ({
|
|
183
187
|
type: "a",
|
|
184
188
|
key: null,
|
|
189
|
+
ref: null,
|
|
185
190
|
props: { children: title || formatUrl(href), href, rel },
|
|
186
191
|
}),
|
|
187
192
|
contexts: ["inline", "list"],
|
|
@@ -196,7 +201,7 @@ export const AUTOLINK_RULE = {
|
|
|
196
201
|
*/
|
|
197
202
|
export const CODE_RULE = {
|
|
198
203
|
regexp: getWrapRegExp("`+", MATCH_BLOCK.source),
|
|
199
|
-
render: ([, , children]) => ({ type: "code", key: null, props: { children } }),
|
|
204
|
+
render: ([, , children]) => ({ type: "code", key: null, ref: null, props: { children } }),
|
|
200
205
|
contexts: ["inline", "list"],
|
|
201
206
|
priority: 10, // Higher priority than other inlines so it matches first before e.g. `strong` or `em` (from CommonMark spec: "Code span backticks have higher precedence than any other inline constructs except HTML tags and autolinks.")
|
|
202
207
|
};
|
|
@@ -210,7 +215,7 @@ export const CODE_RULE = {
|
|
|
210
215
|
*/
|
|
211
216
|
export const STRONG_RULE = {
|
|
212
217
|
regexp: getWrapRegExp("\\*+"),
|
|
213
|
-
render: ([, , children]) => ({ type: "strong", key: null, props: { children } }),
|
|
218
|
+
render: ([, , children]) => ({ type: "strong", key: null, ref: null, props: { children } }),
|
|
214
219
|
contexts: ["inline", "list", "link"],
|
|
215
220
|
childContext: "inline",
|
|
216
221
|
};
|
|
@@ -224,7 +229,7 @@ export const STRONG_RULE = {
|
|
|
224
229
|
*/
|
|
225
230
|
export const EMPHASIS_RULE = {
|
|
226
231
|
regexp: getWrapRegExp("_+"),
|
|
227
|
-
render: ([, , children]) => ({ type: "em", key: null, props: { children } }),
|
|
232
|
+
render: ([, , children]) => ({ type: "em", key: null, ref: null, props: { children } }),
|
|
228
233
|
contexts: ["inline", "list", "link"],
|
|
229
234
|
childContext: "inline",
|
|
230
235
|
};
|
|
@@ -238,7 +243,7 @@ export const EMPHASIS_RULE = {
|
|
|
238
243
|
*/
|
|
239
244
|
export const INSERT_RULE = {
|
|
240
245
|
regexp: getWrapRegExp("\\+\\++"),
|
|
241
|
-
render: ([, , children]) => ({ type: "ins", key: null, props: { children } }),
|
|
246
|
+
render: ([, , children]) => ({ type: "ins", key: null, ref: null, props: { children } }),
|
|
242
247
|
contexts: ["inline", "list", "link"],
|
|
243
248
|
childContext: "inline",
|
|
244
249
|
};
|
|
@@ -252,7 +257,7 @@ export const INSERT_RULE = {
|
|
|
252
257
|
*/
|
|
253
258
|
export const DELETE_RULE = {
|
|
254
259
|
regexp: getWrapRegExp("--+|~~+"),
|
|
255
|
-
render: ([, , children]) => ({ type: "del", key: null, props: { children } }),
|
|
260
|
+
render: ([, , children]) => ({ type: "del", key: null, ref: null, props: { children } }),
|
|
256
261
|
contexts: ["inline", "list", "link"],
|
|
257
262
|
childContext: "inline",
|
|
258
263
|
};
|
|
@@ -266,7 +271,7 @@ export const DELETE_RULE = {
|
|
|
266
271
|
*/
|
|
267
272
|
export const LINEBREAK_RULE = {
|
|
268
273
|
regexp: /\n/,
|
|
269
|
-
render: () => ({ type: "br", key: null, props: {} }),
|
|
274
|
+
render: () => ({ type: "br", key: null, ref: null, props: {} }),
|
|
270
275
|
contexts: ["inline", "list", "link"],
|
|
271
276
|
childContext: "inline",
|
|
272
277
|
};
|
package/package.json
CHANGED
|
@@ -5,154 +5,154 @@ import { ThroughProvider } from "./ThroughProvider.js";
|
|
|
5
5
|
/** Provider that logs its operations to the console for debugging purposes. */
|
|
6
6
|
export class DebugProvider extends ThroughProvider {
|
|
7
7
|
getDocument(ref) {
|
|
8
|
-
console.log(`Get
|
|
8
|
+
console.log(`Get ${ref}:`);
|
|
9
9
|
try {
|
|
10
10
|
const result = super.getDocument(ref);
|
|
11
11
|
return isAsync(result)
|
|
12
12
|
? result.then(undefined, reason => {
|
|
13
|
-
console.error(`Error
|
|
13
|
+
console.error(`Error: Get ${ref}:`, reason);
|
|
14
14
|
throw reason;
|
|
15
15
|
})
|
|
16
16
|
: result;
|
|
17
17
|
}
|
|
18
18
|
catch (reason) {
|
|
19
|
-
console.error(`Error
|
|
19
|
+
console.error(`Error: Get ${ref}:`, reason);
|
|
20
20
|
throw reason;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
subscribeDocument(ref, observer) {
|
|
24
|
-
console.log(`Subscribe
|
|
24
|
+
console.log(`Subscribe ${ref}:`);
|
|
25
25
|
return super.subscribeDocument(ref, new DatabaseDebugObserver(ref, observer));
|
|
26
26
|
}
|
|
27
27
|
addDocument(ref, data) {
|
|
28
|
-
console.log(`Add
|
|
28
|
+
console.log(`Add ${ref}:`, data);
|
|
29
29
|
try {
|
|
30
30
|
const result = super.addDocument(ref, data);
|
|
31
31
|
return isAsync(result)
|
|
32
32
|
? result.then(undefined, reason => {
|
|
33
|
-
console.error(`Error
|
|
33
|
+
console.error(`Error: Add ${ref}:`, reason);
|
|
34
34
|
throw reason;
|
|
35
35
|
})
|
|
36
36
|
: result;
|
|
37
37
|
}
|
|
38
38
|
catch (reason) {
|
|
39
|
-
console.error(`Error
|
|
39
|
+
console.error(`Error: Add ${ref}:`, reason);
|
|
40
40
|
throw reason;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
setDocument(ref, data) {
|
|
44
|
-
console.log(`Set
|
|
44
|
+
console.log(`Set ${ref}:`, data);
|
|
45
45
|
try {
|
|
46
46
|
const result = super.setDocument(ref, data);
|
|
47
47
|
return isAsync(result)
|
|
48
48
|
? result.then(undefined, reason => {
|
|
49
|
-
console.error(`Error
|
|
49
|
+
console.error(`Error: Set ${ref}:`, reason);
|
|
50
50
|
throw reason;
|
|
51
51
|
})
|
|
52
52
|
: result;
|
|
53
53
|
}
|
|
54
54
|
catch (reason) {
|
|
55
|
-
console.error(`Error
|
|
55
|
+
console.error(`Error: Set ${ref}:`, reason);
|
|
56
56
|
throw reason;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
updateDocument(ref, update) {
|
|
60
|
-
console.log(`Update
|
|
60
|
+
console.log(`Update ${ref}:`, update.updates);
|
|
61
61
|
try {
|
|
62
62
|
const result = super.updateDocument(ref, update);
|
|
63
63
|
return isAsync(result)
|
|
64
64
|
? result.then(undefined, reason => {
|
|
65
|
-
console.error(`Error
|
|
65
|
+
console.error(`Error: Update ${ref}:`, reason);
|
|
66
66
|
throw reason;
|
|
67
67
|
})
|
|
68
68
|
: result;
|
|
69
69
|
}
|
|
70
70
|
catch (reason) {
|
|
71
|
-
console.error(`Error
|
|
71
|
+
console.error(`Error: Update ${ref}:`, reason);
|
|
72
72
|
throw reason;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
deleteDocument(ref) {
|
|
76
|
-
console.log(`Delete
|
|
76
|
+
console.log(`Delete ${ref}:`);
|
|
77
77
|
try {
|
|
78
78
|
const result = super.deleteDocument(ref);
|
|
79
79
|
return isAsync(result)
|
|
80
80
|
? result.then(undefined, reason => {
|
|
81
|
-
console.error(`Error
|
|
81
|
+
console.error(`Error: Delete ${ref}:`, reason);
|
|
82
82
|
throw reason;
|
|
83
83
|
})
|
|
84
84
|
: result;
|
|
85
85
|
}
|
|
86
86
|
catch (reason) {
|
|
87
|
-
console.error(`Error
|
|
87
|
+
console.error(`Error: Delete ${ref}:`, reason);
|
|
88
88
|
throw reason;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
getQuery(ref) {
|
|
92
|
-
console.log(`Get
|
|
92
|
+
console.log(`Get ${ref}:`);
|
|
93
93
|
try {
|
|
94
94
|
const results = super.getQuery(ref);
|
|
95
95
|
return isAsync(results)
|
|
96
96
|
? results.then(undefined, reason => {
|
|
97
|
-
console.error(`Error
|
|
97
|
+
console.error(`Error: Get ${ref}:`, reason);
|
|
98
98
|
throw reason;
|
|
99
99
|
})
|
|
100
100
|
: results;
|
|
101
101
|
}
|
|
102
102
|
catch (reason) {
|
|
103
|
-
console.error(`Error
|
|
103
|
+
console.error(`Error: Get ${ref}:`, reason);
|
|
104
104
|
throw reason;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
subscribeQuery(ref, observer) {
|
|
108
|
-
console.log(`Subscribe
|
|
108
|
+
console.log(`Subscribe ${ref}:`);
|
|
109
109
|
return super.subscribeQuery(ref, new DatabaseDebugObserver(ref, observer));
|
|
110
110
|
}
|
|
111
111
|
setQuery(ref, data) {
|
|
112
|
-
console.log(`Set
|
|
112
|
+
console.log(`Set ${ref}:`, data);
|
|
113
113
|
try {
|
|
114
114
|
const result = super.setQuery(ref, data);
|
|
115
115
|
return isAsync(result)
|
|
116
116
|
? result.then(undefined, reason => {
|
|
117
|
-
console.error(`Error
|
|
117
|
+
console.error(`Error: Set ${ref}:`, reason);
|
|
118
118
|
throw reason;
|
|
119
119
|
})
|
|
120
120
|
: result;
|
|
121
121
|
}
|
|
122
122
|
catch (reason) {
|
|
123
|
-
console.error(`Error
|
|
123
|
+
console.error(`Error: Set ${ref}:`, reason);
|
|
124
124
|
throw reason;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
updateQuery(ref, update) {
|
|
128
|
-
console.log(`Update
|
|
128
|
+
console.log(`Update ${ref}:`, update.updates);
|
|
129
129
|
try {
|
|
130
130
|
const result = super.updateQuery(ref, update);
|
|
131
131
|
return isAsync(result)
|
|
132
132
|
? result.then(undefined, reason => {
|
|
133
|
-
console.error(`Error
|
|
133
|
+
console.error(`Error: Update ${ref}:`, reason);
|
|
134
134
|
throw reason;
|
|
135
135
|
})
|
|
136
136
|
: result;
|
|
137
137
|
}
|
|
138
138
|
catch (reason) {
|
|
139
|
-
console.error(`Error
|
|
139
|
+
console.error(`Error: Update ${ref}:`, reason);
|
|
140
140
|
throw reason;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
deleteQuery(ref) {
|
|
144
|
-
console.log(`Delete
|
|
144
|
+
console.log(`Delete ${ref}:`);
|
|
145
145
|
try {
|
|
146
146
|
const result = super.deleteQuery(ref);
|
|
147
147
|
return isAsync(result)
|
|
148
148
|
? result.then(undefined, reason => {
|
|
149
|
-
console.error(`Error
|
|
149
|
+
console.error(`Error: Delete ${ref}:`, reason);
|
|
150
150
|
throw reason;
|
|
151
151
|
})
|
|
152
152
|
: result;
|
|
153
153
|
}
|
|
154
154
|
catch (reason) {
|
|
155
|
-
console.error(`Error
|
|
155
|
+
console.error(`Error: Delete ${ref}:`, reason);
|
|
156
156
|
throw reason;
|
|
157
157
|
}
|
|
158
158
|
}
|
package/util/jsx.d.ts
CHANGED