@haibun/web-http 1.28.5 → 1.28.10
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 +30 -0
- package/build/web-http.js +44 -0
- package/build/web-http.js.map +1 -0
- package/build/web-http.test.d.ts +1 -0
- package/build/web-http.test.js +7 -0
- package/build/web-http.test.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TNamed, AStepper } from '@haibun/core/build/lib/defs.js';
|
|
2
|
+
declare const WebHttp: {
|
|
3
|
+
new (): {
|
|
4
|
+
steps: {
|
|
5
|
+
listening: {
|
|
6
|
+
gwta: string;
|
|
7
|
+
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
8
|
+
};
|
|
9
|
+
oidc_config: {
|
|
10
|
+
gwta: string;
|
|
11
|
+
action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
12
|
+
};
|
|
13
|
+
containsContent: {
|
|
14
|
+
gwta: string;
|
|
15
|
+
action: ({ url, what }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
16
|
+
};
|
|
17
|
+
matchesContent: {
|
|
18
|
+
gwta: string;
|
|
19
|
+
action: ({ url, what }: TNamed) => Promise<import("@haibun/core/build/lib/defs.js").TOKActionResult | import("@haibun/core/build/lib/defs.js").TNotOKActionResult>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
world?: import("@haibun/core/build/lib/defs.js").TWorld;
|
|
23
|
+
close?(): void;
|
|
24
|
+
endFeature?(): void;
|
|
25
|
+
onFailure?(result: import("@haibun/core/build/lib/defs.js").TStepResult): void;
|
|
26
|
+
setWorld(world: import("@haibun/core/build/lib/defs.js").TWorld, steppers: AStepper[]): void;
|
|
27
|
+
getWorld(): import("@haibun/core/build/lib/defs.js").TWorld;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export default WebHttp;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
}
|
|
15
|
+
},
|
|
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 } } });
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
containsContent: {
|
|
26
|
+
gwta: 'fetch from {url} contains {what}',
|
|
27
|
+
action: async ({ url, what }) => {
|
|
28
|
+
const response = await fetch(url);
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
return text.includes(what) ? OK : actionNotOK(`${url} does not contain ${what}, it contains ${text}`);
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
matchesContent: {
|
|
34
|
+
gwta: 'fetch from {url} matches {what}',
|
|
35
|
+
action: async ({ url, what }) => {
|
|
36
|
+
const response = await fetch(url);
|
|
37
|
+
const text = await response.text();
|
|
38
|
+
return text === what ? OK : actionNotOK(`${url} does not contain ${what}, it contains ${text}`);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default WebHttp;
|
|
44
|
+
//# sourceMappingURL=web-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,KAAK,GAAG;QACN,SAAS,EAAE;YACT,IAAI,EAAE,yBAAyB;YAC/B,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAU,EAAE,EAAE;gBAChC,IAAI;oBACF,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;oBACjB,OAAO,EAAE,CAAC;iBACX;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,WAAW,CAAC,GAAG,GAAG,mBAAmB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;iBACzG;YACH,CAAC;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,iDAAiD;YACvD,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAU,EAAE,EAAE;gBAChC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,mCAAmC,CAAC,CAAC;gBACxE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,IAAI,iBAAiB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAA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,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/web-http",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.28.
|
|
4
|
+
"version": "1.28.10",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "build/web-http.js",
|
|
7
7
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@haibun/core": "1.28.
|
|
22
|
+
"@haibun/core": "1.28.10"
|
|
23
23
|
},
|
|
24
24
|
"gitHead": "7cf9680bd922fb622fb59f1e6bf5b65284cb8fd5"
|
|
25
25
|
}
|