@apify/actor-utils 0.1.2 → 0.1.3-beta.1

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.
Files changed (38) hide show
  1. package/README.md +73 -27
  2. package/dist/src/qc-logger/assert.d.ts +17 -0
  3. package/dist/src/qc-logger/assert.d.ts.map +1 -0
  4. package/dist/src/qc-logger/assert.js +23 -0
  5. package/dist/src/qc-logger/assert.js.map +1 -0
  6. package/dist/src/qc-logger/checkpoint.d.ts +40 -0
  7. package/dist/src/qc-logger/checkpoint.d.ts.map +1 -0
  8. package/dist/src/qc-logger/checkpoint.js +45 -0
  9. package/dist/src/qc-logger/checkpoint.js.map +1 -0
  10. package/dist/src/qc-logger/index.d.ts +6 -0
  11. package/dist/src/qc-logger/index.d.ts.map +1 -0
  12. package/dist/src/qc-logger/index.js +5 -0
  13. package/dist/src/qc-logger/index.js.map +1 -0
  14. package/dist/src/qc-logger/is.d.ts +116 -0
  15. package/dist/src/qc-logger/is.d.ts.map +1 -0
  16. package/dist/src/qc-logger/is.js +26 -0
  17. package/dist/src/qc-logger/is.js.map +1 -0
  18. package/dist/src/qc-logger/structured-logger.d.ts +9 -0
  19. package/dist/src/qc-logger/structured-logger.d.ts.map +1 -0
  20. package/dist/src/qc-logger/structured-logger.js +38 -0
  21. package/dist/src/qc-logger/structured-logger.js.map +1 -0
  22. package/dist/src/safePushData.d.ts +16 -6
  23. package/dist/src/safePushData.d.ts.map +1 -1
  24. package/dist/src/safePushData.js +267 -131
  25. package/dist/src/safePushData.js.map +1 -1
  26. package/dist/src/type-utils/index.d.ts +3 -0
  27. package/dist/src/type-utils/index.d.ts.map +1 -0
  28. package/dist/src/type-utils/index.js +2 -0
  29. package/dist/src/type-utils/index.js.map +1 -0
  30. package/dist/src/type-utils/types.d.ts +23 -0
  31. package/dist/src/type-utils/types.d.ts.map +1 -0
  32. package/dist/src/type-utils/types.js +2 -0
  33. package/dist/src/type-utils/types.js.map +1 -0
  34. package/dist/src/type-utils/unreachable.d.ts +30 -0
  35. package/dist/src/type-utils/unreachable.d.ts.map +1 -0
  36. package/dist/src/type-utils/unreachable.js +32 -0
  37. package/dist/src/type-utils/unreachable.js.map +1 -0
  38. package/package.json +70 -59
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Asserts that a code path is unreachable, enabling exhaustiveness checks.
3
+ *
4
+ * Pass a value of type `never` to this function to let the TypeScript compiler
5
+ * verify that all cases of a union have been handled. If a new variant is added
6
+ * to the union but not handled, the call becomes a compile-time error. At
7
+ * runtime, reaching this function throws an `Error`.
8
+ *
9
+ * @param x - The value that should be of type `never` at this point.
10
+ * @throws {Error} Always throws, since this code should never be reached.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * type Shape = 'circle' | 'square';
15
+ *
16
+ * function area(shape: Shape): number {
17
+ * switch (shape) {
18
+ * case 'circle':
19
+ * return Math.PI;
20
+ * case 'square':
21
+ * return 1;
22
+ * default:
23
+ * // Compile-time error here if a new Shape variant is unhandled.
24
+ * return unreachable(shape);
25
+ * }
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function unreachable(x: never): never;
30
+ //# sourceMappingURL=unreachable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unreachable.d.ts","sourceRoot":"","sources":["../../../src/type-utils/unreachable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAE3C"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Asserts that a code path is unreachable, enabling exhaustiveness checks.
3
+ *
4
+ * Pass a value of type `never` to this function to let the TypeScript compiler
5
+ * verify that all cases of a union have been handled. If a new variant is added
6
+ * to the union but not handled, the call becomes a compile-time error. At
7
+ * runtime, reaching this function throws an `Error`.
8
+ *
9
+ * @param x - The value that should be of type `never` at this point.
10
+ * @throws {Error} Always throws, since this code should never be reached.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * type Shape = 'circle' | 'square';
15
+ *
16
+ * function area(shape: Shape): number {
17
+ * switch (shape) {
18
+ * case 'circle':
19
+ * return Math.PI;
20
+ * case 'square':
21
+ * return 1;
22
+ * default:
23
+ * // Compile-time error here if a new Shape variant is unhandled.
24
+ * return unreachable(shape);
25
+ * }
26
+ * }
27
+ * ```
28
+ */
29
+ export function unreachable(x) {
30
+ throw new Error(`unreachable: ${x}`);
31
+ }
32
+ //# sourceMappingURL=unreachable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unreachable.js","sourceRoot":"","sources":["../../../src/type-utils/unreachable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,63 +1,74 @@
1
1
  {
2
- "name": "@apify/actor-utils",
3
- "version": "0.1.2",
4
- "type": "module",
5
- "description": "Wrapper around Actor.pushData that survives dataset schema-validation failures by stripping offending fields and retrying. Callers pass the actual push function as pushFn.",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/apify/apify-actor-utils.git"
2
+ "name": "@apify/actor-utils",
3
+ "version": "0.1.3-beta.1",
4
+ "type": "module",
5
+ "description": "Wrapper around Actor.pushData that survives dataset schema-validation failures by stripping offending fields and retrying. Callers pass the actual push function as pushFn.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/apify/apify-actor-utils.git"
9
+ },
10
+ "engines": {
11
+ "node": ">=22.6.0"
12
+ },
13
+ "types": "./dist/index.d.ts",
14
+ "main": "./dist/index.js",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
9
19
  },
10
- "engines": {
11
- "node": ">=22.6.0"
20
+ "./qc-logger": {
21
+ "types": "./dist/src/qc-logger/index.d.ts",
22
+ "default": "./dist/src/qc-logger/index.js"
12
23
  },
13
- "types": "./dist/index.d.ts",
14
- "main": "./dist/index.js",
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./dist/index.js"
19
- }
20
- },
21
- "files": [
22
- "dist/index.js",
23
- "dist/index.js.map",
24
- "dist/index.d.ts",
25
- "dist/index.d.ts.map",
26
- "dist/src"
27
- ],
28
- "scripts": {
29
- "build": "tsc",
30
- "typecheck": "tsc --noEmit",
31
- "lint": "eslint",
32
- "lint:fix": "eslint --fix",
33
- "format": "prettier --write .",
34
- "format:check": "prettier --check .",
35
- "test": "tsc && node --test dist/test/*.test.js",
36
- "check:pushdata": "node scripts/check-pushdata.mjs",
37
- "check-unused": "knip",
38
- "ci": "npm run typecheck && npm run lint && npm run format:check && npm run check:pushdata && npm test",
39
- "probe": "node scripts/probe-errors.mjs",
40
- "prepare": "husky .husky || true"
41
- },
42
- "lint-staged": {
43
- "*.js": "eslint",
44
- "*.ts": "eslint",
45
- "*.mjs": "eslint"
46
- },
47
- "devDependencies": {
48
- "@apify/eslint-config": "^1.2.0",
49
- "@apify/tsconfig": "^0.1.2",
50
- "@types/node": "^25.9.1",
51
- "apify-client": "^2.10.0",
52
- "eslint": "^9.39.4",
53
- "eslint-config-prettier": "^10.1.8",
54
- "globals": "^17.7.0",
55
- "husky": "^9.1.7",
56
- "knip": "^5.88.1",
57
- "lint-staged": "^15.5.2",
58
- "prettier": "^3.9.4",
59
- "typescript": "^6.0.3",
60
- "typescript-eslint": "^8.62.1"
61
- },
62
- "license": "ISC"
24
+ "./type-utils": {
25
+ "types": "./dist/src/type-utils/index.d.ts",
26
+ "default": "./dist/src/type-utils/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist/index.js",
31
+ "dist/index.js.map",
32
+ "dist/index.d.ts",
33
+ "dist/index.d.ts.map",
34
+ "dist/src"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "typecheck": "tsc --noEmit",
39
+ "lint": "eslint",
40
+ "lint:fix": "eslint --fix",
41
+ "format": "prettier --write .",
42
+ "format:check": "prettier --check .",
43
+ "test": "tsc && node --test dist/test/*.test.js",
44
+ "check:pushdata": "node scripts/check-pushdata.mjs",
45
+ "check-unused": "knip",
46
+ "ci": "npm run typecheck && npm run lint && npm run format:check && npm run check:pushdata && npm test",
47
+ "probe": "node scripts/probe-errors.mjs",
48
+ "prepare": "husky .husky || true"
49
+ },
50
+ "lint-staged": {
51
+ "*.js": "eslint",
52
+ "*.ts": "eslint",
53
+ "*.mjs": "eslint"
54
+ },
55
+ "devDependencies": {
56
+ "@apify/eslint-config": "^1.2.0",
57
+ "@apify/tsconfig": "^0.1.2",
58
+ "@types/node": "^25.9.1",
59
+ "apify-client": "^2.10.0",
60
+ "eslint": "^9.39.4",
61
+ "eslint-config-prettier": "^10.1.8",
62
+ "globals": "^17.7.0",
63
+ "husky": "^9.1.7",
64
+ "knip": "^5.88.1",
65
+ "lint-staged": "^15.5.2",
66
+ "prettier": "^3.9.4",
67
+ "typescript": "^6.0.3",
68
+ "typescript-eslint": "^8.62.1"
69
+ },
70
+ "license": "ISC",
71
+ "peerDependencies": {
72
+ "@apify/log": "^2.5.44"
73
+ }
63
74
  }