Skip to content

Commit 42e66c3

Browse files
authored
Merge pull request #550 from SolidOS/chat-thread-proof
Chat thread with proof
2 parents 9d930db + 17f11db commit 42e66c3

23 files changed

+1841
-27382
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.14.0
1+
v18.19.0

jest-environment-jsdom.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { TextEncoder, TextDecoder } = require('util')
2+
const JSDOMEnvironmentBase = require('jest-environment-jsdom')
3+
4+
Object.defineProperty(exports, '__esModule', {
5+
value: true,
6+
})
7+
8+
class JSDOMEnvironment extends JSDOMEnvironmentBase {
9+
constructor(...args) {
10+
const { global } = super(...args)
11+
global.TextEncoder = TextEncoder
12+
global.TextDecoder = TextDecoder
13+
global.Uint8Array = Uint8Array
14+
}
15+
}
16+
17+
exports.default = JSDOMEnvironment
18+
exports.TestEnvironment = JSDOMEnvironment;

jest.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
module.exports = {
22
verbose: true,
3-
testEnvironment: 'jsdom',
3+
// https://github.com/paralleldrive/cuid2/issues/44#issuecomment-1531731695
4+
testEnvironment: './jest-environment-jsdom.js', // had to extend; see https://github.com/jsdom/jsdom/issues/2524
45
testMatch: [
56
'**/?(*.)+(spec|test).[tj]s?(x)' ],
67
setupFilesAfterEnv: [
78
'./test/helpers/setup.ts'
8-
]
9+
],
10+
transformIgnorePatterns: ["/node_modules/(?!lit-html).+\\.js"],
11+
testEnvironmentOptions: {
12+
customExportConditions: ['node']
13+
}
14+
915
}

package-lock.json

Lines changed: 1274 additions & 26915 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solid-ui",
3-
"version": "2.4.32",
3+
"version": "2.4.33-beta4",
44
"description": "UI library for writing Solid read-write-web applications",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
@@ -55,29 +55,28 @@
5555
},
5656
"homepage": "https://github.com/solidos/solid-ui",
5757
"dependencies": {
58-
"@noble/curves": "^1.2.0",
58+
"@noble/curves": "^1.4.0",
5959
"acorn": "^7.4.1",
6060
"escape-html": "^1.0.3",
6161
"eslint-plugin-n": "^15.7.0",
6262
"i": "^0.3.7",
6363
"mime-types": "^2.1.35",
6464
"npm": "^8.19.4",
65-
"pane-registry": "^2.4.25",
66-
"rdflib": "^2.2.33",
67-
"solid-logic": "^3.0.6",
65+
"pane-registry": "^2.4.26",
66+
"solid-logic": "^3.0.7",
6867
"solid-namespace": "^0.5.3",
6968
"uuid": "^8.3.2"
7069
},
7170
"devDependencies": {
72-
"@babel/cli": "^7.23.4",
73-
"@babel/core": "^7.23.5",
71+
"@babel/cli": "^7.24.1",
72+
"@babel/core": "^7.24.3",
7473
"@babel/plugin-proposal-class-properties": "^7.18.6",
7574
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
76-
"@babel/plugin-transform-async-to-generator": "^7.23.3",
77-
"@babel/plugin-transform-runtime": "^7.23.4",
78-
"@babel/preset-env": "^7.23.5",
79-
"@babel/preset-typescript": "^7.23.3",
80-
"@babel/runtime": "^7.23.5",
75+
"@babel/plugin-transform-async-to-generator": "^7.24.1",
76+
"@babel/plugin-transform-runtime": "^7.24.3",
77+
"@babel/preset-env": "^7.24.3",
78+
"@babel/preset-typescript": "^7.24.1",
79+
"@babel/runtime": "^7.24.1",
8180
"@mdx-js/react": "^2.3.0",
8281
"@storybook/addon-actions": "6.5.16",
8382
"@storybook/addon-docs": "6.5.16",
@@ -90,34 +89,35 @@
9089
"@testing-library/user-event": "^13.5.0",
9190
"@types/jest": "^27.5.2",
9291
"@types/jsdom": "^16.2.15",
93-
"@types/node": "^18.19.1",
94-
"@types/react": "^17.0.71",
92+
"@types/node": "^18.19.26",
93+
"@types/react": "^17.0.79",
9594
"@typescript-eslint/eslint-plugin": "^5.62.0",
9695
"@typescript-eslint/parser": "^5.62.0",
9796
"babel-loader": "^8.3.0",
9897
"crypto": "^1.0.1",
99-
"eslint": "^8.54.0",
98+
"eslint": "^8.57.0",
10099
"eslint-config-standard": "^17.1.0",
101100
"eslint-import-resolver-typescript": "^2.7.1",
102-
"eslint-plugin-import": "^2.29.0",
101+
"eslint-plugin-import": "^2.29.1",
103102
"eslint-plugin-jest": "^26.9.0",
104103
"eslint-plugin-node": "^11.1.0",
105104
"eslint-plugin-promise": "^6.1.1",
106105
"get-random-values": "^2.1.0",
107-
"html-webpack-plugin": "^5.5.3",
106+
"html-webpack-plugin": "^5.6.0",
108107
"husky": "^7.0.4",
109108
"isomorphic-fetch": "^3.0.0",
110109
"jest": "^27.5.1",
111-
"jsdom": "^19.0.0",
110+
"jest-environment-jsdom": "^27.5.1",
111+
"jsdom": "^16.7.0",
112112
"lint-staged": "^12.5.0",
113-
"nock": "^13.4.0",
113+
"nock": "^13.5.4",
114114
"react": "^17.0.2",
115115
"react-dom": "^17.0.2",
116116
"react-is": "^17.0.2",
117117
"ts-jest": "^27.1.5",
118-
"typedoc": "^0.25.4",
118+
"typedoc": "^0.25.12",
119119
"typescript": "^4.9.5",
120-
"webpack": "^5.89.0",
120+
"webpack": "^5.91.0",
121121
"webpack-cli": "^4.10.0"
122122
},
123123
"optionalDependencies": {

src/chat/bookmarks.js

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @packageDocumentation
44
*/
55

6-
/* global alert confirm */
76
import * as debug from '../debug'
87
import { icons } from '../iconBase'
98
import { media } from '../media/index'
@@ -25,53 +24,6 @@ const BOOKMARK_ICON = 'noun_45961.svg'
2524
const label = utils.label
2625
const dom = window.document || null
2726

28-
/** Create a resource if it really does not exist
29-
* Be absolutely sure something does not exist before creating a new empty file
30-
* as otherwise existing could be deleted.
31-
* @param doc {NamedNode} - The resource
32-
*/
33-
function createIfNotExists (doc) {
34-
return new Promise(function (resolve, reject) {
35-
store.fetcher.load(doc).then(
36-
response => {
37-
debug.log('createIfNotExists doc exists, all good ' + doc)
38-
// store.fetcher.webOperation('HEAD', doc.uri).then(response => {
39-
resolve(response)
40-
},
41-
err => {
42-
if (err.response.status === 404) {
43-
debug.log(
44-
'createIfNotExists doc does NOT exist, will create... ' + doc
45-
)
46-
47-
store.fetcher
48-
.webOperation('PUT', doc.uri, {
49-
data: '',
50-
contentType: 'text/turtle'
51-
})
52-
.then(
53-
response => {
54-
// fetcher.requested[doc.uri] = 'done' // do not need to read ?? but no headers
55-
delete store.fetcher.requested[doc.uri] // delete cached 404 error
56-
debug.log('createIfNotExists doc created ok ' + doc)
57-
resolve(response)
58-
},
59-
err => {
60-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)
61-
reject(err)
62-
}
63-
)
64-
} else {
65-
debug.log(
66-
'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err
67-
)
68-
reject(err)
69-
}
70-
}
71-
)
72-
})
73-
}
74-
7527
// @@@@ use the one in rdflib.js when it is avaiable and delete this
7628
function updatePromise (del, ins) {
7729
return new Promise(function (resolve, reject) {
@@ -99,7 +51,8 @@ export async function findBookmarkDocument (userContext) {
9951
if (userContext.instances && userContext.instances.length > 0) {
10052
userContext.bookmarkDocument = userContext.instances[0]
10153
if (userContext.instances.length > 1) {
102-
alert('More than one bookmark file! ' + userContext.instances)
54+
debug.warn('More than one bookmark file! ' + userContext.instances) // @@ todo - deal with > 1
55+
// Note: should pick up community bookmarks as well
10356
}
10457
} else {
10558
if (userContext.publicProfile) {
@@ -109,9 +62,9 @@ export async function findBookmarkDocument (userContext) {
10962
)
11063
try {
11164
debug.log('Creating new bookmark file ' + newBookmarkFile)
112-
await createIfNotExists(newBookmarkFile)
65+
await store.fetcher.createIfNotExists(newBookmarkFile)
11366
} catch (e) {
114-
alert.error("Can't make fresh bookmark file:" + e)
67+
debug.warn("Can't make fresh bookmark file:" + e)
11568
return userContext
11669
}
11770
await registerInTypeIndex(
@@ -121,7 +74,7 @@ export async function findBookmarkDocument (userContext) {
12174
)
12275
userContext.bookmarkDocument = newBookmarkFile
12376
} else {
124-
alert('You seem to have no bookmark file and not even a profile file.')
77+
debug.warn('You seem to have no bookmark file, nor even a profile file!')
12578
}
12679
}
12780
return userContext
@@ -164,7 +117,7 @@ async function addBookmark (context, target) {
164117
await updatePromise([], ins) // 20190118A
165118
} catch (e) {
166119
const msg = 'Making bookmark: ' + e
167-
alert.error(msg)
120+
debug.warn(msg)
168121
return null
169122
}
170123
return bookmark
@@ -188,7 +141,7 @@ export async function toggleBookmark (userContext, target, bookmarkButton) {
188141
debug.log('Bookmark deleted: ' + bookmarks[i])
189142
} catch (e) {
190143
debug.error('Cant delete bookmark:' + e)
191-
alert('Cant delete bookmark:' + e)
144+
debug.warn('Cannot delete bookmark:' + e)
192145
}
193146
}
194147
} else {

0 commit comments

Comments
 (0)