nginxwebnodeplugin 1.0.256 → 1.0.259
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/index.d.ts +13 -12
- package/index.js +1 -1
- package/package.json +1 -1
- package/type.d.ts +7 -9
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CheckReachabilityOptions, RecursivePartial } from 'clientnode/type';
|
|
2
|
-
import { PluginHandler } from 'web-node/type';
|
|
3
|
-
import { Configuration,
|
|
2
|
+
import { PluginHandler, PluginPromises } from 'web-node/type';
|
|
3
|
+
import { Configuration, ServicePromisesState } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* Launches an application server und triggers all some pluginable hooks on
|
|
6
6
|
* an event.
|
|
@@ -9,23 +9,24 @@ export declare class Nginx implements PluginHandler {
|
|
|
9
9
|
/**
|
|
10
10
|
* Start nginx's child process and return a Promise which observes this
|
|
11
11
|
* service.
|
|
12
|
-
* @param
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
12
|
+
* @param state - Application state.
|
|
13
|
+
* @param state.configuration - Applications configuration.
|
|
14
|
+
* @param state.configuration.applicationServer - Plugins configuration.
|
|
15
|
+
* @param state.services - An object with stored service instances.
|
|
16
16
|
*
|
|
17
|
-
* @returns A
|
|
18
|
-
*
|
|
17
|
+
* @returns A mapping to promises which correspond to the plugin specific
|
|
18
|
+
* continues services.
|
|
19
19
|
*/
|
|
20
|
-
static loadService(
|
|
20
|
+
static loadService({ configuration: { applicationServer: configuration }, services }: ServicePromisesState): Promise<null | PluginPromises>;
|
|
21
21
|
/**
|
|
22
22
|
* Application will be closed soon.
|
|
23
|
-
* @param
|
|
24
|
-
* @param configuration -
|
|
23
|
+
* @param state - Application state.
|
|
24
|
+
* @param state.configuration - Applications configuration.
|
|
25
|
+
* @param state.services - Application services.
|
|
25
26
|
*
|
|
26
27
|
* @returns Given object of services.
|
|
27
28
|
*/
|
|
28
|
-
static shouldExit(
|
|
29
|
+
static shouldExit({ configuration, services }: ServicePromisesState): Promise<void>;
|
|
29
30
|
/**
|
|
30
31
|
* Check if a nginx server is currently (not) running.
|
|
31
32
|
* @param serverConfiguration - Mutable by plugins extended configuration
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("child_process"),require("clientnode"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/extends","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator","child_process","clientnode"],r);else{var
|
|
1
|
+
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("child_process"),require("clientnode"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/extends","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator","child_process","clientnode"],r);else{var t="object"==typeof exports?r(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("child_process"),require("clientnode")):r(e["@babel/runtime/helpers/extends"],e["@babel/runtime/helpers/asyncToGenerator"],e["@babel/runtime/regenerator"],e.child_process,e.clientnode);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,((e,r,t,n,o)=>(()=>{"use strict";var a=[,r=>{r.exports=e},e=>{e.exports=r},e=>{e.exports=t},e=>{e.exports=n},e=>{e.exports=o}],i={};function c(e){var r=i[e];if(void 0!==r)return r.exports;var t=i[e]={exports:{}};return a[e](t,t.exports,c),t.exports}c.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return c.d(r,{a:r}),r},c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{c.r(s),c.d(s,{Nginx:()=>d,default:()=>f});var e=c(1),r=c.n(e),t=c(2),n=c.n(t),o=c(3),a=c.n(o),i=c(4),u=c(5),l=c.n(u);function p(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?b(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}var d=function(){function e(){}return e.loadService=function(){var r=n()(a().mark((function r(t){var n,o,c,s;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.configuration.applicationServer,o=t.services,!Object.prototype.hasOwnProperty.call(o,"nginx")){r.next=3;break}return r.abrupt("return",null);case 3:return c=(0,i.spawn)("nginx",[],{cwd:process.cwd(),env:process.env,shell:!0,stdio:"inherit"}),o.nginx=c,c.reload=function(){return new Promise((function(e,r){return(0,i.exec)("nginx -s reload",(function(t,n,o){t?(t.standardErrorOutput=o,r(t)):e(n)}))}))},s=new Promise((function(e,r){for(var t,o,a=p(u.CloseEventNames);!(t=a()).done;)o=t.value,c.on(o,l().getProcessCloseHandler(e,n.proxy.optional?e:r,{reason:c,process:c}))})),r.prev=7,r.next=10,e.checkReachability(n);case 10:r.next=21;break;case 12:if(r.prev=12,r.t0=r.catch(7),!n.proxy.optional){r.next=20;break}o.nginx=null,s=null,r.next=21;break;case 20:throw r.t0;case 21:return r.abrupt("return",{nginx:s});case 22:case"end":return r.stop()}}),r,null,[[7,12]])})));return function(){return r.apply(this,arguments)}}(),e.shouldExit=function(){var r=n()(a().mark((function r(t){var n,o;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.configuration,null===(o=t.services).nginx){r.next=5;break}return o.nginx.kill("SIGINT"),r.next=5,e.checkReachability(n.applicationServer,!0);case 5:delete o.nginx;case 6:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}(),e.checkReachability=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n={}),0<Object.values(e.proxy.ports.backend).length){var o="http"+(443===Object.values(e.proxy.ports.backend)[0]?"s":"")+"://"+e.hostName+":"+Object.values(e.proxy.ports.backend)[0],a=r()({options:{redirect:"manual"},pollIntervallInSeconds:.1,statusCodes:[100,101,102,200,201,202,203,204,205,206,207,208,226,300,301,302,303,304,305,306,307,308],timeoutInSeconds:3,wait:!0},n);return(t?l().checkUnreachability:l().checkReachability)(o,a)}return Promise.resolve(null)},e}();const f=d})(),s})()));
|
package/package.json
CHANGED
package/type.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ChildProcess } from 'child_process';
|
|
3
3
|
import { Mapping, ProcessCloseReason } from 'clientnode/type';
|
|
4
4
|
import { Configuration as BaseConfiguration, Services as BaseServices, ServicePromises as BaseServicePromises } from 'application-server-web-node-plugin/type';
|
|
5
|
-
import {
|
|
5
|
+
import { ServicePromisesState as BaseServicePromisesState, ServicesState as BaseServicesState } from 'web-node/type';
|
|
6
6
|
export declare type Configuration<PluginConfigurationType = Mapping<unknown>> = BaseConfiguration<{
|
|
7
7
|
applicationServer: {
|
|
8
8
|
proxy: {
|
|
@@ -17,16 +17,14 @@ export declare type Configuration<PluginConfigurationType = Mapping<unknown>> =
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
}> & PluginConfigurationType;
|
|
20
|
-
export interface Service extends BaseService {
|
|
21
|
-
name: 'nginx';
|
|
22
|
-
promise: null | Promise<ProcessCloseReason>;
|
|
23
|
-
}
|
|
24
20
|
export interface ServiceProcess extends ChildProcess {
|
|
25
21
|
reload(): Promise<string>;
|
|
26
22
|
}
|
|
27
|
-
export declare type ServicePromises<
|
|
23
|
+
export declare type ServicePromises<Type = Mapping<unknown>> = BaseServicePromises<{
|
|
28
24
|
nginx: Promise<ProcessCloseReason>;
|
|
29
|
-
}> &
|
|
30
|
-
export declare type Services<
|
|
25
|
+
}> & Type;
|
|
26
|
+
export declare type Services<Type = Mapping<unknown>> = BaseServices<{
|
|
31
27
|
nginx: null | ServiceProcess;
|
|
32
|
-
}> &
|
|
28
|
+
}> & Type;
|
|
29
|
+
export declare type ServicesState = BaseServicesState<undefined, Configuration, Services>;
|
|
30
|
+
export declare type ServicePromisesState = BaseServicePromisesState<undefined, Configuration, Services, ServicePromises>;
|