@hazeljs/predictive-scaling 2.0.5 → 2.0.6

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.
@@ -5,7 +5,7 @@ import { PredictiveScalingOptions, ScaleOnEventOptions, ScalePredictOptions } fr
5
5
  * Module-level predictive scaling configuration.
6
6
  */
7
7
  export declare function PredictiveScaling(options: PredictiveScalingOptions): ClassDecorator;
8
- export declare function getPredictiveScaler(constructor: Function): PredictiveScaler | undefined;
8
+ export declare function getPredictiveScaler(constructor: object): PredictiveScaler | undefined;
9
9
  /**
10
10
  * Method-level hook to record demand signals for forecasting.
11
11
  */
@@ -14,7 +14,7 @@ export declare function ScalePredict(options?: ScalePredictOptions): MethodDecor
14
14
  * Register event-driven scaling triggers on a service class.
15
15
  */
16
16
  export declare function ScaleOnEvent(options: ScaleOnEventOptions): ClassDecorator;
17
- export declare function startPredictiveScaling(constructor: Function): void;
18
- export declare function stopPredictiveScaling(constructor: Function): void;
19
- export declare function emitScalingEvent(constructor: Function, eventName: string): Promise<void>;
17
+ export declare function startPredictiveScaling(constructor: object): void;
18
+ export declare function stopPredictiveScaling(constructor: object): void;
19
+ export declare function emitScalingEvent(constructor: object, eventName: string): Promise<void>;
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAA0B,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAQ9F;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,cAAc,CAQnF;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAIvF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,eAAe,CAgC/E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,CAIzE;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,QAAQ,GAAG,IAAI,CAElE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,QAAQ,GAAG,IAAI,CAEjE;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK9F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAA0B,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAU9F;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,cAAc,CAQnF;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAGrF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,eAAe,CAgC/E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,CAIzE;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5F"}
@@ -27,7 +27,8 @@ function PredictiveScaling(options) {
27
27
  };
28
28
  }
29
29
  function getPredictiveScaler(constructor) {
30
- return (Reflect.getMetadata(MODULE_SCALER_KEY, constructor) ?? globalRegistry.get(constructor.name));
30
+ const named = constructor;
31
+ return Reflect.getMetadata(MODULE_SCALER_KEY, constructor) ?? globalRegistry.get(named.name);
31
32
  }
32
33
  /**
33
34
  * Method-level hook to record demand signals for forecasting.
@@ -1 +1 @@
1
- {"version":3,"file":"ai-forecast-provider.d.ts","sourceRoot":"","sources":["../../src/forecast/ai-forecast-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CAuCtF;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBADT,KAAK,GAAE,OAAO,UAAU,EAAE,aAAsC,EAChE,QAAQ,CAAC,EAAE,gBAAgB,YAAA;IAGxC,QAAQ,CACZ,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,YAAY,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;CAU3B"}
1
+ {"version":3,"file":"ai-forecast-provider.d.ts","sourceRoot":"","sources":["../../src/forecast/ai-forecast-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CA2CtF;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBADT,KAAK,GAAE,OAAO,UAAU,EAAE,aAAsC,EAChE,QAAQ,CAAC,EAAE,gBAAgB,YAAA;IAGxC,QAAQ,CACZ,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,YAAY,EAAE,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;CAU3B"}
@@ -32,7 +32,7 @@ function forecastExponentialSmoothing(metric, samples, horizonMs, alpha = 0.35,
32
32
  const dt = Math.max(1, last.timestamp - sorted[0].timestamp);
33
33
  const steps = Math.max(1, horizonMs / (dt / Math.max(1, sorted.length - 1)));
34
34
  const predictedValue = Math.max(0, level + trend * steps);
35
- const residuals = sorted.slice(1).map((sample, index) => {
35
+ const residuals = sorted.slice(1).map((sample) => {
36
36
  const expected = level;
37
37
  return Math.abs(sample.value - expected);
38
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazeljs/predictive-scaling",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Predictive auto-scaling for HazelJS - traffic forecasting, proactive HPA adjustments, and event-driven scaling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,9 +20,9 @@
20
20
  "reflect-metadata": "^0.2.2"
21
21
  },
22
22
  "peerDependencies": {
23
- "@hazeljs/core": "^2.0.5",
24
- "@hazeljs/self-healing": "^2.0.5",
25
- "@hazeljs/ai": "^2.0.5"
23
+ "@hazeljs/core": "^2.0.6",
24
+ "@hazeljs/self-healing": "^2.0.6",
25
+ "@hazeljs/ai": "^2.0.6"
26
26
  },
27
27
  "peerDependenciesMeta": {
28
28
  "@hazeljs/self-healing": {
@@ -33,9 +33,9 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
- "@hazeljs/core": "^2.0.5",
37
- "@hazeljs/self-healing": "^2.0.5",
38
- "@hazeljs/ai": "^2.0.5",
36
+ "@hazeljs/core": "^2.0.6",
37
+ "@hazeljs/self-healing": "^2.0.6",
38
+ "@hazeljs/ai": "^2.0.6",
39
39
  "@types/jest": "^29.5.14",
40
40
  "@types/node": "^20.19.39",
41
41
  "@typescript-eslint/eslint-plugin": "^8.58.0",