@haibun/web-http 0.1.1 → 1.8.1

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.
@@ -1,4 +1,27 @@
1
- import { IExtensionConstructor } from '@haibun/core/build/lib/defs';
2
- declare const WebHttp: IExtensionConstructor;
1
+ import { TNamed, AStepper } from '@haibun/core/build/lib/defs';
2
+ declare const WebHttp: {
3
+ new (): {
4
+ steps: {
5
+ listening: {
6
+ gwta: string;
7
+ action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult>;
8
+ };
9
+ oidc_config: {
10
+ gwta: string;
11
+ action: ({ url }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult | import("@haibun/core/build/lib/defs").TNotOKActionResult>;
12
+ };
13
+ hasContent: {
14
+ gwta: string;
15
+ action: ({ url, what }: TNamed) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult | import("@haibun/core/build/lib/defs").TNotOKActionResult>;
16
+ };
17
+ };
18
+ world?: import("@haibun/core/build/lib/defs").TWorld | undefined;
19
+ close?(): void;
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;
24
+ };
25
+ };
3
26
  export default WebHttp;
4
27
  //# sourceMappingURL=web-http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-http.d.ts","sourceRoot":"","sources":["../src/web-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,qBAAqB,EAAc,MAAM,6BAA6B,CAAC;AAG1F,QAAA,MAAM,OAAO,EAAE,qBAqBd,CAAC;AAEF,eAAe,OAAO,CAAC"}
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"}
package/build/web-http.js CHANGED
@@ -6,25 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const got_1 = __importDefault(require("got"));
7
7
  const defs_1 = require("@haibun/core/build/lib/defs");
8
8
  const util_1 = require("@haibun/core/build/lib/util");
9
- const WebHttp = class WebHttp {
10
- constructor(world) {
9
+ const WebHttp = class WebHttp extends defs_1.AStepper {
10
+ constructor() {
11
+ super(...arguments);
11
12
  this.steps = {
12
13
  listening: {
13
- gwta: '{url} is listening',
14
+ gwta: 'http {url} is listening',
14
15
  action: async ({ url }) => {
15
16
  await got_1.default.get({ url, throwHttpErrors: false });
16
17
  return defs_1.OK;
17
18
  },
18
19
  },
19
20
  oidc_config: {
20
- gwta: '{url} has an oidc well-known configuration',
21
+ gwta: 'http {url} has an oidc well-known configuration',
21
22
  action: async ({ url }) => {
22
23
  const json = await got_1.default.get({ url: `${url}/.well-known/openid-configuration` }).json();
23
- return json.authorization_endpoint ? defs_1.OK : util_1.actionNotOK(`${json} not recognized`);
24
+ return json.authorization_endpoint ? defs_1.OK : (0, util_1.actionNotOK)(`${json} not recognized`, { topics: { result: { summary: 'json', details: json } } });
25
+ },
26
+ },
27
+ hasContent: {
28
+ gwta: 'fetch from {url} is {what}',
29
+ action: async ({ url, what }) => {
30
+ const text = await (0, got_1.default)(url).text();
31
+ return text === what ? defs_1.OK : (0, util_1.actionNotOK)(`${url} does not contain ${what}, it contains ${text}`);
24
32
  },
25
33
  },
26
34
  };
27
- this.world = world;
28
35
  }
29
36
  };
30
37
  exports.default = WebHttp;
@@ -1 +1 @@
1
- {"version":3,"file":"web-http.js","sourceRoot":"","sources":["../src/web-http.ts"],"names":[],"mappings":";;;;;AAAA,8CAAsB;AAEtB,sDAA0F;AAC1F,sDAA0D;AA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aACF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,iDAAiD;gBACvD,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAU,EAAE,EAAE;oBAChC,MAAM,IAAI,GAAG,MAAM,aAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,mCAAmC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;oBACtF,OAAQ,IAAY,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAE,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,GAAG,IAAI,iBAAiB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvJ,CAAC;aACF;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,4BAA4B;gBAClC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAU,EAAE,EAAE;oBACtC,MAAM,IAAI,GAAG,MAAM,IAAA,aAAG,EAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;oBACnC,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAE,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,GAAG,GAAG,qBAAqB,IAAI,iBAAiB,IAAI,EAAE,CAAC,CAAA;gBACjG,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CAAA,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const wp = [process.cwd(), 'build', 'web-playwright'].join('/');
4
- describe('web http', () => {
6
+ const web_http_1 = __importDefault(require("./web-http"));
7
+ describe('web-http', () => {
8
+ it('exists', () => {
9
+ expect(web_http_1.default).toBeDefined();
10
+ });
5
11
  });
6
12
  //# 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":";;AAIA,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEhE,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;AAC1B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"web-http.test.js","sourceRoot":"","sources":["../src/web-http.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAAgC;AAEhC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACd,MAAM,CAAC,kBAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haibun/web-http",
3
- "version": "0.1.1",
3
+ "version": "1.8.1",
4
4
  "description": "",
5
5
  "main": "build/web-http.js",
6
6
  "files": [
@@ -35,4 +35,4 @@
35
35
  "tslint": "^6.1.3",
36
36
  "typescript": "^4.1.3"
37
37
  }
38
- }
38
+ }