@toa.io/core 1.0.0-alpha.200 → 1.0.0-alpha.203

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/core",
3
- "version": "1.0.0-alpha.200",
3
+ "version": "1.0.0-alpha.203",
4
4
  "description": "Toa Core",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -26,5 +26,5 @@
26
26
  "error-value": "0.3.0",
27
27
  "openspan": "1.0.0-alpha.173"
28
28
  },
29
- "gitHead": "35b4adeedae2e9450ef44a74f42a53eff20ee203"
29
+ "gitHead": "d8997112ff3f275ec2079dc6e314e405e19f201a"
30
30
  }
@@ -29,14 +29,14 @@ class Entity {
29
29
  }
30
30
 
31
31
  set (value, optional = false) {
32
+ if (!optional)
33
+ this.#guard(value)
34
+
32
35
  const error = optional ? this.#schema.fitOptional(value) : this.#schema.fit(value)
33
36
 
34
37
  if (error !== null)
35
38
  throw new EntityContractException(error, value)
36
39
 
37
- if (!optional)
38
- this.#guard(value)
39
-
40
40
  this.#set(value)
41
41
  }
42
42
 
package/src/receiver.js CHANGED
@@ -54,7 +54,11 @@ class Receiver extends Connector {
54
54
  try {
55
55
  await this.#local.invoke(this.#endpoint, request)
56
56
  } catch (error) {
57
- console.error('Receiver error', error)
57
+ console.error('Receiver error', {
58
+ component: this.#local.locator.id,
59
+ endpoint: this.#endpoint,
60
+ error
61
+ })
58
62
 
59
63
  throw error
60
64
  }
@@ -23,14 +23,14 @@ it('should create initial', () => {
23
23
  const initial = factory.init(id)
24
24
 
25
25
  expect(initial).toBeInstanceOf(mock.Entity)
26
- expect(initial.constructor).toHaveBeenCalledWith(fixtures.schema, id)
26
+ expect(initial.constructor).toHaveBeenCalledWith(fixtures.schema, id, expect.any(Function))
27
27
  })
28
28
 
29
29
  it('should create instance', () => {
30
30
  const object = factory.object(fixtures.entity)
31
31
 
32
32
  expect(object).toBeInstanceOf(mock.Entity)
33
- expect(object.constructor).toHaveBeenCalledWith(fixtures.schema, fixtures.entity)
33
+ expect(object.constructor).toHaveBeenCalledWith(fixtures.schema, fixtures.entity, expect.any(Function))
34
34
  })
35
35
 
36
36
  it('should create set', () => {
@@ -39,7 +39,7 @@ it('should create set', () => {
39
39
  expect(objects).toBeInstanceOf(mock.EntitySet)
40
40
 
41
41
  const instances = fixtures.set.map((entity, index) => {
42
- expect(mock.Entity).toHaveBeenNthCalledWith(index + 1, fixtures.schema, entity)
42
+ expect(mock.Entity).toHaveBeenNthCalledWith(index + 1, fixtures.schema, entity, expect.any(Function))
43
43
 
44
44
  return mock.Entity.mock.instances[index]
45
45
  })
@@ -19,14 +19,6 @@ it('should provide object', async () => {
19
19
  expect(fixtures.factory.object).toHaveBeenCalledWith(fixtures.storage.get.mock.results[0].value)
20
20
  })
21
21
 
22
- it('should provide objects', async () => {
23
- const set = await state.objects(fixtures.query)
24
-
25
- expect(fixtures.storage.find).toHaveBeenCalledWith(fixtures.query)
26
- expect(set).toStrictEqual(fixtures.factory.objects.mock.results[0].value)
27
- expect(fixtures.factory.objects).toHaveBeenCalledWith(fixtures.storage.find.mock.results[0].value)
28
- })
29
-
30
22
  it('should store entity', async () => {
31
23
  await state.commit(fixtures.initial)
32
24
 
@@ -10,6 +10,7 @@ export interface Query {
10
10
  sort?: Array<string>
11
11
  projection?: Array<string>
12
12
  version?: number
13
+ deleted?: boolean
13
14
  }
14
15
 
15
16
  export interface Request {