Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea
node_modules
dist
algolia-records.json
Expand Down
383 changes: 218 additions & 165 deletions .travis.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN mkdir /nodejs && curl http://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.ta
ENV PATH $PATH:/nodejs/bin

RUN npm i -g eslint eslint-plugin-import@latest eslint-plugin-node@latest eslint-plugin-promise@latest eslint-plugin-standard@latest
RUN npm i -g puppeteer mqtt [email protected] [email protected] [email protected] --unsafe-perm=true
RUN npm i -g puppeteer [email protected] [email protected] [email protected] --unsafe-perm=true

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion src/sdk/js/6/controllers/bulk/import/snippets/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ try {
status: 200 } } ] }
*/

console.log(`Successfully imported ${response.length} documents`);
console.log(`Successfully imported ${response.items.length} documents`);
} catch (error) {
console.error(error.message);
}
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
class TaxiController extends BaseController {
constructor (kuzzle) {
super(kuzzle, 'my-plugin/taxi');
}

enroll () {
return this.query({
action: 'enroll'
});
}
constructor (kuzzle) {
super(kuzzle, 'my-plugin/taxi');
}

const kuzzle = new Kuzzle(
new WebSocket('kuzzle')
);

// Add the custom SDK controller
kuzzle.useController(TaxiController, 'taxi');

const run = async () => {
try {
await kuzzle.connect();

// Call the custom SDK controller action
console.log(await kuzzle.taxi.enroll());

console.log('Success');
} catch (error) {
console.error(error);
} finally {
kuzzle.disconnect();
}
};

run();

enroll () {
return this.query({
action: 'enroll'
});
}
}

const kuzzle = new Kuzzle(
new WebSocket('kuzzle')
);

// Add the custom SDK controller
kuzzle.useController(TaxiController, 'taxi');

const run = async () => {
try {
await kuzzle.connect();

// Call the custom SDK controller action
console.log(await kuzzle.taxi.enroll());

console.log('Success');
} catch (error) {
console.error(error);
} finally {
kuzzle.disconnect();
}
};

run();
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
birthday: '1959-06-22',
license: 'B'
};
return kuzzle.document.on('nyc-open-data', 'yellow-taxi', driver);
return kuzzle.document.create('nyc-open-data', 'yellow-taxi', driver);
})
.then(() => {
console.log('New document successfully created!');
Expand All @@ -28,4 +28,4 @@
.then(() => {
return kuzzle.disconnect();
});
</script>
</script>
16 changes: 14 additions & 2 deletions test/lib/runners/webpackRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const BaseRunner = require('./baseRunner'),

async function buildWithWebpack(snippet) {
const config = {
entry: snippet.renderedSnippetPath,
entry: [
snippet.renderedSnippetPath
],
output: {
path: path.resolve(
__dirname,
Expand All @@ -23,7 +25,17 @@ async function buildWithWebpack(snippet) {
rules: [
{
test: /\.js$/,
loader: 'babel-loader'
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: { chrome: 58 }
}]
],
}
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion test/lib/sdk/jsSdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JsSdk {
}

async get() {
await execute('npm', ['install', '--no-save', this.npmPackage]);
await execute('npm', ['install', '--no-save', this.npmPackage, 'mqtt']);
}

exists() {
Expand Down