52 Commits

Author SHA1 Message Date
Lachlan Kermode
db2672b630 export as deeprowsWithSchema 2021-05-17 16:18:07 +12:00
Lachlan Kermode
69e54a6027 Update yarn lock 2021-05-17 16:01:24 +12:00
Lachlan Kermode
6c090549c7 Add blueprinterWithSchema exporter 2021-05-17 16:01:18 +12:00
efarooqui
0ee207dc75 Linting fixes 2021-04-30 19:34:29 -07:00
efarooqui
7e97c5c227 Minor comment to trigger job 2021-04-30 19:31:16 -07:00
efarooqui
978d572660 Minor comment to trigger job 2021-04-14 19:58:55 -07:00
efarooqui
8bd5f38ac4 Error logging for gsheet fetch 2021-04-14 18:07:48 -07:00
efarooqui
6ab37ccb70 Extraneous comment added to trigger job 2021-04-14 16:35:27 -07:00
efarooqui
4976bfd985 Merge branch 'develop' of https://www.github.com/forensic-architecture/datasheet-server into develop 2021-04-14 16:12:46 -07:00
efarooqui
d713a15879 Adding comment to trigger job 2021-04-14 16:11:40 -07:00
Ebrahem Farooqui
679407f421 adding env vars for test and lint 2021-03-01 16:05:16 -08:00
Ebrahem Farooqui
3eebf811fb Incorrect syntax for unpacking head ref 2021-02-22 09:50:46 -08:00
Ebrahem Farooqui
be03a3983a Adding branch to checkout
Adding the correct branch to checkout with for workflow
2021-02-22 09:47:05 -08:00
Lachlan Kermode
d6d565a0fc Topic/cd workflow (#66)
* scaffold cd dispatch

* fix bug

update

update

update

* repo -> runtime_args

* remove travis

* only run on commits to develop
2021-01-19 22:07:10 +01:00
efarooqui
ca104e4abe Merge branch 'develop' of https://www.github.com/forensic-architecture/datasheet-server into develop 2021-01-18 20:50:14 -08:00
Ebrahem Farooqui
c18c935b54 CI Workflow (#58)
* Create main.yml

Initial action ci file

* Linting fixes

Co-authored-by: efarooqui <efarooqui@pandora.com>
2021-01-19 15:17:32 +13:00
efarooqui
828a739d72 Merge branch 'develop' of https://www.github.com/forensic-architecture/datasheet-server into develop 2020-12-08 19:32:49 -08:00
Juan Camilo González
ac80c8f256 Feature/fix duplicate associations sample xlsx (#63)
* Release v0.5.0 (#61)

* remove explicit ID from events in timemap setup

* Fixed internal anchor link headline

* update fmt

* Bump lodash from 4.17.15 to 4.17.19

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

* Wrote validation functions and getter to grab appropriate validation function

* Collapsed filters and narratives into associations; modified default tabs to reflect

* Refactoring events to have only associations; created associations tab and related export tab

* Clean up with event related associations

* Delete validation for now; not relevant to this PR

* Bump node-fetch from 2.6.0 to 2.6.1

Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Removed gsheets tab in config, unused import in package json

* try/catch to prioritise local.config.js

* Removing export categories endpoint

* Removed categories from list and using test_export_events

* Test associations

* Removed comment regarding categories endpoint

* Removing unnecessary test_export_events endpoint

* Linting threw error stating that we use path module to join instead of +

* generalise LocalFetcher to support many sheet types (xlsx, ods, etc)

* rm getFileExt

* use tab as delimiter in intermediate representation

* Bump googleapis from 32.0.0 to 39.1.0

Bumps [googleapis](https://github.com/googleapis/google-api-nodejs-client) from 32.0.0 to 39.1.0.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/v32.0.0...v39.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fixed tests

* fix example sheet

Co-authored-by: Christoph Knoth <github@christoph-knoth.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: efarooqui <efarooqui@pandora.com>
Co-authored-by: Ebrahem Farooqui <ebefarooqui@gmail.com>
Co-authored-by: Lachlan <Kermode>

* Spin up demo fixes

Co-authored-by: Lachlan Kermode <lachiekermode@gmail.com>
Co-authored-by: Christoph Knoth <github@christoph-knoth.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: efarooqui <efarooqui@pandora.com>
Co-authored-by: Ebrahem Farooqui <ebefarooqui@gmail.com>
2020-12-07 11:12:26 +01:00
Lachlan Kermode
79999342d1 Merge pull request #53 from forensic-architecture/dependabot/npm_and_yarn/googleapis-39.1.0
Bump googleapis from 32.0.0 to 39.1.0
2020-11-25 13:48:54 +00:00
efarooqui
224a5e6fe4 Reverting deeprows changes 2020-11-24 14:48:55 -08:00
Lachlan Kermode
6f7a5a19ad Merge pull request #59 from forensic-architecture/fix/timemap_data
fix example sheet
2020-11-20 10:17:43 +00:00
Lachlan Kermode
386407138f fix example sheet 2020-11-20 11:15:37 +01:00
efarooqui
17607cf69f Merge branch 'develop' of https://www.github.com/forensic-architecture/datasheet-server into develop 2020-11-16 08:55:00 -08:00
efarooqui
f3f574380c Fixed tests 2020-11-16 08:54:50 -08:00
dependabot[bot]
64f7775a83 Bump googleapis from 32.0.0 to 39.1.0
Bumps [googleapis](https://github.com/googleapis/google-api-nodejs-client) from 32.0.0 to 39.1.0.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/v32.0.0...v39.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-12 19:32:05 +00:00
Lachlan Kermode
7dd9d69d1f Merge pull request #57 from forensic-architecture/topic/better-local
generalise LocalFetcher to support many sheet types (xlsx, ods, etc)
2020-11-12 19:31:16 +00:00
Lachlan
848d5b20f7 use tab as delimiter in intermediate representation 2020-11-12 13:25:39 +00:00
Lachlan
f5ada3d326 rm getFileExt 2020-11-12 10:12:25 +00:00
Lachlan
8dad1de61e generalise LocalFetcher to support many sheet types (xlsx, ods, etc) 2020-11-12 10:06:02 +00:00
Ebrahem Farooqui
eaa4d1f2c1 Merge pull request #56 from forensic-architecture/feature/refactor-categories
Feature/refactor categories
2020-10-20 15:22:26 -07:00
efarooqui
29182f8ec2 Linting threw error stating that we use path module to join instead of + 2020-10-19 09:02:03 -07:00
efarooqui
1c600bc222 Removing unnecessary test_export_events endpoint 2020-10-19 08:56:31 -07:00
efarooqui
8492c5cbaa Removed comment regarding categories endpoint 2020-10-15 21:33:13 -07:00
efarooqui
2e1d098d12 Test associations 2020-10-14 08:12:56 -07:00
efarooqui
e5288c2599 Removed categories from list and using test_export_events 2020-10-13 08:45:41 -07:00
efarooqui
ea52a8bd8c Removing export categories endpoint 2020-10-07 09:03:30 -07:00
Lachlan Kermode
5068ea8543 Merge pull request #54 from forensic-architecture/feature/refactor-filters-and-narratives-to-associations
Feature/refactor filters and narratives to associations
2020-09-23 17:12:14 +01:00
Lachlan Kermode
1e2a991708 try/catch to prioritise local.config.js 2020-09-23 18:08:40 +02:00
efarooqui
35f8460eb4 Removed gsheets tab in config, unused import in package json 2020-09-14 08:17:48 -07:00
Lachlan Kermode
98ec281973 Merge pull request #55 from forensic-architecture/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-14 10:35:32 +02:00
dependabot[bot]
2a11bf1ec7 Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-13 00:13:08 +00:00
efarooqui
75831cbb52 Delete validation for now; not relevant to this PR 2020-09-11 08:28:55 -07:00
efarooqui
9dd2a66ce1 Clean up with event related associations 2020-09-11 08:25:52 -07:00
efarooqui
ae12de5933 Refactoring events to have only associations; created associations tab and related export tab 2020-09-09 21:23:49 -07:00
efarooqui
5c25a8d1d0 Collapsed filters and narratives into associations; modified default tabs to reflect 2020-08-25 08:55:19 -07:00
efarooqui
fba74d8e9c Wrote validation functions and getter to grab appropriate validation function 2020-08-11 21:40:34 -07:00
Lachlan Kermode
f3115007e2 Merge pull request #52 from forensic-architecture/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-07-21 09:57:07 +02:00
Lachlan Kermode
70149b905f Merge pull request #51 from christophknoth/patch-1
Fixed internal anchor link headline
2020-07-21 09:56:48 +02:00
dependabot[bot]
afa52bffb6 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-21 04:11:55 +00:00
Lachlan Kermode
533ab6e6f9 update fmt 2020-07-15 09:58:56 +02:00
Christoph Knoth
d06f4a5b68 Fixed internal anchor link headline 2020-06-30 12:30:30 +02:00
Lachlan Kermode
95cb7a6f80 remove explicit ID from events in timemap setup 2020-06-19 12:07:57 +02:00
16 changed files with 5829 additions and 79 deletions

19
.github/workflows/cd.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: CD
on:
push:
branches: [ develop ]
# pull_request:
# branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger CD build
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.CI_DISPATCH_TOKEN }}
repository: forensic-architecture/configs
event-type: remote-build
client-payload: '{"runtime_args": "datasheet", "branch": "${GITHUB_REF##*/}"}'

25
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- run: npm install
- run: npm test
env:
CI: true
- run: npm run lint
env:
CI: true

View File

@@ -1,14 +0,0 @@
language: node_js
node_js:
- stable
cache:
directories:
- node_modules
before_script:
- npm install -g yarn
install:
- yarn
script:
- yarn build
- yarn lint
- yarn test

View File

@@ -13,8 +13,8 @@ RUN yarn build
RUN mkdir -p data
# set your port
ENV PORT 8080
EXPOSE 8080
ENV PORT 4040
EXPOSE 4040
# start command as per package.json
CMD ["yarn", "start"]

Binary file not shown.

View File

@@ -1,11 +0,0 @@
#!/bin/bash
ENCRYPT_MESSAGE="\nThe .env.enc file has not changed its contents from the version on origin/develop.\nTo ensure that tests pass in Travis, you need to encrypt the contents of .env before pushing to the remote, so that the Travis server can use your service account credentials.\nEnsure that the Travis CLI is installed on your local, run\n\n\tnpm run travis-encrypt\n\nand then push to the remote again.\nIf you don't care whether your build passes on Travis, you can run:\n\n\tgit push --no-verify\n\nand bypass this check.\n\n"
# check whether .env.enc has changed
if [ -z "`git diff origin/develop -- .env.enc`" ]; then
echo $ENCRYPT_MESSAGE
exit 1
fi

View File

@@ -1,38 +0,0 @@
#!/bin/bash
echo "Encrypting .env file for Travis..."
# confirm that the user has the core repo as origin, and is therefore a maintainer
# if [ -z `git config --get remote.origin.url | grep "forensic-architecture/datasheet-server"` ]; then
# echo "Travis encryption not required for satellite contributors, continuing.."
# exit 0
# fi
# confirm travis is installed
if [ ! hash travis 2>/dev/null ]; then
echo "============================================================================================"
echo "ERROR: Travis CLI is not installed on your local. Please install from:"
echo "\thttps://github.com/travis-ci/travis.rb"
echo "After installing, make sure that you login with:"
echo "\ttravis login --pro"
echo "============================================================================================"
exit 3
fi
# confirm there is a .env file to encrypt
if [ ! -f .env ]; then
echo "============================================================================================"
echo "ERROR: You must create a .env file and add your credentials. See .env.example for an example"
echo "============================================================================================"
exit 3
fi
# regex to match and delete 'before_install' and everything after it
# necessary to delete these lines to get Travis to build for multiple accounts
echo "creating new .travis.yml configuration"
sed -i.old '/^before_install.*/,$ d' .travis.yml
echo "old config file saved as .travis.yml.old"
travis encrypt-file .env --add --force --org
git add .env.enc
git add .travis.yml
echo ".env.enc created and added to commit"

View File

@@ -30,10 +30,10 @@ export default ({ config, controller }) => {
success: msg
})
)
.catch(err =>
.catch(err => {
res.status(404)
.send({ error: err.message, err })
)
})
})
api.get('/:sheet/:tab/:resource/:frag', (req, res) => {

View File

@@ -63,10 +63,7 @@ export default (data) => {
structure.__flat.forEach(label => {
deepRow[label] = baseRow[label]
})
if (!Object.keys(deepRow).every(k => (
(deepRow[k] === '') ||
(Array.isArray(deepRow[k]) && deepRow[k].length === 0)
))) {
if (!Object.keys(deepRow).every(k => deepRow[k] === '')) {
output.push(deepRow)
}
})

View File

@@ -1,7 +1,7 @@
import copy from '../copy/en'
/**
* Controller
* Controller class
*
*/
class Controller {

View File

@@ -217,7 +217,10 @@ class GsheetFetcher extends Fetcher {
})
.then(this._buildBlueprintsAsync())
.then(() => true)
.catch(() => false)
.catch((err) => {
console.log(`Error fetching gsheets: ${err.message} `)
return false
})
}
}

View File

@@ -2,7 +2,7 @@ import path from 'path'
import fs from 'fs'
import R from 'ramda'
export const defaultBlueprint = {
const defaultBlueprint = {
name: null,
sheet: {
name: null,
@@ -11,11 +11,11 @@ export const defaultBlueprint = {
resources: {}
}
export const defaultResource = {
const defaultResource = {
data: []
}
export function buildDesaturated (sheetId, sheetName, tab, resources) {
function buildDesaturated (sheetId, sheetName, tab, resources) {
const bp = R.clone(defaultBlueprint)
bp.sheet.name = sheetName
bp.sheet.id = sheetId
@@ -50,10 +50,25 @@ fs.readdirSync(normalizedPath).forEach(file => {
allBps[bpName] = buildBlueprinter(bpName, datafier)
})
function deeprowsWithSchema (datafierName, schema) {
const datafier = data => {
const transformedData = allBps.deeprows('', '', '', data).resources.deeprows.data
return transformedData.map(row => {
Object.keys(schema).forEach(key => {
row[key] = schema[key](row[key])
})
return row
})
}
return buildBlueprinter(`deeprows_${datafierName}`, datafier)
}
// NB: revert to ES5 'module.exports' required to make blueprinters from
// each file in blueprinters folder available for granular import from here.
module.exports = Object.assign({
defaultBlueprint,
defaultResource,
buildDesaturated
buildDesaturated,
deeprowsWithSchema
}, allBps)

View File

@@ -19,7 +19,6 @@ class StoreJson {
save (url, data) {
const parts = url.split('/')
return fs.writeFile(
`${STORAGE_DIRNAME}/${parts[0]}__${parts[1]}__${parts[2]}.json`,
JSON.stringify(data)

View File

@@ -12,6 +12,8 @@ const egInput1 = [
[4, 5, 6]
]
// Test default blueprint exports
// Smoke tests
test('defaultBlueprint exports', t => {
const expected = {
sheet: {

View File

@@ -54,7 +54,7 @@ test('should launch', t => {
})
const passUrls = [
'/api/',
'/api/'
]
const failUrls = [

5753
yarn.lock Normal file

File diff suppressed because it is too large Load Diff