moost 0.5.30 → 0.5.32

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/dist/index.cjs CHANGED
@@ -113,7 +113,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
113
113
  /**
114
114
  * Get Infact instance (used for Dependency Injections)
115
115
  */ function getNewMoostInfact() {
116
- return new __prostojs_infact.Infact({
116
+ const infactInstance = new __prostojs_infact.Infact({
117
117
  describeClass(classConstructor) {
118
118
  const meta = getMoostMate().read(classConstructor);
119
119
  return {
@@ -125,7 +125,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
125
125
  scopeId: meta?.injectable === "FOR_EVENT" ? (0, __wooksjs_event_core.useEventId)().getId() : void 0
126
126
  };
127
127
  },
128
- resolveParam({ paramMeta, customData, classConstructor, index, scopeId }) {
128
+ resolveParam({ paramMeta, customData, classConstructor, index, scopeId, instantiate }) {
129
129
  if (paramMeta && customData?.pipes) return runPipes(customData.pipes, void 0, {
130
130
  paramMeta,
131
131
  type: classConstructor,
@@ -133,14 +133,15 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
133
133
  scopeId,
134
134
  classMeta: getMoostMate().read(classConstructor),
135
135
  index,
136
- targetMeta: paramMeta
136
+ targetMeta: paramMeta,
137
+ instantiate
137
138
  }, "PARAM");
138
139
  },
139
140
  describeProp(classConstructor, key) {
140
141
  const meta = getMoostMate().read(classConstructor, key);
141
142
  return meta;
142
143
  },
143
- resolveProp({ instance, key, initialValue, propMeta, scopeId, classMeta, customData, classConstructor }) {
144
+ resolveProp({ instance, key, initialValue, propMeta, scopeId, classMeta, customData, classConstructor, instantiate }) {
144
145
  if (propMeta && customData?.pipes) return runPipes(customData.pipes, initialValue, {
145
146
  instance,
146
147
  type: classConstructor,
@@ -148,7 +149,8 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
148
149
  scopeId,
149
150
  propMeta,
150
151
  targetMeta: propMeta,
151
- classMeta
152
+ classMeta,
153
+ instantiate
152
154
  }, "PROP");
153
155
  },
154
156
  storeProvideRegByInstance: true,
@@ -167,6 +169,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
167
169
  if (!loggingOptions.error) return;
168
170
  break;
169
171
  }
172
+ default:
170
173
  }
171
174
  let logger;
172
175
  try {
@@ -207,6 +210,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
207
210
  }
208
211
  }
209
212
  });
213
+ return infactInstance;
210
214
  }
211
215
 
212
216
  //#endregion
@@ -517,7 +521,8 @@ async function bindControllerMethods(options) {
517
521
  type: classConstructor,
518
522
  key: method,
519
523
  index: i,
520
- targetMeta: paramMeta
524
+ targetMeta: paramMeta,
525
+ instantiate: (t) => useControllerContext().instantiate(t)
521
526
  }, "PARAM");
522
527
  return args;
523
528
  };
package/dist/index.d.ts CHANGED
@@ -185,6 +185,7 @@ interface TPipeMetas<T extends TObject = TEmpty> {
185
185
  type: TFunction;
186
186
  index?: number;
187
187
  key: string | symbol;
188
+ instantiate: <T extends TObject>(t: TClassConstructor<T>) => Promise<T>;
188
189
  }
189
190
  interface TPipeFn<T extends TObject = TEmpty> {
190
191
  (value: unknown, metas: TPipeMetas<T>, level: TDecoratorLevel): unknown | Promise<unknown>;
package/dist/index.mjs CHANGED
@@ -90,7 +90,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
90
90
  /**
91
91
  * Get Infact instance (used for Dependency Injections)
92
92
  */ function getNewMoostInfact() {
93
- return new Infact({
93
+ const infactInstance = new Infact({
94
94
  describeClass(classConstructor) {
95
95
  const meta = getMoostMate().read(classConstructor);
96
96
  return {
@@ -102,7 +102,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
102
102
  scopeId: meta?.injectable === "FOR_EVENT" ? useEventId().getId() : void 0
103
103
  };
104
104
  },
105
- resolveParam({ paramMeta, customData, classConstructor, index, scopeId }) {
105
+ resolveParam({ paramMeta, customData, classConstructor, index, scopeId, instantiate }) {
106
106
  if (paramMeta && customData?.pipes) return runPipes(customData.pipes, void 0, {
107
107
  paramMeta,
108
108
  type: classConstructor,
@@ -110,14 +110,15 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
110
110
  scopeId,
111
111
  classMeta: getMoostMate().read(classConstructor),
112
112
  index,
113
- targetMeta: paramMeta
113
+ targetMeta: paramMeta,
114
+ instantiate
114
115
  }, "PARAM");
115
116
  },
116
117
  describeProp(classConstructor, key) {
117
118
  const meta = getMoostMate().read(classConstructor, key);
118
119
  return meta;
119
120
  },
120
- resolveProp({ instance, key, initialValue, propMeta, scopeId, classMeta, customData, classConstructor }) {
121
+ resolveProp({ instance, key, initialValue, propMeta, scopeId, classMeta, customData, classConstructor, instantiate }) {
121
122
  if (propMeta && customData?.pipes) return runPipes(customData.pipes, initialValue, {
122
123
  instance,
123
124
  type: classConstructor,
@@ -125,7 +126,8 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
125
126
  scopeId,
126
127
  propMeta,
127
128
  targetMeta: propMeta,
128
- classMeta
129
+ classMeta,
130
+ instantiate
129
131
  }, "PROP");
130
132
  },
131
133
  storeProvideRegByInstance: true,
@@ -144,6 +146,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
144
146
  if (!loggingOptions.error) return;
145
147
  break;
146
148
  }
149
+ default:
147
150
  }
148
151
  let logger;
149
152
  try {
@@ -184,6 +187,7 @@ const scopeVarsMap = /* @__PURE__ */ new Map();
184
187
  }
185
188
  }
186
189
  });
190
+ return infactInstance;
187
191
  }
188
192
 
189
193
  //#endregion
@@ -494,7 +498,8 @@ async function bindControllerMethods(options) {
494
498
  type: classConstructor,
495
499
  key: method,
496
500
  index: i,
497
- targetMeta: paramMeta
501
+ targetMeta: paramMeta,
502
+ instantiate: (t) => useControllerContext().instantiate(t)
498
503
  }, "PARAM");
499
504
  return args;
500
505
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "description": "moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -32,12 +32,12 @@
32
32
  "prostojs"
33
33
  ],
34
34
  "dependencies": {
35
- "@prostojs/infact": "^0.3.3",
35
+ "@prostojs/infact": "^0.3.6",
36
36
  "@prostojs/logger": "^0.4.3",
37
37
  "@prostojs/mate": "^0.3.3",
38
- "@wooksjs/event-core": "^0.6.1",
38
+ "@wooksjs/event-core": "^0.6.2",
39
39
  "hookable": "^5.5.3",
40
- "wooks": "^0.6.1"
40
+ "wooks": "^0.6.2"
41
41
  },
42
42
  "author": "Artem Maltsev",
43
43
  "license": "MIT",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/moost#readme",
48
48
  "devDependencies": {
49
- "@wooksjs/event-http": "^0.6.1",
50
- "@wooksjs/http-body": "^0.6.1",
49
+ "@wooksjs/event-http": "^0.6.2",
50
+ "@wooksjs/http-body": "^0.6.2",
51
51
  "vitest": "3.2.4",
52
- "@moostjs/event-http": "^0.5.30"
52
+ "@moostjs/event-http": "^0.5.32"
53
53
  },
54
54
  "scripts": {
55
55
  "pub": "pnpm publish --access public",