@travetto/context 7.0.0-rc.0 → 7.0.0-rc.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.
package/README.md CHANGED
@@ -36,16 +36,16 @@ export class ContextAwareService {
36
36
  @WithAsyncContext()
37
37
  async complexOperator(name: string) {
38
38
  this.context.set(NameSymbol, name);
39
- await this.additionalOp('extra');
40
- await this.finalOp();
39
+ await this.additionalOperation('extra');
40
+ await this.finalOperation();
41
41
  }
42
42
 
43
- async additionalOp(additional: string) {
43
+ async additionalOperation(additional: string) {
44
44
  const name = this.context.get(NameSymbol);
45
45
  this.context.set(NameSymbol, `${name} ${additional}`);
46
46
  }
47
47
 
48
- async finalOp() {
48
+ async finalOperation() {
49
49
  const name = this.context.get(NameSymbol);
50
50
  // Use name
51
51
  return name;
@@ -86,16 +86,16 @@ export class ContextValueService {
86
86
  @WithAsyncContext()
87
87
  async complexOperator(name: string) {
88
88
  this.#name.set(name);
89
- await this.additionalOp('extra');
90
- await this.finalOp();
89
+ await this.additionalOperation('extra');
90
+ await this.finalOperation();
91
91
  }
92
92
 
93
- async additionalOp(additional: string) {
93
+ async additionalOperation(additional: string) {
94
94
  const name = this.#name.get();
95
95
  this.#name.set(`${name} ${additional}`);
96
96
  }
97
97
 
98
- async finalOp() {
98
+ async finalOperation() {
99
99
  const name = this.#name.get();
100
100
  // Use name
101
101
  return name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/context",
3
- "version": "7.0.0-rc.0",
3
+ "version": "7.0.0-rc.2",
4
4
  "description": "Async-aware state management, maintaining context across asynchronous calls.",
5
5
  "keywords": [
6
6
  "async-hooks",
@@ -26,10 +26,10 @@
26
26
  "directory": "module/context"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/di": "^7.0.0-rc.0"
29
+ "@travetto/di": "^7.0.0-rc.2"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/test": "^7.0.0-rc.0"
32
+ "@travetto/test": "^7.0.0-rc.2"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@travetto/test": {
package/src/decorator.ts CHANGED
@@ -12,12 +12,12 @@ export function WithAsyncContext() {
12
12
  property: string,
13
13
  descriptor: AsyncMethodDescriptor<T>
14
14
  ): typeof descriptor {
15
- const og = descriptor.value!;
16
- descriptor.value = function (...args: unknown[]): ReturnType<typeof og> {
17
- return this.context.run(og.bind(this, ...args));
15
+ const handle = descriptor.value!;
16
+ descriptor.value = function (...args: unknown[]): ReturnType<typeof handle> {
17
+ return this.context.run(handle.bind(this, ...args));
18
18
  };
19
19
 
20
- Object.defineProperty(descriptor.value, 'name', { value: og.name });
20
+ Object.defineProperty(descriptor.value, 'name', { value: handle.name });
21
21
 
22
22
  return descriptor;
23
23
  };
package/src/service.ts CHANGED
@@ -43,8 +43,8 @@ export class AsyncContext {
43
43
  /**
44
44
  * Set context field by key
45
45
  */
46
- set<T = unknown>(key: string | symbol, val: T | undefined): void {
47
- this.#get()[key] = val;
46
+ set<T = unknown>(key: string | symbol, value: T | undefined): void {
47
+ this.#get()[key] = value;
48
48
  }
49
49
 
50
50
  /**
@@ -73,8 +73,8 @@ export class AsyncContext {
73
73
  out.add(item);
74
74
  }
75
75
  out.close();
76
- } catch (err) {
77
- out.throw(castTo(err));
76
+ } catch (error) {
77
+ out.throw(castTo(error));
78
78
  }
79
79
  });
80
80
  return out;