File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed
Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: Test
22
33on :
44 push :
5- branches : ' *'
5+ branches : ' ** '
66 tags-ignore : ' *'
77
88jobs :
Original file line number Diff line number Diff line change 11import { base64Encode , crocks , R } from "./deps.js" ;
22
33const { Async } = crocks ;
4- const { ifElse } = R ;
4+ const { ifElse, assoc , pipe , identity } = R ;
55
66// TODO: Tyler. wrap with opionated approach like before with https://github.com/vercel/fetch
77const asyncFetch = ( fetch ) => Async . fromPromise ( fetch ) ;
88
9- const createHeaders = ( username , password ) => ( {
10- "Content-Type" : "application/json" ,
11- authorization : `Basic ${
12- base64Encode ( new TextEncoder ( ) . encode ( username + ":" + password ) )
13- } `,
14- } ) ;
9+ const createHeaders = ( username , password ) =>
10+ pipe (
11+ assoc ( "Content-Type" , "application/json" ) ,
12+ ifElse (
13+ ( ) => username && password ,
14+ assoc (
15+ "authorization" ,
16+ `Basic ${
17+ base64Encode ( new TextEncoder ( ) . encode ( username + ":" + password ) )
18+ } `,
19+ ) ,
20+ identity ,
21+ ) ,
22+ ) ( { } ) ;
1523
1624const handleResponse = ( pred ) =>
1725 ifElse (
Original file line number Diff line number Diff line change @@ -3,15 +3,15 @@ import { R } from "./deps.js";
33import { asyncFetch , createHeaders , handleResponse } from "./async-fetch.js" ;
44import adapter from "./adapter.js" ;
55
6- const { mergeDeepRight , defaultTo, pipe } = R ;
6+ const { mergeDeepLeft , defaultTo, pipe } = R ;
77
88export default function ElasticsearchAdapter ( config ) {
99 return Object . freeze ( {
1010 id : "elasticsearch" ,
1111 port : "search" ,
1212 load : pipe (
1313 defaultTo ( { } ) ,
14- mergeDeepRight ( config ) ,
14+ mergeDeepLeft ( config ) , // perfer config over what's passed from previous load
1515 ) ,
1616 link : ( env ) =>
1717 ( ) => {
You can’t perform that action at this time.
0 commit comments