@t4h.framework/sleep 0.3.10 → 0.3.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @t4h.framework/sleep
2
2
 
3
+ ## 0.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
8
+ - harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
9
+ - hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
10
+ - oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
11
+ - `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
12
+
3
13
  ## 0.3.10
4
14
 
5
15
  ## 0.3.9
@@ -5,7 +5,7 @@ export type SleepActivityInput = {
5
5
  export declare class SleepActivity extends AsyncActivity<readonly [duration: number | string], SleepActivityInput, void, void, SleepActivityInput, never> {
6
6
  toInput(duration: number | string): SleepActivityInput;
7
7
  bootstrap(input: SleepActivityInput): import("@t4h.framework/core").AsyncActivityResultPending<SleepActivityInput, never>;
8
- advance(): import("@t4h.framework/core").AsyncActivityResultRejected<void | import("@t4h.framework/core").Serializable>;
8
+ advance(): import("@t4h.framework/core").AsyncActivityResultRejected<import("@t4h.framework/core").SerializableOrVoid>;
9
9
  onTimeout(): import("@t4h.framework/core").AsyncActivityResultFulfilled<void | undefined>;
10
10
  toOutput(): undefined;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parse-duration.d.ts","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAiBA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA2B/D"}
1
+ {"version":3,"file":"parse-duration.d.ts","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAiBA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA4B/D"}
@@ -11,20 +11,20 @@ export function parseDuration(duration) {
11
11
  const isDurationInMs = typeof duration === 'number';
12
12
  if (isDurationInMs) {
13
13
  if (!Number.isFinite(duration) || duration < 0)
14
- throw new Error(`Invalid sleep duration: ${duration}`);
14
+ throw new Error(`Invalid sleep duration: ${String(duration)}`);
15
15
  return duration;
16
16
  }
17
17
  const trimmed = duration.trim();
18
18
  if (!trimmed)
19
19
  throw new Error('Invalid sleep duration: empty string');
20
20
  const match = DURATION_PATTERN.exec(trimmed);
21
- if (!match)
21
+ const [, rawValue, rawUnit] = match ?? [];
22
+ if (rawValue === undefined || rawUnit === undefined)
22
23
  throw new Error(`Invalid sleep duration: ${duration}`);
23
- const value = Number(match[1]);
24
- const unit = match[2].toLowerCase();
25
- const multiplier = UNIT_TO_MS.get(unit);
24
+ const value = Number(rawValue);
25
+ const multiplier = UNIT_TO_MS.get(rawUnit.toLowerCase());
26
26
  if (!multiplier)
27
- throw new Error(`Invalid sleep duration unit: ${match[2]}`);
27
+ throw new Error(`Invalid sleep duration unit: ${rawUnit}`);
28
28
  return Math.round(value * multiplier);
29
29
  }
30
30
  //# sourceMappingURL=parse-duration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-duration.js","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GACpB,uIAAuI,CAAA;AAEzI,MAAM,YAAY,GAAG;IACnB,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE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,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QAEhE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IAE/B,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IAErE,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAE5C,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,KAAK,IAAI,EAAE,CAAA;IAEzC,IAAI,QAAQ,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS;QACjD,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAA;IAExD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IAE9B,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IAExD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAA;IAE3E,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,CAAA;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/sleep",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Sleep module for the T4H Framework",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/sleep",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -26,12 +26,14 @@
26
26
  "scripts": {
27
27
  "build": "tsc --project tsconfig.build.json",
28
28
  "check-types": "tsc --noEmit",
29
+ "check-package": "publint --strict && attw --pack . --profile esm-only",
30
+ "lint": "eslint . --max-warnings 0",
29
31
  "prepublishOnly": "yarn build",
30
32
  "test": "vitest run",
31
33
  "test:watch": "vitest"
32
34
  },
33
35
  "devDependencies": {
34
- "@t4h.framework/core": "^0.19.0",
36
+ "@t4h.framework/core": "^0.20.0",
35
37
  "typescript": "^5.9.3",
36
38
  "vitest": "^4.0.18"
37
39
  },