@yopdev/dev-server 3.0.3-beta.1 → 3.0.3-beta.2

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.
@@ -23,7 +23,7 @@ class DynamoDbTableCloudFormation {
23
23
  command: command,
24
24
  ttlAttribute: resource.TimeToLiveSpecification?.AttributeName,
25
25
  }))))
26
- .tap(() => this.LOGGER.info('configured'))
26
+ .tap(() => this.LOGGER.debug('configured'))
27
27
  .then((service) => service.start(config));
28
28
  this.stop = () => Promise.resolve();
29
29
  this.createTableCommand = async (definition, throughput) => new client_dynamodb_1.CreateTableCommand({
@@ -17,7 +17,7 @@ class CloudFormationSetup {
17
17
  .then(async (routes) => this.afterStart(this.name, config, routes));
18
18
  this.resolvedHandlers = async () => {
19
19
  const template = this.template(this.name);
20
- this.LOGGER.info('parsing %s', template);
20
+ this.LOGGER.debug('parsing %s', template);
21
21
  const definition = this.parseApiEvents(template);
22
22
  const functions = this.handlers(this.name);
23
23
  const routes = Object.values(definition)
@@ -33,7 +33,7 @@ class CloudFormationSetup {
33
33
  this.handlerResolver(event, handler) :
34
34
  Promise.reject(new Error(`function ${event.Handler} defined in ${(0, path_1.resolve)(template)} not found in ${(0, path_1.resolve)(functions)}`)))
35
35
  .then((handler) => {
36
- this.LOGGER.info(this.logHandler(handler));
36
+ this.LOGGER.debug(this.logHandler(handler));
37
37
  return handler;
38
38
  })));
39
39
  return Promise.all(routes);
@@ -10,7 +10,7 @@ class Container {
10
10
  constructor(name, image, networkAlias, environment, bindMounts, exposedPorts, logConsumer, startup, endpointBuilder) {
11
11
  this.name = name;
12
12
  this.networkAlias = networkAlias;
13
- this.start = async (config) => Promise.resolve(this.LOGGER.info('start'))
13
+ this.start = async (config) => Promise.resolve(this.LOGGER.debug('start'))
14
14
  .then(() => this.container
15
15
  .withNetwork(config.network)
16
16
  .withNetworkAliases(this.networkAlias)
@@ -19,7 +19,7 @@ class Lazy {
19
19
  async start(config) {
20
20
  const local = this.configurable(config);
21
21
  this.started = local;
22
- this.LOGGER.info('DISCOVERY:%s', local.name);
22
+ this.LOGGER.debug('DISCOVERY:%s', local.name);
23
23
  return local.start(config);
24
24
  }
25
25
  withStartedOr(task, fallback) {
@@ -38,8 +38,8 @@ class Promised {
38
38
  this.start = async (config) => configurable(config)
39
39
  .catch((e) => e?.cleanup?.() ?? Promise.reject(e))
40
40
  .then((service) => initialized = service)
41
- .tap((service) => this.LOGGER.info('DISCOVERY:%s', service.name))
41
+ .tap((service) => this.LOGGER.debug('DISCOVERY:%s', service.name))
42
42
  .then((service) => service.start(config));
43
- this.stop = async () => (initialized ?? { stop: async () => this.LOGGER.info('not started') }).stop();
43
+ this.stop = async () => (initialized ?? { stop: async () => this.LOGGER.warn('not started') }).stop();
44
44
  }
45
45
  }
@@ -24,7 +24,7 @@ class DynamoDbTableCreator {
24
24
  AttributeName: attributeName,
25
25
  }
26
26
  }))
27
- .tap((out) => this.LOGGER.info('set ttl attribute %s? %s', attributeName, out.$metadata.httpStatusCode === 200))
27
+ .tap((out) => this.LOGGER.debug('set ttl attribute %s? %s', attributeName, out.$metadata.httpStatusCode === 200))
28
28
  .then(() => undefined);
29
29
  this.stop = () => Promise.resolve();
30
30
  this.LOGGER = logging_1.LoggerFactory.create(`TABLE[${name}]`);
@@ -34,11 +34,11 @@ class InternalQueue {
34
34
  consumer.on('processing_error', (err) => {
35
35
  this.LOGGER.error(err, 'failed to process message');
36
36
  });
37
- this.LOGGER.info('consumer for %s initialized', name);
37
+ this.LOGGER.debug('consumer for %s initialized', name);
38
38
  return consumer;
39
39
  })
40
40
  .then(async (consumer) => consumer.start())
41
- .then(() => this.LOGGER.info('started'))
41
+ .then(() => this.LOGGER.debug('started'))
42
42
  .then(() => this);
43
43
  this.stop = async () => this.consumer !== undefined ? (0, stoppable_1.stopConsumer)(this.visibility, this.consumer) : this.LOGGER.warn('no consumer');
44
44
  this.LOGGER = logging_1.LoggerFactory.create(`INTERNALQUEUE[${name}]`);
@@ -46,7 +46,7 @@ class InternalQueue {
46
46
  async createQueue(sqs, name) {
47
47
  return this.creator(sqs)(name) //
48
48
  .then((queue) => {
49
- this.LOGGER.info('created: %s', queue.url);
49
+ this.LOGGER.debug('created: %s', queue.url);
50
50
  return queue;
51
51
  });
52
52
  }
@@ -39,7 +39,7 @@ class LambdaHttpProxy {
39
39
  .find(() => true) ?? this.fallback)(request, body, response);
40
40
  this.server = new http_server_1.HttpServer(name, settings, this.resolveRoute);
41
41
  this.LOGGER = logging_1.LoggerFactory.create(`HTTP->LAMBDA[${this.name}]`);
42
- this.LOGGER.info('registered %i routes', routes.length);
42
+ this.LOGGER.debug('registered %i routes', routes.length);
43
43
  }
44
44
  }
45
45
  class Response {
@@ -14,6 +14,6 @@ class PreTrafficHooks {
14
14
  .then(() => undefined);
15
15
  this.stop = async () => Promise.resolve();
16
16
  this.LOGGER = logging_1.LoggerFactory.create(`PRETRAFFIC[${name}]`);
17
- this.LOGGER.info('%i hooks registered', hooks.length);
17
+ this.LOGGER.debug('%i hooks registered', hooks.length);
18
18
  }
19
19
  }
@@ -15,6 +15,6 @@ class ScheduledTasks {
15
15
  .then(() => undefined);
16
16
  this.stop = async () => Promise.resolve(this.intervals.forEach((interval) => (0, timers_1.clearInterval)(interval)));
17
17
  this.LOGGER = logging_1.LoggerFactory.create(`SCHEDULER[${name}]`);
18
- this.LOGGER.info('registered %i scheduled tasks', schedules.length);
18
+ this.LOGGER.debug('registered %i scheduled tasks', schedules.length);
19
19
  }
20
20
  }
@@ -16,10 +16,10 @@ class Service {
16
16
  .then(() => Promise.reject(error)))
17
17
  .then((started) => this
18
18
  .callbackOrDefault(started)
19
- .then(() => this.LOGGER.info('started'))
19
+ .then(() => this.LOGGER.debug('started'))
20
20
  .then(() => started));
21
21
  this.doStop = () => stop()
22
- .then(() => this.LOGGER.info('stopped'));
22
+ .then(() => this.LOGGER.debug('stopped'));
23
23
  this.stop = () => this.doStop();
24
24
  }
25
25
  }
@@ -60,7 +60,7 @@ class SnsHttpProxy {
60
60
  };
61
61
  this.server = new http_server_1.HttpServer(this.name, this.settings, this.handler(this.method, this.subject));
62
62
  this.LOGGER = logging_1.LoggerFactory.create(`HTTP->SNS[${name}]`);
63
- this.LOGGER.info('forwarding %s %s events to %s', subject ? `events with ${subject} subject` : 'all', method, topic ?? 'the event bus');
63
+ this.LOGGER.debug('forwarding %s %s events to %s', subject ? `events with ${subject} subject` : 'all', method, topic ?? 'the event bus');
64
64
  }
65
65
  }
66
66
  exports.SnsHttpProxy = SnsHttpProxy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yopdev/dev-server",
3
- "version": "3.0.3-beta.1",
3
+ "version": "3.0.3-beta.2",
4
4
  "scripts": {
5
5
  "compile": "tsc",
6
6
  "pretest": "npm run compile",
@@ -42,7 +42,7 @@ class DynamoDbTableCloudFormation implements Lifecycle<string> {
42
42
  command: command,
43
43
  ttlAttribute: resource.TimeToLiveSpecification?.AttributeName,
44
44
  }))))
45
- .tap(() => this.LOGGER.info('configured'))
45
+ .tap(() => this.LOGGER.debug('configured'))
46
46
  .then((service) => service.start(config))
47
47
 
48
48
  stop = () => Promise.resolve()
@@ -32,7 +32,7 @@ export abstract class CloudFormationSetup<P, H, R, F> implements Startable<F> {
32
32
 
33
33
  private resolvedHandlers = async (): Promise<R[]> => {
34
34
  const template = this.template(this.name);
35
- this.LOGGER.info('parsing %s', template);
35
+ this.LOGGER.debug('parsing %s', template);
36
36
  const definition = this.parseApiEvents(template);
37
37
  const functions = this.handlers(this.name);
38
38
  const routes = Object.values(definition)
@@ -53,7 +53,7 @@ export abstract class CloudFormationSetup<P, H, R, F> implements Startable<F> {
53
53
  this.handlerResolver(event, handler) :
54
54
  Promise.reject(new Error(`function ${event.Handler} defined in ${resolve(template)} not found in ${resolve(functions)}`)))
55
55
  .then((handler) => {
56
- this.LOGGER.info(this.logHandler(handler));
56
+ this.LOGGER.debug(this.logHandler(handler));
57
57
  return handler;
58
58
  }),
59
59
  ),
package/src/container.ts CHANGED
@@ -68,7 +68,7 @@ class Container implements Lifecycle<string> {
68
68
  }
69
69
 
70
70
  start = async (config: DevServerConfig) =>
71
- Promise.resolve(this.LOGGER.info('start'))
71
+ Promise.resolve(this.LOGGER.debug('start'))
72
72
  .then(() => this.container
73
73
  .withNetwork(config.network)
74
74
  .withNetworkAliases(this.networkAlias)
package/src/deferred.ts CHANGED
@@ -20,7 +20,7 @@ class Lazy<I> implements Lifecycle<I> {
20
20
  async start(config: DevServerConfig) {
21
21
  const local = this.configurable(config);
22
22
  this.started = local;
23
- this.LOGGER.info('DISCOVERY:%s', local.name)
23
+ this.LOGGER.debug('DISCOVERY:%s', local.name)
24
24
  return local.start(config);
25
25
  }
26
26
 
@@ -52,9 +52,9 @@ class Promised<I> implements Lifecycle<I> {
52
52
  configurable(config)
53
53
  .catch((e) => e?.cleanup?.() ?? Promise.reject(e))
54
54
  .then((service) => initialized = service)
55
- .tap((service) => this.LOGGER.info('DISCOVERY:%s', service.name))
55
+ .tap((service) => this.LOGGER.debug('DISCOVERY:%s', service.name))
56
56
  .then((service) => service.start(config))
57
57
 
58
- this.stop = async () => (initialized ?? { stop: async () => this.LOGGER.info('not started') }).stop()
58
+ this.stop = async () => (initialized ?? { stop: async () => this.LOGGER.warn('not started') }).stop()
59
59
  }
60
60
  }
package/src/dynamodb.ts CHANGED
@@ -37,7 +37,7 @@ class DynamoDbTableCreator implements Lifecycle<string> {
37
37
  AttributeName: attributeName,
38
38
  }
39
39
  }))
40
- .tap((out) => this.LOGGER.info('set ttl attribute %s? %s', attributeName, out.$metadata.httpStatusCode === 200))
40
+ .tap((out) => this.LOGGER.debug('set ttl attribute %s? %s', attributeName, out.$metadata.httpStatusCode === 200))
41
41
  .then(() => undefined)
42
42
 
43
43
  stop = () => Promise.resolve()
@@ -52,7 +52,7 @@ class InternalQueue implements Lifecycle<string> {
52
52
  private async createQueue(sqs: Sqs, name: string) {
53
53
  return this.creator(sqs)(name) //
54
54
  .then((queue) => {
55
- this.LOGGER.info('created: %s', queue.url);
55
+ this.LOGGER.debug('created: %s', queue.url);
56
56
  return queue;
57
57
  });
58
58
  }
@@ -78,11 +78,11 @@ class InternalQueue implements Lifecycle<string> {
78
78
  consumer.on('processing_error', (err) => {
79
79
  this.LOGGER.error(err, 'failed to process message');
80
80
  });
81
- this.LOGGER.info('consumer for %s initialized', name);
81
+ this.LOGGER.debug('consumer for %s initialized', name);
82
82
  return consumer;
83
83
  })
84
84
  .then(async (consumer) => consumer.start())
85
- .then(() => this.LOGGER.info('started'))
85
+ .then(() => this.LOGGER.debug('started'))
86
86
  .then(() => this)
87
87
 
88
88
  stop = async () => this.consumer !== undefined ? stopConsumer(this.visibility, this.consumer) : this.LOGGER.warn('no consumer')
@@ -40,7 +40,7 @@ class LambdaHttpProxy<Context, Event, HandlerResponse> implements Lifecycle<stri
40
40
  ) {
41
41
  this.server = new HttpServer(name, settings, this.resolveRoute)
42
42
  this.LOGGER = LoggerFactory.create(`HTTP->LAMBDA[${this.name}]`);
43
- this.LOGGER.info('registered %i routes', routes.length)
43
+ this.LOGGER.debug('registered %i routes', routes.length)
44
44
  }
45
45
 
46
46
  start = () => this.server.start()
@@ -13,7 +13,7 @@ class PreTrafficHooks implements Lifecycle<void> {
13
13
  private readonly hooks: () => Promise<void>[]
14
14
  ) {
15
15
  this.LOGGER = LoggerFactory.create(`PRETRAFFIC[${name}]`);
16
- this.LOGGER.info('%i hooks registered', hooks.length);
16
+ this.LOGGER.debug('%i hooks registered', hooks.length);
17
17
  }
18
18
 
19
19
  start = async () => Promise
@@ -12,7 +12,7 @@ class ScheduledTasks implements Lifecycle<void> {
12
12
 
13
13
  constructor(readonly name: string, private readonly schedules: Rate[]) {
14
14
  this.LOGGER = LoggerFactory.create(`SCHEDULER[${name}]`)
15
- this.LOGGER.info('registered %i scheduled tasks', schedules.length);
15
+ this.LOGGER.debug('registered %i scheduled tasks', schedules.length);
16
16
  }
17
17
 
18
18
  intervals: NodeJS.Timeout[] = [];
package/src/services.ts CHANGED
@@ -34,11 +34,11 @@ export class Service<I> implements Lifecycle<I> {
34
34
  )
35
35
  .then((started) => this
36
36
  .callbackOrDefault(started)
37
- .then(() => this.LOGGER.info('started'))
37
+ .then(() => this.LOGGER.debug('started'))
38
38
  .then(() => started)
39
39
  )
40
40
  this.doStop = () => stop()
41
- .then(() => this.LOGGER.info('stopped'))
41
+ .then(() => this.LOGGER.debug('stopped'))
42
42
  this.stop = () => this.doStop();
43
43
  }
44
44
 
@@ -40,7 +40,7 @@ export class SnsHttpProxy implements Lifecycle<string> {
40
40
  this.handler(this.method, this.subject)
41
41
  )
42
42
  this.LOGGER = LoggerFactory.create(`HTTP->SNS[${name}]`)
43
- this.LOGGER.info(
43
+ this.LOGGER.debug(
44
44
  'forwarding %s %s events to %s',
45
45
  subject ? `events with ${subject} subject` : 'all',
46
46
  method,