oc-template-elm-compiler 0.1.0-beta.3 → 0.1.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-template-elm-compiler",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,23 +12,20 @@
12
12
  }
13
13
  },
14
14
  "parameters": {
15
- "name": {
16
- "default": "World",
17
- "description": "Your name",
18
- "example": "Jane Doe",
19
- "mandatory": false,
20
- "type": "string"
15
+ "userId": {
16
+ "default": 1,
17
+ "description": "The user id from the user database",
18
+ "example": 1,
19
+ "mandatory": true,
20
+ "type": "number"
21
21
  }
22
22
  }
23
23
  },
24
24
  "dependencies": {},
25
25
  "devDependencies": {
26
- "@types/enzyme": "*",
27
- "@types/jest": "*",
28
- "@types/react": "*",
29
- "enzyme": "^3.11.0",
26
+ "oc-server": "*",
30
27
  "oc-template-elm-compiler": "*",
31
28
  "elm": "*",
32
29
  "typescript": "*"
33
30
  }
34
- }
31
+ }
@@ -1,3 +1,5 @@
1
+ import { Server } from 'oc-server';
2
+
1
3
  const database = [
2
4
  { name: 'John Doe', email: 'john@doe.com', age: 32 },
3
5
  { name: 'Jane Doe', email: 'jane@doe.com', age: 31 }
@@ -7,15 +9,14 @@ async function getUser(userId: number) {
7
9
  return database[userId];
8
10
  }
9
11
 
10
- export async function data(context: any, callback: (error: any, data: any) => void) {
11
- const { moreData } = context.params;
12
- const userId = Number(context.params.userId || 0);
12
+ export const server = new Server(async (params: { userId: number; moreData?: boolean }) => {
13
+ const { moreData, userId } = params;
13
14
  const { email, name, age } = await getUser(userId);
14
15
 
15
- return callback(null, {
16
+ return {
16
17
  userId,
17
18
  name,
18
19
  email,
19
20
  age: moreData && age
20
- });
21
- }
21
+ };
22
+ });
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "eslint:recommended"
3
- }
File without changes