Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ee1fca8
Merge remote-tracking branch 'upstream/main'
asampal Dec 21, 2021
b3c2a69
Merge remote-tracking branch 'upstream/main'
asampal Dec 22, 2021
0b62e57
Merge remote-tracking branch 'upstream/main'
asampal Dec 22, 2021
ad98382
Merge remote-tracking branch 'upstream/main'
asampal Dec 23, 2021
877f24a
Merge remote-tracking branch 'upstream/main'
asampal Dec 23, 2021
1e85dbe
Merge remote-tracking branch 'upstream/main'
asampal Dec 25, 2021
f676a38
Merge remote-tracking branch 'upstream/main'
asampal Dec 26, 2021
189f73a
Merge remote-tracking branch 'upstream/main'
asampal Dec 27, 2021
695d914
Merge remote-tracking branch 'upstream/main'
asampal Dec 27, 2021
4728ccb
Merge remote-tracking branch 'upstream/main'
asampal Dec 27, 2021
11a43e2
Merge remote-tracking branch 'upstream/main'
asampal Dec 28, 2021
92c63f8
Merge remote-tracking branch 'upstream/main'
asampal Dec 28, 2021
e3e1908
Merge remote-tracking branch 'upstream/main'
asampal Dec 29, 2021
0392f93
Merge remote-tracking branch 'upstream/main'
asampal Jan 1, 2022
ed0a5f1
Merge remote-tracking branch 'upstream/main'
asampal Jan 2, 2022
b842b78
Merge remote-tracking branch 'upstream/main'
asampal Jan 3, 2022
7173540
Merge remote-tracking branch 'upstream/main'
asampal Jan 4, 2022
ba6a4a6
Merge remote-tracking branch 'upstream/main'
asampal Jan 7, 2022
274cb31
Merge remote-tracking branch 'upstream/main'
asampal Jan 8, 2022
9c9a320
Merge remote-tracking branch 'upstream/main'
asampal Jan 8, 2022
c722d78
Merge remote-tracking branch 'upstream/main'
asampal Jan 11, 2022
490bd94
Merge remote-tracking branch 'upstream/main'
asampal Jan 12, 2022
b4c823f
Merge remote-tracking branch 'upstream/main'
asampal Jan 12, 2022
423815e
Merge remote-tracking branch 'upstream/main'
asampal Jan 13, 2022
fb1b8c2
Merge remote-tracking branch 'upstream/main'
asampal Jan 13, 2022
b81b268
Merge remote-tracking branch 'upstream/main'
asampal Jan 14, 2022
13f823a
Merge remote-tracking branch 'upstream/main'
asampal Jan 15, 2022
ca859f7
Merge remote-tracking branch 'upstream/main'
asampal Jan 15, 2022
01b6258
Merge remote-tracking branch 'upstream/main'
asampal Jan 18, 2022
36012d4
Merge remote-tracking branch 'upstream/main'
asampal Jan 20, 2022
3f3dba5
Merge remote-tracking branch 'upstream/main'
asampal Jan 22, 2022
fd46f9b
Merge remote-tracking branch 'upstream/main'
asampal Jan 23, 2022
700c89e
Merge remote-tracking branch 'upstream/main'
asampal Jan 23, 2022
cffb1f7
Merge remote-tracking branch 'upstream/main'
asampal Jan 24, 2022
b64012c
Merge remote-tracking branch 'upstream/main'
asampal Jan 25, 2022
7bbd2b9
Merge remote-tracking branch 'upstream/main'
asampal Jan 26, 2022
5be6711
Merge remote-tracking branch 'upstream/main'
asampal Jan 27, 2022
7a64c92
Update Node and TypeScript dependencies
asampal Jan 27, 2022
59be34c
Merge branch 'main' into main
thesophiaxu Feb 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hints": {
"no-inline-styles": [ "warning", {
"requireNoStyleElement": false
}]
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"diff": "lerna diff"
},
"engines": {
"node": ">=16.0.0",
"node": ">=16.13.0",
"npm": "^8.1.2"
},
"devDependencies": {
Expand Down Expand Up @@ -65,7 +65,7 @@
"prettier": "^2.5.1",
"run-script-os": "^1.1.6",
"ts-jest": "^26.5.2",
"typescript": "^4.2.2"
"typescript": "^4.5.4"
},
"dependencies": {
"eslint-plugin-inclusive-language": "^2.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { Readability, isProbablyReaderable } = require('@mozilla/readability');
const { JSDOM } = require('jsdom');
const fetch = require('node-fetch');
const AbortController = require('abort-controller');

const controller = new AbortController();
const timeout = setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/unigraph-dev-backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/unigraph-dev-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "dist/index.js",
"engines": {
"node": ">=16.0.0",
"node": ">=16.13.0",
"npm": "^8.1.2"
},
"scripts": {
Expand All @@ -22,17 +22,17 @@
"@types/express-ws": "^3.0.0",
"@types/google-protobuf": "^3.7.3",
"@types/lodash": "^4.14.165",
"@types/node": "^12.11",
"@types/node": "^16.11.7",
"@types/node-cron": "^2.0.3",
"typescript": "^4.2.2"
"typescript": "^4.5.4"
},
"dependencies": {
"@babel/core": "^7.14.8",
"@babel/preset-react": "^7.14.5",
"@mozilla/readability": "^0.4.1",
"@tsconfig/node16": "^1.0.2",
"@types/async-lock": "^1.1.2",
"@types/node-fetch": "^2.5.8",
"abort-controller": "^3.0.0",
"@types/node-fetch": "^2.5.12",
"async-lock": "^1.2.8",
"dgraph-js": "^20.3.1",
"express": "^4.17.1",
Expand All @@ -45,7 +45,7 @@
"luxon": "^2.0.2",
"mailparser": "^3.2.0",
"node-cron": "^3.0.0",
"node-fetch": "^2.6.1",
"node-fetch": "^2.6.7",
"oauth": "^0.9.15",
"rrule": "^2.6.8",
"rss-parser": "^3.12.0",
Expand Down
15 changes: 12 additions & 3 deletions packages/unigraph-dev-backend/src/dgraphClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import AsyncLock from 'async-lock';
import dgraph, { DgraphClient as ActualDgraphClient, DgraphClientStub, Operation, Mutation, Check } from 'dgraph-js';
import { getRandomInt } from 'unigraph-dev-common/lib/utils/utils';
import dns from 'dns';
import fetch from 'node-fetch';
import { getAsyncLock, withLock } from './asyncManager';
import { perfLogStartDbTransaction, perfLogAfterDbTransaction } from './logging';
Expand All @@ -12,6 +13,12 @@ export type UnigraphUpsert = {
appends: any[];
};

export type UUIDRange = {
startId: string;
endId: string;
readOnly: string;
};

// eslint-disable-next-line inclusive-language/use-inclusive-words
/**
* Example client, adapted from:
Expand Down Expand Up @@ -46,14 +53,16 @@ export default class DgraphClient {
this.txnlock = getAsyncLock();
}

async leaseUids(num = 256) {
async leaseUids(num = 256): Promise<UUIDRange> {
// Make DNS lookups return results in the same order that a system resolver or
// DNS server would wrt IPv4 vs IPv6 addresses.
dns.setDefaultResultOrder('verbatim');
const res = await fetch(`http://${this.connectionUri}:${this.ports.zero}/assign?what=uids&num=${num}`);
if (res.status !== 200) {
console.log(res);
throw new Error(`Could not lease ${num} uids from Dgraph`);
}
const json = await res.json();
return json;
return (await res.json()) as Promise<UUIDRange>;
}

async getStatus() {
Expand Down
6 changes: 3 additions & 3 deletions packages/unigraph-dev-backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import fetch from 'node-fetch';
import _, { uniqueId } from 'lodash';
import { Unigraph } from 'unigraph-dev-common/lib/types/unigraph';
import stringify from 'json-stable-stringify';
import DgraphClient from './dgraphClient';
import DgraphClient, { UUIDRange } from './dgraphClient';
import {
EventAddBacklinks,
EventAddNotification,
Expand Down Expand Up @@ -132,8 +132,8 @@ export default async function startServer(client: DgraphClient) {

const checkLeasedUid = async () => {
if (serverStates?.leasedUids?.length < 8192) {
const lease = await dgraphClient.leaseUids(8192);
for (let i = parseInt(lease.startId, 10); i < parseInt(lease.endId, 10); i += 1) {
const uuidRange: UUIDRange = await dgraphClient.leaseUids(8192);
for (let i = parseInt(uuidRange.startId, 10); i < parseInt(uuidRange.endId, 10); i += 1) {
serverStates.leasedUids.push(`0x${i.toString(16)}`);
}
}
Expand Down
10 changes: 7 additions & 3 deletions packages/unigraph-dev-backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"compilerOptions": {
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16",
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"lib": ["ESNext", "WebWorker"],
"forceConsistentCasingInFileNames": true,
"lib": ["es2021", "WebWorker"],
"module": "CommonJS",
"moduleResolution": "node",
"outDir": "dist",
"paths": {
"@/*": ["./src/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ES2017",
"target": "es2021",
"typeRoots": ["src/custom.d.ts", "node_modules/@types"]
},
"include": ["src"]
Expand Down
2 changes: 1 addition & 1 deletion packages/unigraph-dev-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prepare": "tsc"
},
"devDependencies": {
"typescript": "^4.2.2"
"typescript": "^4.5.4"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/unigraph-dev-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"ts-pnp": "1.2.0",
"turndown": "^7.1.1",
"typeface-roboto": "^1.1.13",
"typescript": "^4.2.2",
"typescript": "^4.5.4",
"unigraph-dev-common": "^0.0.1",
"url-loader": "4.1.1",
"uuid": "^8.3.2",
Expand All @@ -104,7 +104,7 @@
"@types/jest": "^24.0.0",
"@types/jquery": "^3.5.5",
"@types/lodash": "^4.14.165",
"@types/node": "^12.0.0",
"@types/node": "^16.11.7",
"@types/react": "^17.0.1",
"@types/react-dom": "^17.0.1",
"@types/react-router-dom": "^5.1.6",
Expand Down
5 changes: 4 additions & 1 deletion packages/unigraph-dev-explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"compilerOptions": {
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Create React App",

"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
Expand Down
54 changes: 42 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,11 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@tsconfig/node16@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e"
integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==

"@tweenjs/tween.js@^18.6.4":
version "18.6.4"
resolved "https://registry.yarnpkg.com/@tweenjs/tween.js/-/tween.js-18.6.4.tgz#40a3d0a93647124872dec8e0fd1bd5926695b6ca"
Expand Down Expand Up @@ -4326,10 +4331,10 @@
dependencies:
"@types/tz-offset" "*"

"@types/node-fetch@^2.5.8":
version "2.5.10"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.10.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132"
integrity sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ==
"@types/node-fetch@^2.5.12":
version "2.5.12"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
dependencies:
"@types/node" "*"
form-data "^3.0.0"
Expand All @@ -4344,10 +4349,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615"
integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==

"@types/node@^12.0.0", "@types/node@^12.11":
version "12.20.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.10.tgz#4dcb8a85a8f1211acafb88d72fafc7e3d2685583"
integrity sha512-TxCmnSSppKBBOzYzPR2BR25YlX5Oay8z2XGwFBInuA/Co0V9xJhLlW4kjbxKtgeNo3NOMbQP1A5Rc03y+XecPw==
"@types/node@^16.11.7":
version "16.11.21"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.21.tgz#474d7589a30afcf5291f59bd49cca9ad171ffde4"
integrity sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==

"@types/normalize-package-data@^2.4.0":
version "2.4.0"
Expand Down Expand Up @@ -13614,6 +13619,13 @@ node-fetch@2.6.1, node-fetch@^2.3.0, node-fetch@^2.6.1:
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==

node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

node-forge@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
Expand Down Expand Up @@ -18213,6 +18225,11 @@ tr46@^2.1.0:
dependencies:
punycode "^2.1.1"

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=

trim-newlines@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
Expand Down Expand Up @@ -18431,10 +18448,10 @@ typeface-roboto@^1.1.13:
resolved "https://registry.yarnpkg.com/typeface-roboto/-/typeface-roboto-1.1.13.tgz#9c4517cb91e311706c74823e857b4bac9a764ae5"
integrity sha512-YXvbd3a1QTREoD+FJoEkl0VQNJoEjewR2H11IjVv4bp6ahuIcw0yyw/3udC4vJkHw3T3cUh85FTg8eWef3pSaw==

typescript@^4.2.2:
version "4.2.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961"
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
typescript@^4.5.4:
version "4.5.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3"
integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==

ua-parser-js@^0.7.18:
version "0.7.28"
Expand Down Expand Up @@ -19058,6 +19075,11 @@ web-namespaces@^2.0.0:
resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-2.0.1.tgz#1010ff7c650eccb2592cebeeaf9a1b253fd40692"
integrity sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=

webidl-conversions@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
Expand Down Expand Up @@ -19204,6 +19226,14 @@ whatwg-mimetype@^2.3.0:
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

whatwg-url@^8.0.0, whatwg-url@^8.5.0:
version "8.5.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.5.0.tgz#7752b8464fc0903fec89aa9846fc9efe07351fd3"
Expand Down