@haibun/web-http 1.13.5 → 1.15.0
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/build/web-http.d.ts +8 -9
- package/build/web-http.js +31 -33
- package/build/web-http.js.map +1 -1
- package/build/web-http.test.d.ts +0 -1
- package/build/web-http.test.js +2 -7
- package/build/web-http.test.js.map +1 -1
- package/package.json +11 -10
- package/build/web-http.d.ts.map +0 -1
- package/build/web-http.test.d.ts.map +0 -1
package/build/web-http.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { TNamed, AStepper } from '@haibun/core/build/lib/defs';
|
|
1
|
+
import { TNamed, AStepper } from '@haibun/core/build/lib/defs.js';
|
|
2
2
|
declare const WebHttp: {
|
|
3
3
|
new (): {
|
|
4
4
|
steps: {
|
|
5
5
|
listening: {
|
|
6
6
|
gwta: string;
|
|
7
|
-
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult>;
|
|
7
|
+
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
8
8
|
};
|
|
9
9
|
oidc_config: {
|
|
10
10
|
gwta: string;
|
|
11
|
-
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult | import("@haibun/core/build/lib/defs").TNotOKActionResult>;
|
|
11
|
+
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
12
12
|
};
|
|
13
13
|
hasContent: {
|
|
14
14
|
gwta: string;
|
|
15
|
-
action: ({ url, what }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult | import("@haibun/core/build/lib/defs").TNotOKActionResult>;
|
|
15
|
+
action: ({ url, what }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
world?: import("@haibun/core/build/lib/defs").TWorld
|
|
18
|
+
world?: import("@haibun/core/build/lib/defs.js").TWorld;
|
|
19
19
|
close?(): void;
|
|
20
20
|
endFeature?(): void;
|
|
21
|
-
onFailure?(result: import("@haibun/core/build/lib/defs").TStepResult): void;
|
|
22
|
-
setWorld(world: import("@haibun/core/build/lib/defs").TWorld, steppers: AStepper[]): void;
|
|
23
|
-
getWorld(): import("@haibun/core/build/lib/defs").TWorld;
|
|
21
|
+
onFailure?(result: import("@haibun/core/build/lib/defs.js").TStepResult): void;
|
|
22
|
+
setWorld(world: import("@haibun/core/build/lib/defs.js").TWorld, steppers: AStepper[]): void;
|
|
23
|
+
getWorld(): import("@haibun/core/build/lib/defs.js").TWorld;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export default WebHttp;
|
|
27
|
-
//# sourceMappingURL=web-http.d.ts.map
|
package/build/web-http.js
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
action: async ({ url }) => {
|
|
16
|
-
await got_1.default.get({ url, throwHttpErrors: false });
|
|
17
|
-
return defs_1.OK;
|
|
18
|
-
},
|
|
1
|
+
import { OK, AStepper } from '@haibun/core/build/lib/defs.js';
|
|
2
|
+
import { actionNotOK } from '@haibun/core/build/lib/util/index.js';
|
|
3
|
+
const WebHttp = class WebHttp extends AStepper {
|
|
4
|
+
steps = {
|
|
5
|
+
listening: {
|
|
6
|
+
gwta: 'http {url} is listening',
|
|
7
|
+
action: async ({ url }) => {
|
|
8
|
+
try {
|
|
9
|
+
await fetch(url);
|
|
10
|
+
return OK;
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
return actionNotOK(`${url} is not listening`, { topics: { result: { summary: 'error', details: e } } });
|
|
14
|
+
}
|
|
19
15
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
},
|
|
17
|
+
oidc_config: {
|
|
18
|
+
gwta: 'http {url} has an oidc well-known configuration',
|
|
19
|
+
action: async ({ url }) => {
|
|
20
|
+
const response = await fetch(`${url}/.well-known/openid-configuration`);
|
|
21
|
+
const json = await response.json();
|
|
22
|
+
return json.authorization_endpoint ? OK : actionNotOK(`${json} not recognized`, { topics: { result: { summary: 'json', details: json } } });
|
|
26
23
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
},
|
|
25
|
+
hasContent: {
|
|
26
|
+
gwta: 'fetch from {url} is {what}',
|
|
27
|
+
action: async ({ url, what }) => {
|
|
28
|
+
const response = await fetch(url);
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
return text === what ? OK : actionNotOK(`${url} does not contain ${what}, it contains ${text}`);
|
|
33
31
|
},
|
|
34
|
-
}
|
|
35
|
-
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
36
34
|
};
|
|
37
|
-
|
|
35
|
+
export default WebHttp;
|
|
38
36
|
//# sourceMappingURL=web-http.js.map
|
package/build/web-http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-http.js","sourceRoot":"","sources":["../src/web-http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-http.js","sourceRoot":"","sources":["../src/web-http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAU,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,MAAM,OAAO,GAAG,MAAM,OAAQ,SAAQ,QAAQ;IAC5C,K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,GAAG,qBAAqB,IAAI,iBAAiB,IAAI,EAAE,CAAC,CAAA;YACjG,CAAC;SACF;KACF,CAAC;CACH,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/build/web-http.test.d.ts
CHANGED
package/build/web-http.test.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const web_http_1 = __importDefault(require("./web-http"));
|
|
1
|
+
import WebHttp from "./web-http.js";
|
|
7
2
|
describe('web-http', () => {
|
|
8
3
|
it('exists', () => {
|
|
9
|
-
expect(
|
|
4
|
+
expect(WebHttp).toBeDefined();
|
|
10
5
|
});
|
|
11
6
|
});
|
|
12
7
|
//# sourceMappingURL=web-http.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-http.test.js","sourceRoot":"","sources":["../src/web-http.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-http.test.js","sourceRoot":"","sources":["../src/web-http.test.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAA;AAEnC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACd,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/web-http",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.15.0",
|
|
4
5
|
"description": "",
|
|
5
6
|
"main": "build/web-http.js",
|
|
6
7
|
"files": [
|
|
7
8
|
"build/"
|
|
8
9
|
],
|
|
9
10
|
"scripts": {
|
|
11
|
+
"build": "tsc -b .",
|
|
10
12
|
"prepublishOnly": "tsc -b .",
|
|
11
13
|
"test": "jest --config jest.config.ts",
|
|
12
14
|
"test-watch": "jest --config jest.config.ts --watch"
|
|
@@ -15,22 +17,21 @@
|
|
|
15
17
|
"author": "",
|
|
16
18
|
"license": "ISC",
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"
|
|
20
|
+
"@haibun/core": "1.15.0"
|
|
19
21
|
},
|
|
20
22
|
"devDependencies": {
|
|
21
23
|
"@types/jest": "^29.2.4",
|
|
22
24
|
"@types/node": "^18.11.14",
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
24
|
-
"@typescript-eslint/parser": "^
|
|
25
|
-
"eslint": "^
|
|
26
|
-
"eslint-config-airbnb-typescript": "^
|
|
27
|
-
"eslint-config-prettier": "^8.
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
26
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
27
|
+
"eslint": "^8.31.0",
|
|
28
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
29
|
+
"eslint-config-prettier": "^8.6.0",
|
|
28
30
|
"eslint-plugin-import": "^2.22.1",
|
|
29
31
|
"eslint-plugin-prefer-arrow": "^1.2.2",
|
|
30
|
-
"eslint-plugin-prettier": "^
|
|
32
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
31
33
|
"jest": "^29.3.1",
|
|
32
|
-
"prettier": "^2.
|
|
33
|
-
"ts-node": "^10.0.0",
|
|
34
|
+
"prettier": "^2.8.1",
|
|
34
35
|
"tslint": "^6.1.3",
|
|
35
36
|
"typescript": "^4.6.3"
|
|
36
37
|
}
|
package/build/web-http.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-http.d.ts","sourceRoot":"","sources":["../src/web-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAM,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGnE,QAAA,MAAM,OAAO;;;;;kCAIiB,MAAM;;;;kCAON,MAAM;;;;wCAOA,MAAM;;;;;;;;;;CAMzC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-http.test.d.ts","sourceRoot":"","sources":["../src/web-http.test.ts"],"names":[],"mappings":""}
|