profile
viewpoint
Christian Gill gillchristian @catawiki Netherlands https://gillchristian.xyz Personal repositories & opinions.

gcanti/fp-ts-contrib 100

A community driven utility package for fp-ts

codebases-we-love/codebases-we-love 19

:heart::scroll: Let's read code together!

fvictorio/mundial 7

See today's FIFA World Cup matches results in your terminal

gillchristian/clash 4

Clash of Clans army costs calculator

gillchristian/bandoneon 3

:scroll: Simple jQuery acorddion plugin

gillchristian/dadjokes 3

/r/dadjokes front-page your terminal

gillchristian/CPT 2

Helper class to create Custom Pots Types in WordPress.

gillchristian/array-add-item 1

:heavy_plus_sign: Add Item in Array npm util module

gillchristian/array-flatten 1

:heavy_minus_sign: Flatten an array

gillchristian/array-remove-item 1

:negative_squared_cross_mark: Remove an item from an array.

push eventgillchristian/modeling-talk

gillchristian

commit sha 14426492bd4b07fa41dc2cbdd5012a03acde8868

feat(slides): Longer version

view details

push time in 9 hours

create barnchgillchristian/modeling-talk

branch : master

created branch time in a day

created repositorygillchristian/modeling-talk

created time in a day

push eventrociojalifi/rociojalifi

gillchristian

commit sha f3a79c05262c415c7dc43aceac14c8c5cdb10c51

fix(assets): Add images to static dir

view details

push time in 4 days

push eventgillchristian/gillchristian.github.io

gillchristian

commit sha ec6e384c40d28ec899d7842f4fc80c1a4937f668

fix(types): Update tsearch articles data

view details

push time in 5 days

push eventgillchristian/gillchristian.github.io

gillchristian

commit sha f2dc530d314ea0c02c6a6921340f7c8ecde6e834

feat(articles): Simplify article list

view details

push time in 5 days

push eventgillchristian/io-ts-reporters

Omar Diab

commit sha 04094556f0c151083d1ee4aac827ed0088e7b764

no need for disabling no unused

view details

Omar Diab

commit sha 19785c70da86279619e8eb6d42a076f492cb9264

publish src for valid sourcemaps

view details

Omar Diab

commit sha a55b017effcd0c710508902e632441927411c4df

support for error messages (#25) * add io-ts-types dev dep * Yarn.lock * failing test for brand message * add printing error messages * tslint fix * no period after message in tests * remove message: prefix and simplify template string * fix test

view details

Omar Diab

commit sha 91614d13fd027ffa57722abd33a311756d6db586

replace linter with xo (#20)

view details

Omar Diab

commit sha 2a4168e00b4fafab29ada86d71d3944f98497bea

ava test runner (#27)

view details

gillchristian

commit sha 369223f2a6507b64290e46dfbc9650a38710eda6

feat(fmt): Unify union types in the same error Improves on #5

view details

push time in 6 days

pull request commentOliverJAsh/io-ts-reporters

ava test runner

Awesome! Thanks for all the PRs 💪 👏 🎉

osdiab

comment created time in 6 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha 2a4168e00b4fafab29ada86d71d3944f98497bea

ava test runner (#27)

view details

push time in 6 days

PR merged OliverJAsh/io-ts-reporters

ava test runner

easier to read output and no need for t.end()

no big deal but saw the earlier conversation re tape, and using it is super easy to implement.

Screen Shot 2020-05-20 at 15 39 39

+772 -193

4 comments

4 changed files

osdiab

pr closed time in 6 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha 91614d13fd027ffa57722abd33a311756d6db586

replace linter with xo (#20)

view details

push time in 6 days

PR merged OliverJAsh/io-ts-reporters

replace linter with xo

no need to accept this and the changes i'll be adding, I'm working off of my own master branch but i figured the changes I'm applying to this library, could be useful to you - so i'll open these as PRs and if you like them feel free to use them :)

incidentally closes #21

  • tslint is already deprecated
  • xo is a wrapper around eslint that provides a bunch of sensible defaults so as to minimize configuration
  • replaces tslint with xo
  • runs autofix on existing code to format it to style
  • as well as some hints for vscode users like myself on how to integrate it into workflow
+3835 -309

6 comments

8 changed files

osdiab

pr closed time in 6 days

pull request commentOliverJAsh/io-ts-reporters

replace linter with xo

There are conflicts now after merging #25 :grin:

osdiab

comment created time in 6 days

pull request commentOliverJAsh/io-ts-reporters

support for error messages

There were conflicts for rebasing and merging, but squash and merge worked :)

osdiab

comment created time in 6 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha a55b017effcd0c710508902e632441927411c4df

support for error messages (#25) * add io-ts-types dev dep * Yarn.lock * failing test for brand message * add printing error messages * tslint fix * no period after message in tests * remove message: prefix and simplify template string * fix test

view details

push time in 6 days

PR merged OliverJAsh/io-ts-reporters

support for error messages

Closes #24 , also removes the trailing period for the provided value (i think it doesn't help/the period can hurt clarity).

built on top of #20 so there's noise in the diff, here are the changes without that: https://github.com/OliverJAsh/io-ts-reporters/pull/25/files/39716c36ea5205155c0ba7117a5218940d90d983..57f0b2ae54130cd428cfd634978add1bfe983e9d

I rebased to make it based on master.

Example output at https://github.com/OliverJAsh/io-ts-reporters/pull/25/files#diff-e1b1ef74bf2611df9cd1e2173b684deeR85

+191 -179

3 comments

4 changed files

osdiab

pr closed time in 6 days

issue closedOliverJAsh/io-ts-reporters

include error messages in output

I set error messages with the withMessage io-ts-types helper as a guide, but PathReporter doesn't output them.

closed time in 6 days

osdiab

push eventgillchristian/io-ts-reporters

gillchristian

commit sha 85c5098203e0c0a3c5690fed88d8552a475f6b7c

test: Split in more granular tests

view details

push time in 6 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha aabca6ff057f26e6e42da4be1763f1216d6ab61d

fix(test): Remove irrelevant check

view details

push time in 6 days

Pull request review commentOliverJAsh/io-ts-reporters

Unify union types in the same error

 import * as test from 'tape';  import { reporter } from '../src/'; -test('reports an empty array when the result doesn’t contain errors', (t) => {+test('reports an empty array when the result doesn’t contain errors', t => {     const PrimitiveType = iots.string;-    const result = PrimitiveType.decode('');+    const result = PrimitiveType.decode('foo');      t.deepEqual(reporter(result), []);     t.end(); }); -test('formats a top-level primitve type correctly', (t) => {+test('formats a top-level primitve type correctly', t => {     const PrimitiveType = iots.string;     const result = PrimitiveType.decode(42); -    t.deepEqual(reporter(result), ['Expecting string but instead got: 42.']);+    t.deepEqual(reporter(result), ['Expecting string but instead got: 42']);     t.end(); }); -test('formats array items', (t) => {+test('formats array items', t => {     const NumberGroups = iots.array(iots.array(iots.number));     const result = NumberGroups.decode({}); -    t.deepEqual(reporter(result), ['Expecting Array<Array<number>> but instead got: {}.']);+    t.deepEqual(reporter(result), [+        'Expecting Array<Array<number>> but instead got: {}'+    ]);     t.end(); }); -test('formats nested array item mismatches correctly', (t) => {+test('formats nested array item mismatches correctly', t => {     const NumberGroups = iots.array(iots.array(iots.number));-    const result = NumberGroups.decode([[{}]]);+    const result = NumberGroups.decode([['123']]); -    t.deepEqual(reporter(result), ['Expecting number at 0.0 but instead got: {}.']);+    t.deepEqual(reporter(result), [+        'Expecting number at 0.0 but instead got: "123"'+    ]);     t.end(); }); -test('formats a complex type correctly', (t) => {-    const Gender = iots.union([iots.literal('Male'), iots.literal('Female')]);+test('handles union types properly', t => {+    const Unions = iots.interface({+        oneOf: iots.keyof({ a: null, b: null, c: null }),+        stringUnion: iots.union([+            iots.literal('a'),+            iots.literal('b'),+            iots.literal('c')+        ]),+        interfaceUnion: iots.union([+            iots.interface({ key: iots.string }),+            iots.interface({ code: iots.number })+        ])+    });++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: '',+                stringUnion: '',+                interfaceUnion: ''+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: ""'+            ].join('\n'),+            'Expecting "a" | "b" | "c" at oneOf but instead got: ""',+            [+                'Expecting one of:',+                '    "a"',+                '    "b"',+                '    "c"',+                'at stringUnion but instead got: ""'+            ].join('\n')+        ]+    );++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: 'a',+                stringUnion: 'a',+                interfaceUnion: {}+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: {}'+            ].join('\n')+        ]+    );++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: 'a',+                stringUnion: 'a',+                interfaceUnion: { code: '123' }+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: {"code":"123"}'+            ].join('\n')+        ]+    );++    const Gender = iots.union([+        iots.literal('Male'),+        iots.literal('Female'),+        iots.literal('Other')+    ]);     const Person = iots.interface({         name: iots.string,-        age: iots.number,         gender: Gender,-        children: iots.array(-            iots.interface({-                gender: Gender,-            })-        )-    });-    const result = Person.decode({-        name: 'Giulio',-        children: [{ gender: 'Whatever' }]+        children: iots.array(iots.interface({ gender: Gender }))     }); -    t.deepEqual(reporter(result), [-        'Expecting number at age but instead got: undefined.',-        'Expecting "Male" at gender.0 but instead got: undefined.',-        'Expecting "Female" at gender.1 but instead got: undefined.',-        'Expecting "Male" at children.0.gender.0 but instead got: "Whatever".',-        'Expecting "Female" at children.0.gender.1 but instead got: "Whatever".'+    t.deepEqual(reporter(Person.decode({ name: 'Jane', children: [] })), [+        'Expecting number at age but instead got: undefined',+        [+            'Expecting one of:',+            '    "Male"',+            '    "Female"',+            '    "Other"',+            'at gender but instead got: undefined'+        ].join('\n')     ]);++    t.deepEqual(+        reporter(+            Person.decode({+                name: 'Jane',+                gender: 'female',+                children: [{ gender: 'Whatever' }]+            })+        ),+        [+            'Expecting number at age but instead got: undefined',+            [+                'Expecting one of:',+                '    "Male"',+                '    "Female"',+                '    "Other"',+                'at gender but instead got: "female"'+            ].join('\n'),

@osdiab I think this case covers the error you pointed out on https://github.com/OliverJAsh/io-ts-reporters/pull/17#issuecomment-631471440

Expected:

Expecting one of:
    "Male"
    "Female"
    "Other"
at gender but instead got: "female"

But now it outputs:

Expecting one of:
    "Male"
    "Female"
    "Other"
    "Male"
    "Female"
    "Other"
at gender but instead got: "female"

Note that I only added the failing tests for now. I still need to work on the code.

gillchristian

comment created time in 6 days

Pull request review commentOliverJAsh/io-ts-reporters

Unify union types in the same error

 import * as test from 'tape';  import { reporter } from '../src/'; -test('reports an empty array when the result doesn’t contain errors', (t) => {+test('reports an empty array when the result doesn’t contain errors', t => {     const PrimitiveType = iots.string;-    const result = PrimitiveType.decode('');+    const result = PrimitiveType.decode('foo');      t.deepEqual(reporter(result), []);     t.end(); }); -test('formats a top-level primitve type correctly', (t) => {+test('formats a top-level primitve type correctly', t => {     const PrimitiveType = iots.string;     const result = PrimitiveType.decode(42); -    t.deepEqual(reporter(result), ['Expecting string but instead got: 42.']);+    t.deepEqual(reporter(result), ['Expecting string but instead got: 42']);     t.end(); }); -test('formats array items', (t) => {+test('formats array items', t => {     const NumberGroups = iots.array(iots.array(iots.number));     const result = NumberGroups.decode({}); -    t.deepEqual(reporter(result), ['Expecting Array<Array<number>> but instead got: {}.']);+    t.deepEqual(reporter(result), [+        'Expecting Array<Array<number>> but instead got: {}'+    ]);     t.end(); }); -test('formats nested array item mismatches correctly', (t) => {+test('formats nested array item mismatches correctly', t => {     const NumberGroups = iots.array(iots.array(iots.number));-    const result = NumberGroups.decode([[{}]]);+    const result = NumberGroups.decode([['123']]); -    t.deepEqual(reporter(result), ['Expecting number at 0.0 but instead got: {}.']);+    t.deepEqual(reporter(result), [+        'Expecting number at 0.0 but instead got: "123"'+    ]);     t.end(); }); -test('formats a complex type correctly', (t) => {-    const Gender = iots.union([iots.literal('Male'), iots.literal('Female')]);+test('handles union types properly', t => {+    const Unions = iots.interface({+        oneOf: iots.keyof({ a: null, b: null, c: null }),+        stringUnion: iots.union([+            iots.literal('a'),+            iots.literal('b'),+            iots.literal('c')+        ]),+        interfaceUnion: iots.union([+            iots.interface({ key: iots.string }),+            iots.interface({ code: iots.number })+        ])+    });++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: '',+                stringUnion: '',+                interfaceUnion: ''+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: ""'+            ].join('\n'),+            'Expecting "a" | "b" | "c" at oneOf but instead got: ""',+            [+                'Expecting one of:',+                '    "a"',+                '    "b"',+                '    "c"',+                'at stringUnion but instead got: ""'+            ].join('\n')+        ]+    );++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: 'a',+                stringUnion: 'a',+                interfaceUnion: {}+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: {}'+            ].join('\n')+        ]+    );++    t.deepEqual(+        reporter(+            Unions.decode({+                oneOf: 'a',+                stringUnion: 'a',+                interfaceUnion: { code: '123' }+            })+        ),+        [+            [+                'Expecting one of:',+                '    { key: string }',+                '    { code: number }',+                'at interfaceUnion but instead got: {"code":"123"}'+            ].join('\n')+        ]+    );++    const Gender = iots.union([+        iots.literal('Male'),+        iots.literal('Female'),+        iots.literal('Other')+    ]);     const Person = iots.interface({         name: iots.string,-        age: iots.number,         gender: Gender,-        children: iots.array(-            iots.interface({-                gender: Gender,-            })-        )-    });-    const result = Person.decode({-        name: 'Giulio',-        children: [{ gender: 'Whatever' }]+        children: iots.array(iots.interface({ gender: Gender }))     }); -    t.deepEqual(reporter(result), [-        'Expecting number at age but instead got: undefined.',-        'Expecting "Male" at gender.0 but instead got: undefined.',-        'Expecting "Female" at gender.1 but instead got: undefined.',-        'Expecting "Male" at children.0.gender.0 but instead got: "Whatever".',-        'Expecting "Female" at children.0.gender.1 but instead got: "Whatever".'+    t.deepEqual(reporter(Person.decode({ name: 'Jane', children: [] })), [+        'Expecting number at age but instead got: undefined',+        [+            'Expecting one of:',+            '    "Male"',+            '    "Female"',+            '    "Other"',+            'at gender but instead got: undefined'+        ].join('\n')

@osdiab this case should cover the exampled you mentioned on https://github.com/OliverJAsh/io-ts-reporters/pull/17#issuecomment-631471440

Expected:

Expecting one of:
    "Male"
    "Female"
    "Other"
at gender but instead got: undefined

But currently it outputs:

Expecting one of:
    "Male"
    "Female"
    "Other"
    "Male"
    "Female"
    "Other"
    "Male"
    "Female"
    "Other"
at gender but instead got: undefined
gillchristian

comment created time in 6 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha da9e513ee5f5bb990ad9397c5efaba778562ee77

test(unions): Add cases for union errors formatting

view details

push time in 6 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha dab495e4cc5ec8cb109651d85eab89a130c97d79

fix(tests): Use array join instead of template literals For an easier to read formatting

view details

gillchristian

commit sha 603671b8c23d24c42e2c1606d4df1644e16165fb

refactor(errors): Extract error message generation to functions

view details

push time in 6 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha f374272618225a42976a272676fefb9e4dfd86b5

fix(tests): Remove obsolete tests file

view details

push time in 6 days

pull request commentOliverJAsh/io-ts-reporters

ava test runner

@osdiab same here :)

osdiab

comment created time in 6 days

pull request commentOliverJAsh/io-ts-reporters

support for error messages

@osdiab this needs merge conflicts resolving as well

osdiab

comment created time in 6 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha 19785c70da86279619e8eb6d42a076f492cb9264

publish src for valid sourcemaps

view details

push time in 6 days

issue closedOliverJAsh/io-ts-reporters

Missing src directory from package - .js.map file pointing at non-existent files

In the published library on NPM, it's missing the top level src directory... so the index.js.map file is pointing at a non-existent source file.

Not the end of the world but it's giving some warnings here and there during our build pipeline.

closed time in 6 days

cvallance

PR merged OliverJAsh/io-ts-reporters

publish src for valid sourcemaps

closes #12

Build fails due to #21 which is addressed by either #20 or #23

+2 -1

2 comments

1 changed file

osdiab

pr closed time in 6 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha 04094556f0c151083d1ee4aac827ed0088e7b764

no need for disabling no unused

view details

push time in 6 days

PR merged OliverJAsh/io-ts-reporters

no need for disabling no unused config

uncommented and no problems running yarn lint yarn test or yarn compile

Build fails due to #21 which is addressed by either #20 or #23

+3 -6

1 comment

1 changed file

osdiab

pr closed time in 6 days

pull request commentOliverJAsh/io-ts-reporters

replace linter with xo

@osdiab once conflicts are solved this can be merged

osdiab

comment created time in 6 days

create barnchrociojalifi/rociojalifi

branch : master

created branch time in 7 days

push eventgillchristian/til

gillchristian

commit sha eebdc106b987ce8313664307b4d0c37d7c61b067

Update til.md

view details

push time in 7 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha f8270ab07bec4f2bd4a8140fe9d73272f019b7d5

fix(fmt): Fix formatting

view details

push time in 7 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha f427953433e77361b831e932d6f3f22ca3a401d8

feat(fmt): Unify union types in the same error Improves on #5

view details

gillchristian

commit sha 4383c8892dc7ef7d0d9fc77603939ddee485a53b

fix(tests): Small fix on tests

view details

gillchristian

commit sha b9b5ffb2ebab651efbcb61ff3236c6bb0ff31ee7

refactor(style): Small changes on imports and types

view details

gillchristian

commit sha 7d43016941111a5345fdce7e9080426e3e009e4d

feat(reporter): Format unions as list of cases

view details

Omar Diab

commit sha 0af4e84343e675e8557a32a45ef87e784bd4e91c

port tests to new tape syntax, add the passing assertions

view details

push time in 7 days

push eventgillchristian/io-ts-reporters

gillchristian

commit sha 1d39550239677d387c49ccdf0b93ceed6fc3c90f

feat(fmt): Unify union types in the same error Improves on #5

view details

gillchristian

commit sha 57f06374052c8b190c2446828dee2391c8c240cd

fix(tests): Small fix on tests

view details

gillchristian

commit sha cfb968124fde063a08e4513fd3f6dd6eca029a24

refactor(style): Small changes on imports and types

view details

gillchristian

commit sha aa92dba4bf09fc3774debe258c8ac0889c605e4f

feat(reporter): Format unions as list of cases

view details

Omar Diab

commit sha 782a4abc5d029bd41583877b18cd0da7ea32ef07

Merge remote-tracking branch 'main/master' into feature/union-types-formatting

view details

Omar Diab

commit sha 0ed9ddd25e7a6aadb6ca6fd5b5b8919fb49fedb7

port tests to new tape syntax, add the passing assertions

view details

Christian Gill

commit sha 2167f2045a480b4497362f0e062ba7be077647f5

Merge pull request #1 from osdiab/feature/union-types-formatting

view details

push time in 7 days

PR merged gillchristian/io-ts-reporters

add new testing system, merge master on union types branch

It wasn't clear what your change was outputting due to the lack of actual tests, so I merged master and made the tests pass based on what your code does.

+153 -28

1 comment

2 changed files

osdiab

pr closed time in 7 days

pull request commentgillchristian/io-ts-reporters

add new testing system, merge master on union types branch

Thanks for this!

so I merged master and made the tests pass based on what your code does

We should actually have what is the expected output as tests. I'll do that on my PR.

osdiab

comment created time in 7 days

push eventgillchristian/io-ts-reporters

dependabot[bot]

commit sha 3dfb2b453178279e817da8daaae4d935593ba6f5

Bump diff from 3.3.0 to 3.5.0 Bumps [diff](https://github.com/kpdecker/jsdiff) from 3.3.0 to 3.5.0. - [Release notes](https://github.com/kpdecker/jsdiff/releases) - [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md) - [Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.0...v3.5.0) Signed-off-by: dependabot[bot] <support@github.com>

view details

Christian Gill

commit sha 9d138c6a1ad58697e5d4a4ead3052f71e57496bc

Merge pull request #16 from OliverJAsh/dependabot/npm_and_yarn/diff-3.5.0 Bump diff from 3.3.0 to 3.5.0

view details

Mathias Schreck

commit sha 55e311756f550803788cd3e68d09fc336a349fa0

Add dedicated typecheck task to npm run lint

view details

Mathias Schreck

commit sha 8d259e92579e69d0e5746afd4579617eca717b1b

Migrate tests to tape

view details

Omar Diab

commit sha 955681449971474cdb7b64458c3defc791f152e4

run yarn install

view details

gillchristian

commit sha 3f7c415b2122c8ba3b659146323d2cc682c1d0fa

feat(fmt): Unify union types in the same error Improves on #5

view details

gillchristian

commit sha e3f856fc461bb4a7412e6c26178bee83f04da793

refactor(style): Small changes on imports and types

view details

gillchristian

commit sha b50de44757fd6efd2f53943aacf27af3094d9667

feat(reporter): Format unions as list of cases

view details

push time in 7 days

push eventgillchristian/io-ts-reporters

dependabot[bot]

commit sha 3dfb2b453178279e817da8daaae4d935593ba6f5

Bump diff from 3.3.0 to 3.5.0 Bumps [diff](https://github.com/kpdecker/jsdiff) from 3.3.0 to 3.5.0. - [Release notes](https://github.com/kpdecker/jsdiff/releases) - [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md) - [Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.0...v3.5.0) Signed-off-by: dependabot[bot] <support@github.com>

view details

Christian Gill

commit sha 9d138c6a1ad58697e5d4a4ead3052f71e57496bc

Merge pull request #16 from OliverJAsh/dependabot/npm_and_yarn/diff-3.5.0 Bump diff from 3.3.0 to 3.5.0

view details

Mathias Schreck

commit sha 55e311756f550803788cd3e68d09fc336a349fa0

Add dedicated typecheck task to npm run lint

view details

Mathias Schreck

commit sha 8d259e92579e69d0e5746afd4579617eca717b1b

Migrate tests to tape

view details

Omar Diab

commit sha 955681449971474cdb7b64458c3defc791f152e4

run yarn install

view details

push time in 7 days

Pull request review commentOliverJAsh/io-ts-reporters

ava test runner

   },   "devDependencies": {     "@types/tape": "^4.2.34",-    "tap-min": "^2.0.0",-    "tape": "^4.13.0",+    "ava": "^3.8.2",     "ts-node": "^8.6.2",     "tslint": "^5.8.0",     "typescript": "^3.5.3"+  },+  "ava": {+    "extensions": [+      "ts"+    ],+    "files": [+      "tests/**/*.test.ts"+    ],+    "require": [+      "ts-node/register"+    ]

[Q] Does AVA support somthing like ava.config.json? I'd rather not pollute the package.json. Although that would me more files in the root but 🤷‍♂️

osdiab

comment created time in 7 days

Pull request review commentOliverJAsh/io-ts-reporters

Use a proper test runner and actually assert expected behavior

+import * as iots from 'io-ts';+import * as test from 'tape';++import { reporter } from '../src/';++test('reports an empty array when the result doesn’t contain errors', (t) => {+    const PrimitiveType = iots.string;+    const result = PrimitiveType.decode('');++    t.deepEqual(reporter(result), []);+    t.end();

I'm fine with AVA as well. Used it when it just came out and I liked it.

@lo1tuma wdyt?

lo1tuma

comment created time in 7 days

Pull request review commentOliverJAsh/io-ts-reporters

support for error messages

 export const formatValidationError = (error: t.ValidationError) => {         error.context as Array<t.ContextEntry>     ); -    return pipe(maybeErrorContext, map(errorContext => {-        const expectedType = errorContext.type.name;-        return (-            // https://github.com/elm-lang/core/blob/18c9e84e975ed22649888bfad15d1efdb0128ab2/src/Native/Json.js#L199-            // tslint:disable-next-line:prefer-template-            `Expecting ${expectedType}`-                + (path === '' ? '' : ` at ${path}`)-                + ` but instead got: ${jsToString(error.value)}.`-        );-    }))+    return pipe(+        maybeErrorContext,+        map((errorContext) => {+            const expectedType = errorContext.type.name;+            return (+                // https://github.com/elm-lang/core/blob/18c9e84e975ed22649888bfad15d1efdb0128ab2/src/Native/Json.js#L199+                // tslint:disable-next-line:prefer-template+                `Expecting ${expectedType}` ++                (path === '' ? '' : ` at ${path}`) ++                ` but instead got: ${jsToString(error.value)}${+                error.message ? ` (message: ${jsToString(error.message)})` : ''

I'm not so sure about the (message: ....) format, what about just having the message in parens? Wdyt?

                error.message ? ` (${jsToString(error.message)})` : ''

Also, the formatting here inside template literal is getting a bit crazy. Maybe this is worth extracting.

osdiab

comment created time in 7 days

pull request commentOliverJAsh/io-ts-reporters

publish src for valid sourcemaps

@osdiab I've merged #23, could you rebase?

osdiab

comment created time in 7 days

push eventOliverJAsh/io-ts-reporters

Omar Diab

commit sha 955681449971474cdb7b64458c3defc791f152e4

run yarn install

view details

push time in 7 days

issue closedOliverJAsh/io-ts-reporters

tests succeed but build is broken

looks like some yarn issue is holding it up

closed time in 7 days

osdiab

PR merged OliverJAsh/io-ts-reporters

run yarn install

seems the lockfile might have something wrong, messing up build. closes #21

If you like #20 though just go for that because i ran yarn install there too, fixing the same problem

+451 -0

0 comment

1 changed file

osdiab

pr closed time in 7 days

pull request commentOliverJAsh/io-ts-reporters

Unify union types in the same error

@osdiab I think that is because it adds errors for every branch or something like that.

I need to get this PR in better shape, I'll take a look at your changes on the tests and pick up the work I was doing.

gillchristian

comment created time in 7 days

Pull request review commentOliverJAsh/io-ts-reporters

Unify union types in the same error

-import * as array from 'fp-ts/lib/Array';-import { fold } from 'fp-ts/lib/Either';-import { map } from 'fp-ts/lib/Option';+import * as A from 'fp-ts/lib/Array';+import * as E from 'fp-ts/lib/Either';+import { flow } from 'fp-ts/lib/function';+import * as NEA from 'fp-ts/lib/NonEmptyArray';+import * as O from 'fp-ts/lib/Option'; import { pipe } from 'fp-ts/lib/pipeable';+import { toArray } from 'fp-ts/lib/Record'; import * as t from 'io-ts'; -const jsToString = (value: t.mixed) => (value === undefined ? 'undefined' : JSON.stringify(value));+const isUnionType = ({ type }: t.ContextEntry) => type instanceof t.UnionType; -export const formatValidationError = (error: t.ValidationError) => {-    const path = error.context+const jsToString = (value: t.mixed) =>+    value === undefined ? 'undefined' : JSON.stringify(value);++const keyPath = (ctx: t.Context) =>+    ctx         .map(c => c.key)-        // The context entry with an empty key is the original type ("default-        // context"), not an type error.+        // The context entry with an empty key is the original+        // type ("default context"), not an type error.         .filter(key => key.length > 0)         .join('.'); -    // The actual error is last in context-    const maybeErrorContext = array.last(-        // https://github.com/gcanti/fp-ts/pull/544/files-        error.context as Array<t.ContextEntry>+// The actual error is last in context+const getErrorFromCtx = (validation: t.ValidationError) =>+    // https://github.com/gcanti/fp-ts/pull/544/files+    A.last(validation.context as Array<t.ContextEntry>);++const getValidationContext = (validation: t.ValidationError) =>+    // https://github.com/gcanti/fp-ts/pull/544/files+    validation.context as Array<t.ContextEntry>;++const expectedTypesToString = flow(+    A.map(({ type }: t.ContextEntry) => `    ${type.name}`),+    arr => arr.join('\n'),+);++export const formatUnionError = (+    path: string,+    errors: NEA.NonEmptyArray<t.ValidationError>,+) => {+    const expectedTypes = pipe(+        errors,+        A.map(getValidationContext),+        A.map(ctx =>+            pipe(+                ctx,+                // find the union type in the list of ContextEntry+                A.findIndex(isUnionType),+                // the next ContextEntry should be the+                // type of this branch of the union+                O.chain(n => A.lookup(n + 1, ctx)),+            ),+        ),+        A.compact,+    );++    const value = pipe(+        expectedTypes,+        A.head,+        O.map(v => v.actual),+        O.getOrElse<unknown>(() => undefined),     ); -    return pipe(maybeErrorContext, map(errorContext => {-        const expectedType = errorContext.type.name;-        return (-            // https://github.com/elm-lang/core/blob/18c9e84e975ed22649888bfad15d1efdb0128ab2/src/Native/Json.js#L199-            // tslint:disable-next-line:prefer-template-            `Expecting ${expectedType}`-                + (path === '' ? '' : ` at ${path}`)-                + ` but instead got: ${jsToString(error.value)}.`-        );-    }))+    const expected = expectedTypesToString(expectedTypes);++    return expected.trim() === ''+        ? O.none+        : O.some(+              // https://github.com/elm-lang/core/blob/18c9e84e975ed22649888bfad15d1efdb0128ab2/src/Native/Json.js#L199+              // tslint:disable-next-line:prefer-template+              `Expecting one of:\n${expected}` +

but ideally if there's one "dominant" error like mentioned in #5 to make it choose a branch smartly, that one would probably be the error message I'd display.

Totally agree on that.

And yes, we should unify the way error messages are generated.

gillchristian

comment created time in 7 days

issue commentOliverJAsh/io-ts-reporters

Missing src directory from package - .js.map file pointing at non-existent files

I'd say it's fine to publish src files

cvallance

comment created time in 8 days

push eventgillchristian/til

gillchristian

commit sha 3630ab28b8c0819e28d85eb87875f445fe6c1c74

Update til.md

view details

push time in 15 days

issue commentOliverJAsh/io-ts-reporters

Hard to debug union types

Yes. I'm working (or was) on #17 which tries to improve reporting for union types.

I got stuck on transforming the io-ts context into error messages for more elaborate cases. So I need to get back to fixing that before being able to merge and release.

wasd171

comment created time in 15 days

issue openedgillchristian/tsplay.dev

Server: tables & queries improvements

Currently the table structure and the queries aren't very efficient.

  • [ ] Add a TTL and cleanup links after?
  • [ ] Store stats in a separate table instead of performing calculations on the shortened links table
  • [ ] Paginate the list links endpoint
  • [ ] Add creation / update dates colums to shortened table
  • [ ] Add indexes to shortened commonly queried columns

created time in 16 days

issue openedgillchristian/tsplay.dev

Server: publish Docker image only on release tags

Currently the Docker image publish action publishes on every push to master. Instead we should publish only for releases.

Besides that, it would be great to publish on GitHub registry instead, which could be private even (if necessary).

created time in 16 days

delete branch gillchristian/tsplay.dev

delete branch : feature/server/update-docker-compose

delete time in 16 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 3ac5dd58eceaa91ee216139b39d8f008b0673b26

fix(docker): Fix DB volume and exposed port

view details

gillchristian

commit sha 6ed2028c2e41e080322ac9aa3fa6d635e61a17e2

fix(repo): Include database/**

view details

push time in 16 days

PR merged gillchristian/tsplay.dev

Reviewers
docker-compose fixes
  • Include migrations (database/migrations was ignored)
  • Fix docker-compose database volume & bound port
+16 -4

1 comment

3 changed files

gillchristian

pr closed time in 16 days

PR opened gillchristian/tsplay.dev

Reviewers
docker-compose fixes
  • Include migrations (database/migrations was ignored)
  • Fix docker-compose database volume & bound port
+16 -4

0 comment

3 changed files

pr created time in 16 days

create barnchgillchristian/tsplay.dev

branch : feature/server/update-docker-compose

created branch time in 16 days

starteddandavison/delta

started time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 0f225d3f4fed21b13bba5cce4088531a1acf1ec2

fix(docker): Add psql lib & bind db files volume

view details

push time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 0bb56d5be8bcc941939ce578364c6b25098c4f20

ci(docker): Fix image build Action

view details

push time in 17 days

issue closedgillchristian/tsplay.dev

Server: Fix Mongo Atlas connection

Connecting to the hosted DB gives the following error.

Network.BSD.getHostByName: does not exist (no such host entry)

closed time in 17 days

gillchristian

issue commentgillchristian/tsplay.dev

Server: Fix Mongo Atlas connection

#28

gillchristian

comment created time in 17 days

delete branch gillchristian/tsplay.dev

delete branch : feature/mongo-to-postgres

delete time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha c7144c05e68a7a32fa0987e2019168b6858e1abb

feat(server): Mongo -> Postgres & re-architecture https://github.com/parsonsmatt/servant-persistent

view details

gillchristian

commit sha 10b409b9375da6f3e399964d0caa8ff4fece7a03

fix(ci): Update Stack LTS for GitHub Actions

view details

gillchristian

commit sha b63414b7fb31e333dc5e1098c1c1df1d10cb84c7

fix(env): Migrations dir & default ports

view details

push time in 17 days

PR merged gillchristian/tsplay.dev

Reviewers
feat(server): Mongo -> Postgres & re-architecture

Update backend to use Postgres instead of Mongo and to follow the architecture presented here on servant-persistent by @parsonsmatt (article link).

+822 -443

1 comment

25 changed files

gillchristian

pr closed time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 6abc03de553567e5a120e0cce4849a6e6712f73e

fix(env): Migrations dir & default ports

view details

push time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 0a82c56209b7ea56ba7a1c1c5d3ffb5ac881f091

feat(server): Mongo -> Postgres & re-architecture https://github.com/parsonsmatt/servant-persistent

view details

gillchristian

commit sha 4a3a1c3da01c1fe4fb8742a695f00e5bba9279ed

fix(ci): Update Stack LTS for GitHub Actions

view details

push time in 17 days

push eventgillchristian/tsplay.dev

gillchristian

commit sha 6fe26a0a7b529c0a260d735c07ab15f4c4805d93

fix(ci): Update Stack LTS for GitHub Actions

view details

push time in 17 days

PR opened gillchristian/tsplay.dev

feat(server): Mongo -> Postgres & re-architecture

Update backend to use Postgres instead of Mongo and to follow the architecture presented here on servant-persistent by @parsonsmatt (article link).

+819 -441

0 comment

23 changed files

pr created time in 17 days

create barnchgillchristian/tsplay.dev

branch : feature/mongo-to-postgres

created branch time in 17 days

startedAscentSoftware/select-ts

started time in 18 days

issue commentgillchristian/tsplay.dev

Support updating the link of a short link

Not really, what I meant is. That once you create a short link, if you change a bit the playground code (which now has a new hash, thus is a new url) you need to create a new short link again. Which is a pain because you are going to keep sharing links.

Another use case is, let's say you create the short link to share in some conference presentation, a blog post or a tweet. If you then find a typo in the playground code, and decide to update the code, you need to create a new short link for that updated version of the playground and share the link again.

It would be cool to be able to update the playground link that the short link points to.

Are you thinking on this as the front-page description, alongside the TS playground image?

So, no I wasn't. But actually it could be used. With some tweaks 😏

gillchristian

comment created time in 21 days

MemberEvent

issue openedgillchristian/tsplay.dev

Support updating the link of a short link

When creating playground examples it is easy to forget something and then needing to change the code, which produces a new "hash" and thus a new URL.

This is a pain point when sharing playground links, as any changes made to the code require sharing a new link.

tsplay.dev is all about making sharing playground links easier.

Supporting the update of the link a short link points to would make this experience much better.

There are security concerns tho, as anybody could change the link for somebody else.

This should only by supported when GitHub login is there or by providing some sort of token (on link creation) that would need to be sent back to allow for updating.

created time in 21 days

MemberEvent

startedilyamkin/dev-to-js

started time in 21 days

pull request commentOliverJAsh/io-ts-reporters

fix tests path in readme

@gyzerok sorry I haven't been able to focus on the library. I'll get back to this one I get some time.

gyzerok

comment created time in a month

startedfolke/ultra-runner

started time in a month

issue openedmongodb-haskell/mongodb

Issues connecting to Mongo Atlas

I'm trying to connect to Mongo Atlas but to no success. Getting the following error:

Network.BSD.getHostByName: does not exist (no such host entry)

I've tried the suggestions from #84 but it seems like the issue is different.

This is how I connect:

import qualified Database.MongoDB as DB
import qualified Database.MongoDB.Transport.Tls as DBTLS

runDb :: DB.Action IO a -> App a
runDb action = do
  -- ...
  pipe <- liftIO $ case env of
    Production -> DBTLS.connect (dbHostname dbConf) (DB.PortNumber 27017)
    Development -> DB.connect $ DB.host $ dbHostname dbConf
  -- ...

Code is open source, rest can be found here.

On Development mode connecting to a local db it works fine (dbHostname: "127.0.0.1").

But when trying to connect to Mongo Atlas, either by using DBTLS.connect or DB.connect it does not work. Either by trying with the full connect URL provided by Mongo Atlas or only the host

dbHostname: "mongodb+srv://<user>:<password>@xxxxxx-xxxxx.gcp.mongodb.net/test?retryWrites=true&w=majority"

dbHostname: "xxxxxx-xxxxx.gcp.mongodb.net"

As error is from Network.BSD.getHostByName I'm not sure if issue should be opened here or not.

created time in a month

startedalanrsoares/reason-game-of-life

started time in a month

startedFrigoEU/psc-ide-vim

started time in a month

created taggillchristian/tsplay.dev

tagv0.0.2

TypeScript Playground Shortener

created time in a month

created taggillchristian/tsplay.dev

tagv0.0.3

TypeScript Playground Shortener

created time in a month

push eventgillchristian/tsplay.dev

gillchristian

commit sha 68f1c0022c1d5b29c179c5ac1d40a3fb31167da9

fix(playground): Support staing website

view details

gillchristian

commit sha f5f372d5c74c10fb317c41de8735a41960bde68f

v0.0.4

view details

push time in a month

delete branch gillchristian/tsplay.dev

delete branch : feature/server/healthz

delete time in a month

push eventgillchristian/tsplay.dev

gillchristian

commit sha 51668b0c5ce7f76fa16359bed24ae932335ddc25

feat(server): Add all urls, stats & healthz endpoints Also move api endpoints under api/..

view details

gillchristian

commit sha 6886b9332fc00b6cff97f0cabc979d5faf914c73

fix(client): Api endpoint

view details

gillchristian

commit sha 7379f40a59d35815e8d216466032e827d2b7df5a

fix(playground): Api endpoint

view details

gillchristian

commit sha 84a331e97ef80fd96cf770beb4642a22e1fa6f17

refactor(server): Improvements to Tsplay.Persistence module

view details

push time in a month

PR merged gillchristian/tsplay.dev

feature(server): Add all urls, stats & healthz endpoints

Fixes #18

Also adds

  • all shortened urls endpoint
  • stats endpoint with all shortened count & all visits count
+141 -56

1 comment

6 changed files

gillchristian

pr closed time in a month

push eventgillchristian/tsplay.dev

gillchristian

commit sha 0b24f3a297dfd8725511ed60711ecf54de29e58c

refactor(server): Improvements to Tsplay.Persistence module

view details

push time in a month

startedmongodb-haskell/mongodb

started time in a month

startedepicallan/hreq

started time in a month

PR opened gillchristian/tsplay.dev

feature(server): Add all urls, stats & healthz endpoints

Fixes #18

Also adds

  • all shortened urls endpoint
  • stats endpoint with all shortened count & all visits count
+142 -48

0 comment

6 changed files

pr created time in a month

create barnchgillchristian/tsplay.dev

branch : feature/server/healthz

created branch time in a month

delete branch gillchristian/tsplay.dev

delete branch : chore/server/refactor-modules

delete time in a month

more