git ssb

0+

Josiah / scuttle-tag



Commit c7c7d67141ccbc5ffab412cec29c91853082a1b4

Pull message saving logic out of patchbay-bookmarks

Josiah Witt committed on 12/10/2017, 3:33:51 PM

Files changed

.gitignoreadded
index.jsadded
package-lock.jsonadded
save/async/save.jsadded
save/obs/save.jsadded
save/obs/struct.jsadded
save/obs/tags.jsadded
save/pull/find.jsadded
.gitignoreView
@@ -1,0 +1,3 @@
1 +node_modules/
2 +.DS_Store
3 +
index.jsView
@@ -1,0 +1,7 @@
1 +const bulk = require('bulk-require')
2 +
3 +const modules = bulk(__dirname, ['!(node_modules|test.js|*.test.js)/**/*.js'], {require: function (module) {
4 + return module.match(/(.*.test.js$)/) ? null : require(module)
5 +}})
6 +
7 +module.exports = modules
package-lock.jsonView
@@ -1,0 +1,698 @@
1 +{
2 + "requires": true,
3 + "lockfileVersion": 1,
4 + "dependencies": {
5 + "ansi-regex": {
6 + "version": "2.1.1",
7 + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
8 + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
9 + },
10 + "ansi-styles": {
11 + "version": "2.2.1",
12 + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
13 + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
14 + },
15 + "babel-code-frame": {
16 + "version": "6.26.0",
17 + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
18 + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
19 + "requires": {
20 + "chalk": "1.1.3",
21 + "esutils": "2.0.2",
22 + "js-tokens": "3.0.2"
23 + }
24 + },
25 + "babel-core": {
26 + "version": "6.26.0",
27 + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
28 + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
29 + "requires": {
30 + "babel-code-frame": "6.26.0",
31 + "babel-generator": "6.26.0",
32 + "babel-helpers": "6.24.1",
33 + "babel-messages": "6.23.0",
34 + "babel-register": "6.26.0",
35 + "babel-runtime": "6.26.0",
36 + "babel-template": "6.26.0",
37 + "babel-traverse": "6.26.0",
38 + "babel-types": "6.26.0",
39 + "babylon": "6.18.0",
40 + "convert-source-map": "1.5.1",
41 + "debug": "2.6.9",
42 + "json5": "0.5.1",
43 + "lodash": "4.17.4",
44 + "minimatch": "3.0.4",
45 + "path-is-absolute": "1.0.1",
46 + "private": "0.1.8",
47 + "slash": "1.0.0",
48 + "source-map": "0.5.7"
49 + }
50 + },
51 + "babel-generator": {
52 + "version": "6.26.0",
53 + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
54 + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
55 + "requires": {
56 + "babel-messages": "6.23.0",
57 + "babel-runtime": "6.26.0",
58 + "babel-types": "6.26.0",
59 + "detect-indent": "4.0.0",
60 + "jsesc": "1.3.0",
61 + "lodash": "4.17.4",
62 + "source-map": "0.5.7",
63 + "trim-right": "1.0.1"
64 + }
65 + },
66 + "babel-helper-call-delegate": {
67 + "version": "6.24.1",
68 + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
69 + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
70 + "requires": {
71 + "babel-helper-hoist-variables": "6.24.1",
72 + "babel-runtime": "6.26.0",
73 + "babel-traverse": "6.26.0",
74 + "babel-types": "6.26.0"
75 + }
76 + },
77 + "babel-helper-get-function-arity": {
78 + "version": "6.24.1",
79 + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
80 + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
81 + "requires": {
82 + "babel-runtime": "6.26.0",
83 + "babel-types": "6.26.0"
84 + }
85 + },
86 + "babel-helper-hoist-variables": {
87 + "version": "6.24.1",
88 + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
89 + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
90 + "requires": {
91 + "babel-runtime": "6.26.0",
92 + "babel-types": "6.26.0"
93 + }
94 + },
95 + "babel-helpers": {
96 + "version": "6.24.1",
97 + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz",
98 + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=",
99 + "requires": {
100 + "babel-runtime": "6.26.0",
101 + "babel-template": "6.26.0"
102 + }
103 + },
104 + "babel-messages": {
105 + "version": "6.23.0",
106 + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
107 + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
108 + "requires": {
109 + "babel-runtime": "6.26.0"
110 + }
111 + },
112 + "babel-plugin-check-es2015-constants": {
113 + "version": "6.22.0",
114 + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
115 + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
116 + "requires": {
117 + "babel-runtime": "6.26.0"
118 + }
119 + },
120 + "babel-plugin-transform-es2015-arrow-functions": {
121 + "version": "6.22.0",
122 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
123 + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
124 + "requires": {
125 + "babel-runtime": "6.26.0"
126 + }
127 + },
128 + "babel-plugin-transform-es2015-block-scoping": {
129 + "version": "6.26.0",
130 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz",
131 + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=",
132 + "requires": {
133 + "babel-runtime": "6.26.0",
134 + "babel-template": "6.26.0",
135 + "babel-traverse": "6.26.0",
136 + "babel-types": "6.26.0",
137 + "lodash": "4.17.4"
138 + }
139 + },
140 + "babel-plugin-transform-es2015-computed-properties": {
141 + "version": "6.24.1",
142 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz",
143 + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=",
144 + "requires": {
145 + "babel-runtime": "6.26.0",
146 + "babel-template": "6.26.0"
147 + }
148 + },
149 + "babel-plugin-transform-es2015-destructuring": {
150 + "version": "6.23.0",
151 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz",
152 + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=",
153 + "requires": {
154 + "babel-runtime": "6.26.0"
155 + }
156 + },
157 + "babel-plugin-transform-es2015-parameters": {
158 + "version": "6.24.1",
159 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz",
160 + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=",
161 + "requires": {
162 + "babel-helper-call-delegate": "6.24.1",
163 + "babel-helper-get-function-arity": "6.24.1",
164 + "babel-runtime": "6.26.0",
165 + "babel-template": "6.26.0",
166 + "babel-traverse": "6.26.0",
167 + "babel-types": "6.26.0"
168 + }
169 + },
170 + "babel-plugin-transform-es2015-shorthand-properties": {
171 + "version": "6.24.1",
172 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz",
173 + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=",
174 + "requires": {
175 + "babel-runtime": "6.26.0",
176 + "babel-types": "6.26.0"
177 + }
178 + },
179 + "babel-plugin-transform-es2015-spread": {
180 + "version": "6.22.0",
181 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz",
182 + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=",
183 + "requires": {
184 + "babel-runtime": "6.26.0"
185 + }
186 + },
187 + "babel-plugin-transform-es2015-template-literals": {
188 + "version": "6.22.0",
189 + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz",
190 + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=",
191 + "requires": {
192 + "babel-runtime": "6.26.0"
193 + }
194 + },
195 + "babel-preset-es2040": {
196 + "version": "1.1.1",
197 + "resolved": "https://registry.npmjs.org/babel-preset-es2040/-/babel-preset-es2040-1.1.1.tgz",
198 + "integrity": "sha1-QIzDNyRwggXHgGZ7kw+njfW8j5Q=",
199 + "requires": {
200 + "babel-plugin-check-es2015-constants": "6.22.0",
201 + "babel-plugin-transform-es2015-arrow-functions": "6.22.0",
202 + "babel-plugin-transform-es2015-block-scoping": "6.26.0",
203 + "babel-plugin-transform-es2015-computed-properties": "6.24.1",
204 + "babel-plugin-transform-es2015-destructuring": "6.23.0",
205 + "babel-plugin-transform-es2015-parameters": "6.24.1",
206 + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
207 + "babel-plugin-transform-es2015-spread": "6.22.0",
208 + "babel-plugin-transform-es2015-template-literals": "6.22.0"
209 + }
210 + },
211 + "babel-register": {
212 + "version": "6.26.0",
213 + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
214 + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
215 + "requires": {
216 + "babel-core": "6.26.0",
217 + "babel-runtime": "6.26.0",
218 + "core-js": "2.5.2",
219 + "home-or-tmp": "2.0.0",
220 + "lodash": "4.17.4",
221 + "mkdirp": "0.5.1",
222 + "source-map-support": "0.4.18"
223 + }
224 + },
225 + "babel-runtime": {
226 + "version": "6.26.0",
227 + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
228 + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
229 + "requires": {
230 + "core-js": "2.5.2",
231 + "regenerator-runtime": "0.11.1"
232 + }
233 + },
234 + "babel-template": {
235 + "version": "6.26.0",
236 + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
237 + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
238 + "requires": {
239 + "babel-runtime": "6.26.0",
240 + "babel-traverse": "6.26.0",
241 + "babel-types": "6.26.0",
242 + "babylon": "6.18.0",
243 + "lodash": "4.17.4"
244 + }
245 + },
246 + "babel-traverse": {
247 + "version": "6.26.0",
248 + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
249 + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
250 + "requires": {
251 + "babel-code-frame": "6.26.0",
252 + "babel-messages": "6.23.0",
253 + "babel-runtime": "6.26.0",
254 + "babel-types": "6.26.0",
255 + "babylon": "6.18.0",
256 + "debug": "2.6.9",
257 + "globals": "9.18.0",
258 + "invariant": "2.2.2",
259 + "lodash": "4.17.4"
260 + }
261 + },
262 + "babel-types": {
263 + "version": "6.26.0",
264 + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
265 + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
266 + "requires": {
267 + "babel-runtime": "6.26.0",
268 + "esutils": "2.0.2",
269 + "lodash": "4.17.4",
270 + "to-fast-properties": "1.0.3"
271 + }
272 + },
273 + "babylon": {
274 + "version": "6.18.0",
275 + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
276 + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ=="
277 + },
278 + "balanced-match": {
279 + "version": "1.0.0",
280 + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
281 + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
282 + },
283 + "brace-expansion": {
284 + "version": "1.1.8",
285 + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
286 + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
287 + "requires": {
288 + "balanced-match": "1.0.0",
289 + "concat-map": "0.0.1"
290 + }
291 + },
292 + "browser-split": {
293 + "version": "0.0.1",
294 + "resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.1.tgz",
295 + "integrity": "sha1-ewl1dPjj6tYG+0Zk5krf3aKYGpM="
296 + },
297 + "bulk-require": {
298 + "version": "1.0.1",
299 + "resolved": "https://registry.npmjs.org/bulk-require/-/bulk-require-1.0.1.tgz",
300 + "integrity": "sha1-yz0DnmmBOaRE/FdLJh1rOyz0TIk=",
301 + "requires": {
302 + "glob": "7.1.2"
303 + }
304 + },
305 + "chalk": {
306 + "version": "1.1.3",
307 + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
308 + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
309 + "requires": {
310 + "ansi-styles": "2.2.1",
311 + "escape-string-regexp": "1.0.5",
312 + "has-ansi": "2.0.0",
313 + "strip-ansi": "3.0.1",
314 + "supports-color": "2.0.0"
315 + }
316 + },
317 + "concat-map": {
318 + "version": "0.0.1",
319 + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
320 + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
321 + },
322 + "convert-source-map": {
323 + "version": "1.5.1",
324 + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz",
325 + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU="
326 + },
327 + "core-js": {
328 + "version": "2.5.2",
329 + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.2.tgz",
330 + "integrity": "sha1-vEZIZW59ydyA19PHu8Fy2W50TmM="
331 + },
332 + "core-util-is": {
333 + "version": "1.0.2",
334 + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
335 + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
336 + },
337 + "debug": {
338 + "version": "2.6.9",
339 + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
340 + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
341 + "requires": {
342 + "ms": "2.0.0"
343 + }
344 + },
345 + "depnest": {
346 + "version": "1.3.0",
347 + "resolved": "https://registry.npmjs.org/depnest/-/depnest-1.3.0.tgz",
348 + "integrity": "sha1-FL2KNh30RdLTT37LNi1sdFcoiVk=",
349 + "requires": {
350 + "es2040": "1.2.6",
351 + "libnested": "1.2.1"
352 + }
353 + },
354 + "detect-indent": {
355 + "version": "4.0.0",
356 + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz",
357 + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=",
358 + "requires": {
359 + "repeating": "2.0.1"
360 + }
361 + },
362 + "es2040": {
363 + "version": "1.2.6",
364 + "resolved": "https://registry.npmjs.org/es2040/-/es2040-1.2.6.tgz",
365 + "integrity": "sha512-+sAm7CSGH2+0NMZqm63huevZVoyk8OwF8lVIdwPcNtvZxX3YIITGiui8bfLYS8oNcgCgHNYO+QsgMafwo1OWwg==",
366 + "requires": {
367 + "babel-core": "6.26.0",
368 + "babel-preset-es2040": "1.1.1",
369 + "through2": "2.0.3"
370 + }
371 + },
372 + "escape-string-regexp": {
373 + "version": "1.0.5",
374 + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
375 + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
376 + },
377 + "esutils": {
378 + "version": "2.0.2",
379 + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
380 + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
381 + },
382 + "fs.realpath": {
383 + "version": "1.0.0",
384 + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
385 + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
386 + },
387 + "glob": {
388 + "version": "7.1.2",
389 + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
390 + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
391 + "requires": {
392 + "fs.realpath": "1.0.0",
393 + "inflight": "1.0.6",
394 + "inherits": "2.0.3",
395 + "minimatch": "3.0.4",
396 + "once": "1.4.0",
397 + "path-is-absolute": "1.0.1"
398 + }
399 + },
400 + "globals": {
401 + "version": "9.18.0",
402 + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
403 + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ=="
404 + },
405 + "has-ansi": {
406 + "version": "2.0.0",
407 + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
408 + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
409 + "requires": {
410 + "ansi-regex": "2.1.1"
411 + }
412 + },
413 + "home-or-tmp": {
414 + "version": "2.0.0",
415 + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
416 + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=",
417 + "requires": {
418 + "os-homedir": "1.0.2",
419 + "os-tmpdir": "1.0.2"
420 + }
421 + },
422 + "inflight": {
423 + "version": "1.0.6",
424 + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
425 + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
426 + "requires": {
427 + "once": "1.4.0",
428 + "wrappy": "1.0.2"
429 + }
430 + },
431 + "inherits": {
432 + "version": "2.0.3",
433 + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
434 + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
435 + },
436 + "invariant": {
437 + "version": "2.2.2",
438 + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz",
439 + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=",
440 + "requires": {
441 + "loose-envify": "1.3.1"
442 + }
443 + },
444 + "ip": {
445 + "version": "1.1.5",
446 + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
447 + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
448 + },
449 + "is-finite": {
450 + "version": "1.0.2",
451 + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
452 + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
453 + "requires": {
454 + "number-is-nan": "1.0.1"
455 + }
456 + },
457 + "is-valid-domain": {
458 + "version": "0.0.5",
459 + "resolved": "https://registry.npmjs.org/is-valid-domain/-/is-valid-domain-0.0.5.tgz",
460 + "integrity": "sha1-SOcDGfy0MAkjbpazf5hDiJzntRM="
461 + },
462 + "isarray": {
463 + "version": "1.0.0",
464 + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
465 + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
466 + },
467 + "js-tokens": {
468 + "version": "3.0.2",
469 + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
470 + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
471 + },
472 + "jsesc": {
473 + "version": "1.3.0",
474 + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz",
475 + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s="
476 + },
477 + "json5": {
478 + "version": "0.5.1",
479 + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
480 + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="
481 + },
482 + "libnested": {
483 + "version": "1.2.1",
484 + "resolved": "https://registry.npmjs.org/libnested/-/libnested-1.2.1.tgz",
485 + "integrity": "sha1-pwo2mxsPqQd0I0TwRfOhHzSv9R8="
486 + },
487 + "lodash": {
488 + "version": "4.17.4",
489 + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
490 + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
491 + },
492 + "loose-envify": {
493 + "version": "1.3.1",
494 + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz",
495 + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=",
496 + "requires": {
497 + "js-tokens": "3.0.2"
498 + }
499 + },
500 + "minimatch": {
501 + "version": "3.0.4",
502 + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
503 + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
504 + "requires": {
505 + "brace-expansion": "1.1.8"
506 + }
507 + },
508 + "minimist": {
509 + "version": "0.0.8",
510 + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
511 + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
512 + },
513 + "mkdirp": {
514 + "version": "0.5.1",
515 + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
516 + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
517 + "requires": {
518 + "minimist": "0.0.8"
519 + }
520 + },
521 + "ms": {
522 + "version": "2.0.0",
523 + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
524 + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
525 + },
526 + "mutant": {
527 + "version": "3.22.1",
528 + "resolved": "https://registry.npmjs.org/mutant/-/mutant-3.22.1.tgz",
529 + "integrity": "sha1-kEh1RvcAs8KKqApD0c99M48wdYE=",
530 + "requires": {
531 + "browser-split": "0.0.1",
532 + "xtend": "4.0.1"
533 + }
534 + },
535 + "number-is-nan": {
536 + "version": "1.0.1",
537 + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
538 + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
539 + },
540 + "once": {
541 + "version": "1.4.0",
542 + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
543 + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
544 + "requires": {
545 + "wrappy": "1.0.2"
546 + }
547 + },
548 + "os-homedir": {
549 + "version": "1.0.2",
550 + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
551 + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
552 + },
553 + "os-tmpdir": {
554 + "version": "1.0.2",
555 + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
556 + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
557 + },
558 + "path-is-absolute": {
559 + "version": "1.0.1",
560 + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
561 + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
562 + },
563 + "private": {
564 + "version": "0.1.8",
565 + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
566 + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg=="
567 + },
568 + "process-nextick-args": {
569 + "version": "1.0.7",
570 + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
571 + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
572 + },
573 + "pull-defer": {
574 + "version": "0.2.2",
575 + "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.2.tgz",
576 + "integrity": "sha1-CIew/7MK8ypW2+z6csFnInHwexM="
577 + },
578 + "pull-stream": {
579 + "version": "3.6.1",
580 + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.1.tgz",
581 + "integrity": "sha1-xcKuSlEkbv7rzGXAQSo9clqSzgA="
582 + },
583 + "readable-stream": {
584 + "version": "2.3.3",
585 + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
586 + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
587 + "requires": {
588 + "core-util-is": "1.0.2",
589 + "inherits": "2.0.3",
590 + "isarray": "1.0.0",
591 + "process-nextick-args": "1.0.7",
592 + "safe-buffer": "5.1.1",
593 + "string_decoder": "1.0.3",
594 + "util-deprecate": "1.0.2"
595 + }
596 + },
597 + "regenerator-runtime": {
598 + "version": "0.11.1",
599 + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
600 + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
601 + },
602 + "repeating": {
603 + "version": "2.0.1",
604 + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
605 + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
606 + "requires": {
607 + "is-finite": "1.0.2"
608 + }
609 + },
610 + "safe-buffer": {
611 + "version": "5.1.1",
612 + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
613 + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
614 + },
615 + "slash": {
616 + "version": "1.0.0",
617 + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
618 + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
619 + },
620 + "source-map": {
621 + "version": "0.5.7",
622 + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
623 + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
624 + },
625 + "source-map-support": {
626 + "version": "0.4.18",
627 + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
628 + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
629 + "requires": {
630 + "source-map": "0.5.7"
631 + }
632 + },
633 + "ssb-ref": {
634 + "version": "2.8.1",
635 + "resolved": "https://registry.npmjs.org/ssb-ref/-/ssb-ref-2.8.1.tgz",
636 + "integrity": "sha1-YCZ8edAYqd6fPC/J2j+xJl+Qvw8=",
637 + "requires": {
638 + "ip": "1.1.5",
639 + "is-valid-domain": "0.0.5"
640 + }
641 + },
642 + "string_decoder": {
643 + "version": "1.0.3",
644 + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
645 + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
646 + "requires": {
647 + "safe-buffer": "5.1.1"
648 + }
649 + },
650 + "strip-ansi": {
651 + "version": "3.0.1",
652 + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
653 + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
654 + "requires": {
655 + "ansi-regex": "2.1.1"
656 + }
657 + },
658 + "supports-color": {
659 + "version": "2.0.0",
660 + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
661 + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
662 + },
663 + "through2": {
664 + "version": "2.0.3",
665 + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
666 + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
667 + "requires": {
668 + "readable-stream": "2.3.3",
669 + "xtend": "4.0.1"
670 + }
671 + },
672 + "to-fast-properties": {
673 + "version": "1.0.3",
674 + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
675 + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc="
676 + },
677 + "trim-right": {
678 + "version": "1.0.1",
679 + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
680 + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM="
681 + },
682 + "util-deprecate": {
683 + "version": "1.0.2",
684 + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
685 + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
686 + },
687 + "wrappy": {
688 + "version": "1.0.2",
689 + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
690 + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
691 + },
692 + "xtend": {
693 + "version": "4.0.1",
694 + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
695 + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
696 + }
697 + }
698 +}
save/async/save.jsView
@@ -1,0 +1,25 @@
1 +const nest = require('depnest')
2 +
3 +exports.gives = nest('save.async.save')
4 +
5 +exports.needs = nest({
6 + 'sbot.async.publish': 'first',
7 + 'keys.sync.id': 'first'
8 +})
9 +
10 +exports.create = function(api) {
11 + return nest('save.async.save', function(data, cb) {
12 + const { messageId, notes, tags } = data
13 + var recps = data.recps
14 + if (recps && recps.length === 0) {
15 + recps = null
16 + }
17 + api.sbot.async.publish({
18 + type: 'about',
19 + about: messageId,
20 + recps,
21 + notes,
22 + tags
23 + }, cb)
24 + })
25 +}
save/obs/save.jsView
@@ -1,0 +1,28 @@
1 +const nest = require('depnest')
2 +const pull = require('pull-stream')
3 +const ref = require('ssb-ref')
4 +const { computed } = require('mutant')
5 +
6 +exports.needs = nest({
7 + 'about.obs.latestValue': 'first',
8 + 'about.obs.valueFrom': 'first',
9 + 'save.obs.struct': 'first'
10 +})
11 +
12 +exports.gives = nest('save.obs.save')
13 +
14 +exports.create = function(api) {
15 + return nest('save.obs.save', function(messageId, id) {
16 + if (!ref.isLink(messageId)) throw new Error('an id must be specified')
17 +
18 + const { latestValue, valueFrom } = api.about.obs
19 +
20 + const save = api.save.obs.struct({
21 + notes: latestValue(messageId, 'notes'),
22 + tags: valueFrom(messageId, 'tags', id),
23 + recps: latestValue(messageId, 'recps')
24 + })
25 +
26 + return save
27 + })
28 +}
save/obs/struct.jsView
@@ -1,0 +1,36 @@
1 +const nest = require('depnest')
2 +const { Value, Set, Struct, forEachPair } = require('mutant')
3 +
4 +exports.needs = nest({
5 + 'save.async.save': 'first'
6 +})
7 +
8 +exports.gives = nest('save.obs.struct')
9 +
10 +exports.create = function(api) {
11 + return nest('save.obs.struct', function(opts = {}) {
12 + const struct = Struct({
13 + notes: Value(''),
14 + tags: Set([]),
15 + recps: Set([])
16 + })
17 +
18 + Object.keys(opts).forEach(k => {
19 + if (!opts[k]) return
20 +
21 + if (typeof opts[k] === 'function') struct[k] = opts[k]
22 + else struct[k].set(opts[k])
23 + })
24 +
25 + struct.save = id => {
26 + api.save.async.save({
27 + recps: struct.recps(),
28 + messageId: id,
29 + notes: struct.notes(),
30 + tags: struct.tags()
31 + }, console.log)
32 + }
33 +
34 + return struct
35 + })
36 +}
save/obs/tags.jsView
@@ -1,0 +1,112 @@
1 +var {Value, computed} = require('mutant')
2 +var pull = require('pull-stream')
3 +var nest = require('depnest')
4 +var ref = require('ssb-ref')
5 +
6 +exports.needs = nest({
7 + 'sbot.pull.stream': 'first',
8 + 'keys.sync.id': 'first'
9 +})
10 +
11 +exports.gives = nest({
12 + 'save.obs': [
13 + 'taggedMessages',
14 + 'tagsFrom'
15 + ]
16 +})
17 +
18 +exports.create = function (api) {
19 + var syncValue = Value(false)
20 + var sync = computed(syncValue, x => x)
21 + var cache = null
22 +
23 + return nest({
24 + 'save.obs': {
25 + taggedMessages,
26 + tagsFrom
27 + }
28 + })
29 +
30 + function taggedMessages (author, key) {
31 + if (!ref.isLink(author)) throw new Error('Requires an ssb ref!')
32 + return withSync(computed([get(author), key], getTaggedMessages))
33 + }
34 +
35 + function tagsFrom (author) {
36 + if (!ref.isLink(author)) throw new Error('Requires an ssb ref!')
37 + return withSync(computed([get(author)], getTagsFrom))
38 + }
39 +
40 + function withSync (obs) {
41 + obs.sync = sync
42 + return obs
43 + }
44 +
45 + function get (author) {
46 + if (!ref.isLink(author)) throw new Error('Requires an ssb ref!')
47 + load()
48 + if (!cache[author]) {
49 + cache[author] = Value({})
50 + }
51 + return cache[author]
52 + }
53 +
54 + function load () {
55 + if (!cache) {
56 + cache = {}
57 + pull(
58 + api.sbot.pull.stream(sbot => sbot.about.tagsStream({ live: true })),
59 + pull.drain(item => {
60 + for (var author in item) {
61 + var state = get(author)
62 + var lastState = state()
63 + var tags = item[author]['tags']
64 + var changes = false
65 + for (var tag in tags) {
66 + var msgsForTag = lastState[tag] = lastState[tag] || {}
67 + for (var msg in tags[tag]) {
68 + var timestamp = tags[tag][msg]
69 + if (!msgsForTag[msg] || timestamp > msgsForTag[msg]) {
70 + msgsForTag[msg] = timestamp
71 + changed = true
72 + }
73 + }
74 + }
75 + if (changed) {
76 + state.set(lastState)
77 + }
78 + }
79 + if (!syncValue()) {
80 + syncValue.set(true)
81 + }
82 + })
83 + )
84 + }
85 + }
86 +}
87 +
88 +function getTaggedMessages(lookup, key) {
89 + const messages = [];
90 + for(const msg in lookup[key]) {
91 + if (lookup[key][msg]) {
92 + messages.push(msg)
93 + }
94 + }
95 + return messages
96 +}
97 +
98 +function getTagsFrom(lookup) {
99 + const tags = []
100 + for (const tag in lookup) {
101 + var valid = false
102 + for (const msg in lookup[tag]) {
103 + if (lookup[tag][msg]) {
104 + valid = true
105 + }
106 + }
107 + if (valid) {
108 + tags.push(tag)
109 + }
110 + }
111 + return tags
112 +}
save/pull/find.jsView
@@ -1,0 +1,30 @@
1 +const nest = require('depnest')
2 +const defer = require('pull-defer')
3 +const pull = require('pull-stream')
4 +const onceTrue = require('mutant/once-true')
5 +
6 +exports.gives = nest('save.pull.find')
7 +
8 +exports.needs = nest({
9 + 'sbot.obs.connection': 'first'
10 +})
11 +
12 +exports.create = function(api) {
13 + return nest({ 'save.pull.find': find })
14 +
15 + function find(opts) {
16 + return StreamWhenConnected(api.sbot.obs.connection, (sbot) => {
17 + if (!sbot.about || !sbot.about.tagsStream) return pull.empty()
18 + return sbot.about.tagsStream(opts)
19 + })
20 + }
21 +}
22 +
23 +// COPIED from patchcore 'feed.pull.private'
24 +function StreamWhenConnected (connection, fn) {
25 + var stream = defer.source()
26 + onceTrue(connection, function (connection) {
27 + stream.resolve(fn(connection))
28 + })
29 + return stream
30 +}

Built with git-ssb-web