Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'alpha' of github.com:withspectrum/spectrum into 3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed Apr 26, 2019
2 parents 926a466 + 47dd013 commit ff9b121
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 38 deletions.
3 changes: 2 additions & 1 deletion analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"amplitude": "^3.5.0",
"aws-sdk": "^2.426.0",
"aws-sdk": "^2.439.0",
"bull": "3.3.10",
"datadog-metrics": "^0.8.1",
"debug": "^4.1.1",
Expand All @@ -17,6 +17,7 @@
"performance-now": "^2.1.0",
"raven": "^2.6.4",
"redis-tag-cache": "^1.2.1",
"rethinkdb-changefeed-reconnect": "^0.3.2",
"rethinkdb-inspector": "^0.3.3",
"rethinkdbdash": "^2.3.31",
"rethinkhaberdashery": "^2.3.32",
Expand Down
33 changes: 29 additions & 4 deletions analytics/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=

aws-sdk@^2.426.0:
version "2.426.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.426.0.tgz#cf17361c987daf518f945218f06135fbc1a3690d"
integrity sha512-S4nmIhF/6iYeVEmKUWVG03zo1sw3zELoAPGqBKIZ3isrXbxkFXdP2cgIQxqi37zwWXSqaxt0xjeXVOMLzN6vSg==
aws-sdk@^2.439.0:
version "2.439.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.439.0.tgz#4a1d177507ef80b0b515c043938d814777645c40"
integrity sha512-u7hCAMzpWbD6BqAwVHxr3cbm4YSbs0yv4crr7+bR/peM+UB6AbQLJFjFXx73dnIZq3R0Hr1bA7nh2Z9jkQLUdQ==
dependencies:
buffer "4.9.1"
events "1.1.1"
Expand All @@ -29,6 +29,14 @@ aws-sdk@^2.426.0:
uuid "3.3.2"
xml2js "0.4.19"

babel-runtime@^6.18.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4=
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"

base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
Expand Down Expand Up @@ -103,6 +111,11 @@ cookiejar@^2.1.0:
resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c"
integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==

core-js@^2.4.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
Expand Down Expand Up @@ -573,6 +586,18 @@ redis-tag-cache@^1.2.1:
dependencies:
ioredis "^4.0.0"

regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==

rethinkdb-changefeed-reconnect@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/rethinkdb-changefeed-reconnect/-/rethinkdb-changefeed-reconnect-0.3.2.tgz#2999f5313205ab35d9ac2d1b0533765ee3376923"
integrity sha1-KZn1MTIFqzXZrC0bBTN2XuM3aSM=
dependencies:
babel-runtime "^6.18.0"

rethinkdb-inspector@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/rethinkdb-inspector/-/rethinkdb-inspector-0.3.3.tgz#f0d88c66d17e0234b5518ca51cd8c272cb787003"
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"rethinkdb-migrate": "^1.4.0",
"rethinkhaberdashery": "^2.3.32",
"sanitize-filename": "^1.6.1",
"serialize-javascript": "^1.6.1",
"serialize-javascript": "^1.7.0",
"session-rethinkdb": "^2.0.0",
"slate": "^0.44.12",
"slate-markdown": "0.1.0",
Expand Down
8 changes: 4 additions & 4 deletions api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8698,10 +8698,10 @@ serialize-javascript@^1.4.0:
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.5.0.tgz#1aa336162c88a890ddad5384baebc93a655161fe"
integrity sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==

serialize-javascript@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.6.1.tgz#4d1f697ec49429a847ca6f442a2a755126c4d879"
integrity sha512-A5MOagrPFga4YaKQSWHryl7AXvbQkEqpw4NNYMTNYUNV51bA8ABHgYFpqKx+YFFrw59xMV1qGH1R4AgoNIVgCw==
serialize-javascript@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.7.0.tgz#d6e0dfb2a3832a8c94468e6eb1db97e55a192a65"
integrity sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA==

[email protected]:
version "1.13.2"
Expand Down
3 changes: 2 additions & 1 deletion athena/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"start": "NODE_ENV=production node main.js"
},
"dependencies": {
"aws-sdk": "^2.426.0",
"aws-sdk": "^2.439.0",
"axios": "^0.16.2",
"bull": "3.3.10",
"cryptr": "^3.0.0",
Expand All @@ -26,6 +26,7 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"redis-tag-cache": "^1.2.1",
"rethinkdb-changefeed-reconnect": "^0.3.2",
"rethinkdb-inspector": "^0.3.3",
"rethinkdbdash": "^2.3.31",
"rethinkhaberdashery": "^2.3.32",
Expand Down
33 changes: 29 additions & 4 deletions athena/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ asn1.js@^5.0.0:
inherits "^2.0.1"
minimalistic-assert "^1.0.0"

aws-sdk@^2.426.0:
version "2.426.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.426.0.tgz#cf17361c987daf518f945218f06135fbc1a3690d"
integrity sha512-S4nmIhF/6iYeVEmKUWVG03zo1sw3zELoAPGqBKIZ3isrXbxkFXdP2cgIQxqi37zwWXSqaxt0xjeXVOMLzN6vSg==
aws-sdk@^2.439.0:
version "2.439.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.439.0.tgz#4a1d177507ef80b0b515c043938d814777645c40"
integrity sha512-u7hCAMzpWbD6BqAwVHxr3cbm4YSbs0yv4crr7+bR/peM+UB6AbQLJFjFXx73dnIZq3R0Hr1bA7nh2Z9jkQLUdQ==
dependencies:
buffer "4.9.1"
events "1.1.1"
Expand All @@ -46,6 +46,14 @@ axios@^0.16.2:
follow-redirects "^1.2.3"
is-buffer "^1.1.5"

babel-runtime@^6.18.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4=
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"

base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
Expand Down Expand Up @@ -121,6 +129,11 @@ core-js@^1.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=

core-js@^2.4.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

crc@^3.5.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6"
Expand Down Expand Up @@ -767,6 +780,18 @@ redis-tag-cache@^1.2.1:
dependencies:
ioredis "^4.0.0"

regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==

rethinkdb-changefeed-reconnect@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/rethinkdb-changefeed-reconnect/-/rethinkdb-changefeed-reconnect-0.3.2.tgz#2999f5313205ab35d9ac2d1b0533765ee3376923"
integrity sha1-KZn1MTIFqzXZrC0bBTN2XuM3aSM=
dependencies:
babel-runtime "^6.18.0"

rethinkdb-inspector@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/rethinkdb-inspector/-/rethinkdb-inspector-0.3.3.tgz#f0d88c66d17e0234b5518ca51cd8c272cb787003"
Expand Down
1 change: 1 addition & 0 deletions chronos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"performance-now": "^2.1.0",
"raven": "^2.6.4",
"redis-tag-cache": "^1.2.1",
"rethinkdb-changefeed-reconnect": "^0.3.2",
"rethinkdb-inspector": "^0.3.3",
"rethinkdbdash": "^2.3.31",
"rethinkhaberdashery": "^2.3.32",
Expand Down
25 changes: 25 additions & 0 deletions chronos/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ aws-sdk@^2.426.0:
uuid "3.3.2"
xml2js "0.4.19"

babel-runtime@^6.18.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4=
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"

base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
Expand Down Expand Up @@ -90,6 +98,11 @@ core-js@^1.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=

core-js@^2.4.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

crc@^3.5.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6"
Expand Down Expand Up @@ -710,6 +723,18 @@ redis-tag-cache@^1.2.1:
dependencies:
ioredis "^4.0.0"

regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==

rethinkdb-changefeed-reconnect@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/rethinkdb-changefeed-reconnect/-/rethinkdb-changefeed-reconnect-0.3.2.tgz#2999f5313205ab35d9ac2d1b0533765ee3376923"
integrity sha1-KZn1MTIFqzXZrC0bBTN2XuM3aSM=
dependencies:
babel-runtime "^6.18.0"

rethinkdb-inspector@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/rethinkdb-inspector/-/rethinkdb-inspector-0.3.3.tgz#f0d88c66d17e0234b5518ca51cd8c272cb787003"
Expand Down
3 changes: 2 additions & 1 deletion hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"dependencies": {
"@sendgrid/mail": "^6.3.1",
"aws-sdk": "^2.426.0",
"aws-sdk": "^2.439.0",
"bull": "3.3.10",
"datadog-metrics": "^0.8.1",
"debug": "^4.1.1",
Expand All @@ -19,6 +19,7 @@
"performance-now": "^2.1.0",
"raven": "^2.6.4",
"redis-tag-cache": "^1.2.1",
"rethinkdb-changefeed-reconnect": "^0.3.2",
"rethinkdb-inspector": "^0.3.3",
"rethinkdbdash": "^2.3.31",
"rethinkhaberdashery": "^2.3.32",
Expand Down
33 changes: 29 additions & 4 deletions hermes/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=

aws-sdk@^2.426.0:
version "2.426.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.426.0.tgz#cf17361c987daf518f945218f06135fbc1a3690d"
integrity sha512-S4nmIhF/6iYeVEmKUWVG03zo1sw3zELoAPGqBKIZ3isrXbxkFXdP2cgIQxqi37zwWXSqaxt0xjeXVOMLzN6vSg==
aws-sdk@^2.439.0:
version "2.439.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.439.0.tgz#4a1d177507ef80b0b515c043938d814777645c40"
integrity sha512-u7hCAMzpWbD6BqAwVHxr3cbm4YSbs0yv4crr7+bR/peM+UB6AbQLJFjFXx73dnIZq3R0Hr1bA7nh2Z9jkQLUdQ==
dependencies:
buffer "4.9.1"
events "1.1.1"
Expand All @@ -123,6 +123,14 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

babel-runtime@^6.18.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4=
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"

base64-js@^1.0.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3"
Expand Down Expand Up @@ -225,6 +233,11 @@ core-js@^1.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=

core-js@^2.4.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==

[email protected]:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
Expand Down Expand Up @@ -972,6 +985,11 @@ redis-tag-cache@^1.2.1:
dependencies:
ioredis "^4.0.0"

regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==

request@^2.81.0:
version "2.88.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
Expand All @@ -998,6 +1016,13 @@ request@^2.81.0:
tunnel-agent "^0.6.0"
uuid "^3.3.2"

rethinkdb-changefeed-reconnect@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/rethinkdb-changefeed-reconnect/-/rethinkdb-changefeed-reconnect-0.3.2.tgz#2999f5313205ab35d9ac2d1b0533765ee3376923"
integrity sha1-KZn1MTIFqzXZrC0bBTN2XuM3aSM=
dependencies:
babel-runtime "^6.18.0"

rethinkdb-inspector@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/rethinkdb-inspector/-/rethinkdb-inspector-0.3.3.tgz#f0d88c66d17e0234b5518ca51cd8c272cb787003"
Expand Down
5 changes: 5 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
"COMPOSE_RETHINKDB_PASSWORD": "@github-compose-rethinkdb-password",
"COMPOSE_RETHINKDB_URL": "@github-compose-rethinkdb-url",
"COMPOSE_RETHINKDB_PORT": "@github-compose-rethinkdb-port",
"BACKUP_RETHINKDB_URL": "@backup-compose-rethinkdb-url",
"BACKUP_RETHINKDB_PORT": "@backup-compose-rethinkdb-port",
"AWS_RETHINKDB_PASSWORD": "@aws-rethinkdb-password",
"AWS_RETHINKDB_URL": "@aws-rethinkdb-url",
"AWS_RETHINKDB_PORT": "@aws-rethinkdb-port",
"COMPOSE_REDIS_PASSWORD": "@compose-redis-password",
"COMPOSE_REDIS_URL": "@compose-redis-url",
"COMPOSE_REDIS_PORT": "@compose-redis-port",
"REDIS_LABS_JOB_QUEUE_PASSWORD": "@redis-labs-job-queue-password",
"REDIS_LABS_JOB_QUEUE_URL": "@redis-labs-job-queue-url",
"REDIS_LABS_JOB_QUEUE_PORT": "@redis-labs-job-queue-port",
"REDIS_CACHE_PORT": "@redis-labs-port",
"REDIS_CACHE_URL": "@redis-labs-url",
"REDIS_CACHE_PASSWORD": "@redis-labs-password",
Expand Down
61 changes: 61 additions & 0 deletions scripts/generate-table-diagram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const r = require('rethinkdbdash')();
const type = require('type-detect');

const REF_TABLE_MAP = {
creators: 'users',
authors: 'users',
senders: 'users',
communitys: 'communities',
watercoolers: 'threads',
parents: 'messages',
};

(async () => {
const tables = await r
.db('rethinkdb')
.table('table_config')
.filter({
db: 'spectrum',
})
.map(rec => rec('name'))
.run();

for (const table of tables) {
const [record] = await r
.db('spectrum')
.table(table)
.limit(1)
.run();

if (!record) {
// console.warn(`could not find record in table ${table}`);
} else {
let output = `Table ${table} {`;
Object.keys(record).forEach(key => {
let keyType =
key === 'id' || key.endsWith('Id')
? 'uuid'
: key.endsWith('At')
? 'Date'
: type(record[key]);
output += `\n ${key} ${keyType}`;
if (key.endsWith('Id')) {
let refTable = key.replace(/id$/i, '').toLowerCase() + 's';
refTable = REF_TABLE_MAP[refTable] || refTable;
if (tables.includes(refTable)) {
output += ` [ref: < ${refTable}.id]`;
}
}
});
output += `\n}\n`;
console.log(output);
}
}
})()
.then(() => {
process.exit();
})
.catch(err => {
console.error(err);
process.exit(1);
});
Loading

0 comments on commit ff9b121

Please sign in to comment.