@microlink/function 0.2.4 → 0.2.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.
Files changed (3) hide show
  1. package/LICENSE.md +0 -0
  2. package/package.json +18 -20
  3. package/src/index.d.ts +34 -14
package/LICENSE.md CHANGED
File without changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microlink/function",
3
3
  "description": "Browser functions as Service. Interacting with browser pages, remotely.",
4
4
  "homepage": "https://function.microlink.io",
5
- "version": "0.2.4",
5
+ "version": "0.2.5",
6
6
  "types": "src/index.d.ts",
7
7
  "exports": {
8
8
  "types": "./src/index.d.ts",
@@ -39,7 +39,6 @@
39
39
  "devDependencies": {
40
40
  "@commitlint/cli": "latest",
41
41
  "@commitlint/config-conventional": "latest",
42
- "@ksmithut/prettier-standard": "latest",
43
42
  "@rollup/plugin-commonjs": "latest",
44
43
  "@rollup/plugin-node-resolve": "latest",
45
44
  "@rollup/plugin-replace": "latest",
@@ -68,22 +67,6 @@
68
67
  "files": [
69
68
  "src"
70
69
  ],
71
- "scripts": {
72
- "build": "rollup -c rollup.config.js --bundleConfigAsCjs",
73
- "clean": "rm -rf node_modules",
74
- "clean:build": "rm -rf dist/index.js",
75
- "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
76
- "dev": "npm run build -- -w",
77
- "lint": "standard && tsd",
78
- "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
79
- "prebuild": "npm run clean:build",
80
- "prepublishOnly": "npm run build",
81
- "pretest": "npm run lint && npm run build",
82
- "release": "standard-version -a",
83
- "release:github": "github-generate-release",
84
- "release:tags": "git push --follow-tags origin HEAD:master",
85
- "test": "c8 ava --verbose"
86
- },
87
70
  "license": "MIT",
88
71
  "ava": {
89
72
  "timeout": "1m"
@@ -100,7 +83,7 @@
100
83
  },
101
84
  "nano-staged": {
102
85
  "*.js": [
103
- "prettier-standard",
86
+ "npx @kikobeats/prettier-standard",
104
87
  "standard --fix"
105
88
  ],
106
89
  "package.json": [
@@ -126,5 +109,20 @@
126
109
  }
127
110
  },
128
111
  "directory": "test"
112
+ },
113
+ "scripts": {
114
+ "build": "rollup -c rollup.config.js --bundleConfigAsCjs",
115
+ "clean": "rm -rf node_modules",
116
+ "clean:build": "rm -rf dist/index.js",
117
+ "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
118
+ "dev": "npm run build -- -w",
119
+ "lint": "standard && tsd",
120
+ "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
121
+ "prebuild": "npm run clean:build",
122
+ "pretest": "npm run lint && npm run build",
123
+ "release": "standard-version -a",
124
+ "release:github": "github-generate-release",
125
+ "release:tags": "git push --follow-tags origin HEAD:master",
126
+ "test": "c8 ava --verbose"
129
127
  }
130
- }
128
+ }
package/src/index.d.ts CHANGED
@@ -1,24 +1,44 @@
1
1
  import { MqlOptions } from '@microlink/mql'
2
2
  import { Page, HTTPResponse } from 'puppeteer-core'
3
3
 
4
- export type FunctionResponse = {
5
- isFulfilled: true,
6
- isRejected: false,
4
+ export type FunctionProfiling = {
5
+ phases?: {
6
+ install?: number
7
+ build?: number
8
+ spawn?: number
9
+ run?: number
10
+ total?: number
11
+ }
12
+ cpu?: number
13
+ memory?: number
14
+ size?: number
15
+ }
16
+
17
+ export type FunctionFulfilled = {
18
+ isFulfilled: true
7
19
  value: any
20
+ profiling: FunctionProfiling
21
+ logging: Record<string, unknown>
8
22
  }
9
23
 
10
- export type FunctionArgs = {
11
- page: object;
12
- response: object;
13
- url: string;
24
+ export type FunctionRejected = {
25
+ isFulfilled: false
26
+ value: {
27
+ name: string
28
+ message: string
29
+ [key: string]: unknown
30
+ }
31
+ profiling: FunctionProfiling
32
+ logging: Record<string, unknown>
14
33
  }
15
34
 
16
- export type FunctionInput = (args: {
17
- page: Page;
18
- response: HTTPResponse;
19
- [key: string]: any;
20
- }) => any;
35
+ export type FunctionResponse = FunctionFulfilled | FunctionRejected
21
36
 
37
+ export type FunctionInput = (args: {
38
+ page: Page
39
+ response: HTTPResponse
40
+ [key: string]: any
41
+ }) => any
22
42
 
23
43
  declare function microlinkFunction(
24
44
  fn: FunctionInput,
@@ -28,6 +48,6 @@ declare function microlinkFunction(
28
48
  url: string,
29
49
  mqlOpts?: MqlOptions,
30
50
  gotOpts?: object
31
- ) => Promise<FunctionResponse>;
51
+ ) => Promise<FunctionResponse>
32
52
 
33
- export default microlinkFunction;
53
+ export default microlinkFunction