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

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 (37) hide show
  1. package/README.md +22 -17
  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.map +1 -1
  23. package/dist/src/safePushData.js +44 -71
  24. package/dist/src/safePushData.js.map +1 -1
  25. package/dist/src/type-utils/index.d.ts +3 -0
  26. package/dist/src/type-utils/index.d.ts.map +1 -0
  27. package/dist/src/type-utils/index.js +2 -0
  28. package/dist/src/type-utils/index.js.map +1 -0
  29. package/dist/src/type-utils/types.d.ts +23 -0
  30. package/dist/src/type-utils/types.d.ts.map +1 -0
  31. package/dist/src/type-utils/types.js +2 -0
  32. package/dist/src/type-utils/types.js.map +1 -0
  33. package/dist/src/type-utils/unreachable.d.ts +30 -0
  34. package/dist/src/type-utils/unreachable.d.ts.map +1 -0
  35. package/dist/src/type-utils/unreachable.js +32 -0
  36. package/dist/src/type-utils/unreachable.js.map +1 -0
  37. package/package.json +70 -59
package/README.md CHANGED
@@ -47,25 +47,30 @@ every AJV error per item:
47
47
  ### Placeholder defaults
48
48
 
49
49
  When a constraint fires on a path we placeholder'd ourselves, the wrapper
50
- picks a value that should satisfy it:
51
-
52
- | AJV keyword | Placeholder value |
53
- | ------------------------------------------------------- | ------------------------------- |
54
- | `type: string` | `''` |
55
- | `type: integer` / `number` | `0` |
56
- | `type: boolean` | `false` |
57
- | `type: array` | `[]` |
58
- | `type: object` | `{}` |
59
- | `type: null` | `null` |
60
- | `minLength: N` / `maxLength` | `'_'.repeat(N)` / `''` |
61
- | `minimum: N` / `maximum` | `N` |
62
- | `exclusiveMinimum: N` / `exclusiveMaximum` | `N + 1` / `N - 1` |
63
- | `enum` | First allowed value |
64
- | `format: email` / `uri` / `date` / `date-time` / `uuid` | a static valid example for each |
65
- | Anything else (`pattern`, custom formats…) | Item is dropped. |
50
+ picks a value that should satisfy it. We deliberately only fill in the four
51
+ **empty** values below — they're unambiguously empty and can't be mistaken
52
+ for real data:
53
+
54
+ | AJV keyword | Placeholder value |
55
+ | -------------- | ----------------- |
56
+ | `type: string` | `''` |
57
+ | `type: array` | `[]` |
58
+ | `type: object` | `{}` |
59
+ | `type: null` | `null` |
60
+ | Anything else | Item is dropped. |
61
+
62
+ When a field allows **multiple types** (e.g. `['string', 'null']`), the
63
+ wrapper always picks `null` — it's the cleanest placeholder because it
64
+ commits to no concrete value at all.
65
+
66
+ Everything else (`enum`, `format`, `minLength`, numeric bounds, `type:
67
+ integer` / `number` / `boolean`, …) is **not** placeholdered: a made-up
68
+ email, a first-enum-value, or a fabricated number would silently poison the
69
+ customer's dataset with plausible-looking junk, so the item is dropped
70
+ instead.
66
71
 
67
72
  The retry loop chases one layer of errors per round
68
- (`required` → `type` → `minLength` → push) until either the push succeeds
73
+ (`required` → `type` → push) until either the push succeeds
69
74
  or `maxAttempts` (default 5) is hit.
70
75
 
71
76
  ## Options
@@ -0,0 +1,17 @@
1
+ import { type Ctx } from './structured-logger.js';
2
+ /**
3
+ * Glorified assertion that also logs at `error` level. Throws a plain `Error`
4
+ * by default; pass e.g. Crawlee's `NonRetryableError` or `CriticalError` to
5
+ * control what the failure means to the crawler.
6
+ *
7
+ *
8
+ * ```ts
9
+ * const someEnvVar = process.env.SOME_ENV_VAR; // string | undefined
10
+ * assert(typeof someEnvVar === "string", "some-env-var");
11
+ * // someEnvVar is now guaranteed to be a `string`, unless the assertion fails.
12
+ * assert(someEnvVar, "some-env-var");
13
+ * // someEnvVar is now guaranteed to be a truthy `string` (non-empty), unless the assertion fails.
14
+ * ```
15
+ */
16
+ export declare function assert(cond: unknown, key: string, ctx?: Ctx, ErrorCtor?: new (message: string) => Error): asserts cond;
17
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/qc-logger/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAuB,MAAM,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,MAAM,EACX,GAAG,CAAC,EAAE,GAAG,EACT,SAAS,GAAE,KAAK,OAAO,EAAE,MAAM,KAAK,KAAa,GAClD,OAAO,CAAC,IAAI,CAKd"}
@@ -0,0 +1,23 @@
1
+ import { emit, formatMessage } from './structured-logger.js';
2
+ /**
3
+ * Glorified assertion that also logs at `error` level. Throws a plain `Error`
4
+ * by default; pass e.g. Crawlee's `NonRetryableError` or `CriticalError` to
5
+ * control what the failure means to the crawler.
6
+ *
7
+ *
8
+ * ```ts
9
+ * const someEnvVar = process.env.SOME_ENV_VAR; // string | undefined
10
+ * assert(typeof someEnvVar === "string", "some-env-var");
11
+ * // someEnvVar is now guaranteed to be a `string`, unless the assertion fails.
12
+ * assert(someEnvVar, "some-env-var");
13
+ * // someEnvVar is now guaranteed to be a truthy `string` (non-empty), unless the assertion fails.
14
+ * ```
15
+ */
16
+ export function assert(cond, key, ctx, ErrorCtor = Error) {
17
+ if (cond)
18
+ return;
19
+ const error = new ErrorCtor(formatMessage('assert', key));
20
+ emit('error', 'assert', key, { ...ctx, name: error.name, stack: error.stack });
21
+ throw error;
22
+ }
23
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../src/qc-logger/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAClB,IAAa,EACb,GAAW,EACX,GAAS,EACT,YAA4C,KAAK;IAEjD,IAAI,IAAI;QAAE,OAAO;IACjB,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/E,MAAM,KAAK,CAAC;AAChB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type Ctx } from './structured-logger.js';
2
+ /**
3
+ * Logs an `info`-level checkpoint marking that a point in the run was reached.
4
+ * Unlike the `is*` predicates or {@link assert}, this has no condition — it
5
+ * always emits — so it's meant for tracing progress through a run.
6
+ *
7
+ * @param key - Identifies the checkpoint; emitted as `qc:checkpoint:<key>`.
8
+ * @param ctx - Optional extra fields to attach to the log line.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * checkpoint("started");
13
+ * // logs `qc:checkpoint:started`
14
+ *
15
+ * await doWork();
16
+ * checkpoint("work-done", { itemsProcessed: 42 });
17
+ * // logs `qc:checkpoint:work-done` with { itemsProcessed: 42 }
18
+ * ```
19
+ */
20
+ export declare function checkpoint(key: string, ctx?: Ctx): void;
21
+ /**
22
+ * Conditionally logs an `info`-level checkpoint — only when `cond` is truthy.
23
+ * A convenience wrapper over {@link checkpoint} for guarding a marker behind a
24
+ * condition without an explicit `if` at the call site.
25
+ *
26
+ * @param cond - The condition; the checkpoint is emitted only when it's truthy.
27
+ * @param key - Identifies the checkpoint; emitted as `qc:checkpoint:<key>`.
28
+ * @param ctx - Optional extra fields to attach to the log line.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * checkpointIf(items.length === 0, "empty-batch");
33
+ * // logs `qc:checkpoint:empty-batch` only when the batch is empty
34
+ *
35
+ * checkpointIf(retries > 3, "many-retries", { retries });
36
+ * // logs `qc:checkpoint:many-retries` with { retries } only past the threshold
37
+ * ```
38
+ */
39
+ export declare function checkpointIf(cond: unknown, key: string, ctx?: Ctx): void;
40
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/qc-logger/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAQ,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAExE"}
@@ -0,0 +1,45 @@
1
+ import { emit } from './structured-logger.js';
2
+ /**
3
+ * Logs an `info`-level checkpoint marking that a point in the run was reached.
4
+ * Unlike the `is*` predicates or {@link assert}, this has no condition — it
5
+ * always emits — so it's meant for tracing progress through a run.
6
+ *
7
+ * @param key - Identifies the checkpoint; emitted as `qc:checkpoint:<key>`.
8
+ * @param ctx - Optional extra fields to attach to the log line.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * checkpoint("started");
13
+ * // logs `qc:checkpoint:started`
14
+ *
15
+ * await doWork();
16
+ * checkpoint("work-done", { itemsProcessed: 42 });
17
+ * // logs `qc:checkpoint:work-done` with { itemsProcessed: 42 }
18
+ * ```
19
+ */
20
+ export function checkpoint(key, ctx) {
21
+ emit('info', 'checkpoint', key, ctx);
22
+ }
23
+ /**
24
+ * Conditionally logs an `info`-level checkpoint — only when `cond` is truthy.
25
+ * A convenience wrapper over {@link checkpoint} for guarding a marker behind a
26
+ * condition without an explicit `if` at the call site.
27
+ *
28
+ * @param cond - The condition; the checkpoint is emitted only when it's truthy.
29
+ * @param key - Identifies the checkpoint; emitted as `qc:checkpoint:<key>`.
30
+ * @param ctx - Optional extra fields to attach to the log line.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * checkpointIf(items.length === 0, "empty-batch");
35
+ * // logs `qc:checkpoint:empty-batch` only when the batch is empty
36
+ *
37
+ * checkpointIf(retries > 3, "many-retries", { retries });
38
+ * // logs `qc:checkpoint:many-retries` with { retries } only past the threshold
39
+ * ```
40
+ */
41
+ export function checkpointIf(cond, key, ctx) {
42
+ if (cond)
43
+ checkpoint(key, ctx);
44
+ }
45
+ //# sourceMappingURL=checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/qc-logger/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,GAAS;IAC7C,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa,EAAE,GAAW,EAAE,GAAS;IAC9D,IAAI,IAAI;QAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { checkpoint, checkpointIf } from './checkpoint.js';
2
+ export { assert } from './assert.js';
3
+ export { isFalsy, isTruthy, isNullish, isDefined } from './is.js';
4
+ export { emit, formatMessage } from './structured-logger.js';
5
+ export type { Ctx } from './structured-logger.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/qc-logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { checkpoint, checkpointIf } from './checkpoint.js';
2
+ export { assert } from './assert.js';
3
+ export { isFalsy, isTruthy, isNullish, isDefined } from './is.js';
4
+ export { emit, formatMessage } from './structured-logger.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/qc-logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,116 @@
1
+ import type { Defined, Falsy, Nullish, Truthy } from '../type-utils/types.js';
2
+ import { type Ctx } from './structured-logger.js';
3
+ /**
4
+ * Checks for falsy values and logs a `warning` when they are.
5
+ *
6
+ * Sample usage:
7
+ * ```ts
8
+ * if (isFalsy(someValue, "my-key-here")) {
9
+ * // someValue is falsy, warning gets logged `qc:is:falsy:my-key-here`
10
+ * return; // do my early return
11
+ * }
12
+ * ```
13
+ *
14
+ * The overloads narrow the return type based on what's statically known about
15
+ * `value`: a {@link Truthy} input returns the literal `false`, a {@link Falsy}
16
+ * input returns the literal `true`, and only genuinely uncertain values get the
17
+ * `value is Falsy & T` type guard. This means a redundant call — e.g.
18
+ * `isFalsy` on something the compiler already knows is truthy — produces a
19
+ * branch whose condition is a constant.
20
+ *
21
+ * Enable the `@typescript-eslint/no-unnecessary-condition` rule to have that
22
+ * surfaced as a lint error instead of a silent dead branch. The rule ships with
23
+ * both [typescript-eslint](https://typescript-eslint.io/rules/no-unnecessary-condition/)
24
+ * and [oxlint](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-unnecessary-condition.html)
25
+ * (note: it requires type-aware linting).
26
+ */
27
+ export declare function isFalsy<T>(value: Truthy<T>, key: string, ctx?: Ctx): false;
28
+ export declare function isFalsy(value: Falsy, key: string, ctx?: Ctx): true;
29
+ export declare function isFalsy<T>(value: T, key: string, ctx?: Ctx): value is Falsy & T;
30
+ /**
31
+ * Checks for truthy values and logs a `warning` when they are — the
32
+ * inverse of {@link isFalsy}.
33
+ *
34
+ * Sample usage:
35
+ * ```ts
36
+ * if (isTruthy(someValue, "my-key-here")) {
37
+ * // someValue is truthy, warning gets logged `qc:is:truthy:my-key-here`
38
+ * return someValue; // do my early return
39
+ * }
40
+ * // fallback behavior here
41
+ * ```
42
+ *
43
+ * Mirroring {@link isFalsy}, the overloads narrow the return type based on what's
44
+ * statically known about `value`: a {@link Falsy} input returns the literal
45
+ * `false`, a {@link Truthy} input returns the literal `true`, and only genuinely
46
+ * uncertain values get the `value is Truthy<T>` type guard. A redundant call —
47
+ * e.g. `isTruthy` on something the compiler already knows is falsy — produces a
48
+ * branch whose condition is a constant.
49
+ *
50
+ * Enable the `@typescript-eslint/no-unnecessary-condition` rule to have that
51
+ * surfaced as a lint error instead of a silent dead branch. The rule ships with
52
+ * both [typescript-eslint](https://typescript-eslint.io/rules/no-unnecessary-condition/)
53
+ * and [oxlint](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-unnecessary-condition.html)
54
+ * (note: it requires type-aware linting).
55
+ */
56
+ export declare function isTruthy(value: Falsy, key: string, ctx?: Ctx): false;
57
+ export declare function isTruthy<T>(value: Truthy<T>, key: string, ctx?: Ctx): true;
58
+ export declare function isTruthy<T>(value: T, key: string, ctx?: Ctx): value is Truthy<T>;
59
+ /**
60
+ * Checks for `null | undefined` values and logs a `warning` when they are.
61
+ * Unlike {@link isFalsy}, `0`, `false`, and `""` are not considered a match.
62
+ *
63
+ * Sample usage:
64
+ * ```ts
65
+ * if (isNullish(someValue, "my-key-here")) {
66
+ * // someValue is null or undefined, warning gets logged `qc:is:nullish:my-key-here`
67
+ * return; // do my early return
68
+ * }
69
+ * // keep on truckin'
70
+ * ```
71
+ *
72
+ * Like {@link isFalsy}, the overloads narrow the return type based on what's
73
+ * statically known about `value`: a {@link Defined} input returns the literal
74
+ * `false`, a {@link Nullish} input returns the literal `true`, and only
75
+ * genuinely uncertain values get the `value is Nullish & T` type guard. A
76
+ * redundant call — e.g. `isNullish` on something the compiler already knows is
77
+ * defined — produces a branch whose condition is a constant.
78
+ *
79
+ * Enable the `@typescript-eslint/no-unnecessary-condition` rule to have that
80
+ * surfaced as a lint error instead of a silent dead branch. The rule ships with
81
+ * both [typescript-eslint](https://typescript-eslint.io/rules/no-unnecessary-condition/)
82
+ * and [oxlint](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-unnecessary-condition.html)
83
+ * (note: it requires type-aware linting).
84
+ */
85
+ export declare function isNullish<T>(value: Defined<T>, key: string, ctx?: Ctx): false;
86
+ export declare function isNullish(value: Nullish, key: string, ctx?: Ctx): true;
87
+ export declare function isNullish<T>(value: T, key: string, ctx?: Ctx): value is Nullish & T;
88
+ /**
89
+ * Checks that a value is neither `null` nor `undefined` and logs a
90
+ * `warning` when that's the case — the inverse of {@link isNullish}.
91
+ *
92
+ * Sample usage:
93
+ * ```ts
94
+ * if (isDefined(someValue, "my-key-here")) {
95
+ * // someValue is neither null nor undefined, warning gets logged `qc:is:defined:my-key-here`
96
+ * return; // do my early return
97
+ * }
98
+ * ```
99
+ *
100
+ * Like {@link isFalsy}, the overloads narrow the return type based on what's
101
+ * statically known about `value`: a {@link Nullish} input returns the literal
102
+ * `false`, a {@link Defined} input returns the literal `true`, and only
103
+ * genuinely uncertain values get the `value is Defined<T>` type guard. A
104
+ * redundant call — e.g. `isDefined` on something the compiler already knows is
105
+ * defined — produces a branch whose condition is a constant.
106
+ *
107
+ * Enable the `@typescript-eslint/no-unnecessary-condition` rule to have that
108
+ * surfaced as a lint error instead of a silent dead branch. The rule ships with
109
+ * both [typescript-eslint](https://typescript-eslint.io/rules/no-unnecessary-condition/)
110
+ * and [oxlint](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-unnecessary-condition.html)
111
+ * (note: it requires type-aware linting).
112
+ */
113
+ export declare function isDefined(value: Nullish, key: string, ctx?: Ctx): false;
114
+ export declare function isDefined<T>(value: Defined<T>, key: string, ctx?: Ctx): true;
115
+ export declare function isDefined<T>(value: T, key: string, ctx?: Ctx): value is Defined<T>;
116
+ //# sourceMappingURL=is.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../src/qc-logger/is.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EA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,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;AACxE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,GAAG,CAAC,CAAC;AAOrF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC;AACzE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;AAC9E,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { emit } from './structured-logger.js';
2
+ export function isFalsy(value, key, ctx) {
3
+ const result = !value;
4
+ if (result)
5
+ emit('warning', 'is:falsy', key, ctx);
6
+ return result;
7
+ }
8
+ export function isTruthy(value, key, ctx) {
9
+ const result = Boolean(value);
10
+ if (result)
11
+ emit('warning', 'is:truthy', key, ctx);
12
+ return result;
13
+ }
14
+ export function isNullish(value, key, ctx) {
15
+ const result = value === undefined || value === null;
16
+ if (result)
17
+ emit('warning', 'is:nullish', key, ctx);
18
+ return result;
19
+ }
20
+ export function isDefined(value, key, ctx) {
21
+ const result = value !== undefined && value !== null;
22
+ if (result)
23
+ emit('warning', 'is:defined', key, ctx);
24
+ return result;
25
+ }
26
+ //# sourceMappingURL=is.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.js","sourceRoot":"","sources":["../../../src/qc-logger/is.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAE,MAAM,wBAAwB,CAAC;AA6BxD,MAAM,UAAU,OAAO,CAAI,KAAQ,EAAE,GAAW,EAAE,GAAS;IACvD,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC;IACtB,IAAI,MAAM;QAAE,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC;AA+BD,MAAM,UAAU,QAAQ,CAAI,KAAQ,EAAE,GAAW,EAAE,GAAS;IACxD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,MAAM;QAAE,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC;AAClB,CAAC;AA+BD,MAAM,UAAU,SAAS,CAAI,KAAQ,EAAE,GAAW,EAAE,GAAS;IACzD,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;IACrD,IAAI,MAAM;QAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC;AAClB,CAAC;AA8BD,MAAM,UAAU,SAAS,CAAI,KAAQ,EAAE,GAAW,EAAE,GAAS;IACzD,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;IACrD,IAAI,MAAM;QAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type Ctx = Record<string, unknown>;
2
+ /**
3
+ * Builds the canonical log line (`qc:<verb>:<key>`) without emitting it.
4
+ * Exposed so callers (e.g. `assert`) can reuse the exact same message when
5
+ * constructing an error to throw.
6
+ */
7
+ export declare function formatMessage(qcVerb: string, rawKey: string): string;
8
+ export declare function emit(level: 'debug' | 'info' | 'warning' | 'error', qcVerb: string, rawKey: string, ctx?: Ctx): string;
9
+ //# sourceMappingURL=structured-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-logger.d.ts","sourceRoot":"","sources":["../../../src/qc-logger/structured-logger.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAiB1C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAcrH"}
@@ -0,0 +1,38 @@
1
+ import log from '@apify/log';
2
+ /**
3
+ * Keys are part of the log line's parse structure (`qc:<verb>:<key>`)
4
+ * Turns any string into a valid qc key.
5
+ *
6
+ * If a key is completely invalid, it is replaced with "invalid-key".
7
+ */
8
+ function normalizeKey(key) {
9
+ return (String(key)
10
+ .toLowerCase()
11
+ .replace(/[^a-z0-9-]+/g, '-')
12
+ .replace(/^-|-$/g, '') || 'invalid-key');
13
+ }
14
+ /**
15
+ * Builds the canonical log line (`qc:<verb>:<key>`) without emitting it.
16
+ * Exposed so callers (e.g. `assert`) can reuse the exact same message when
17
+ * constructing an error to throw.
18
+ */
19
+ export function formatMessage(qcVerb, rawKey) {
20
+ return `qc:${qcVerb}:${normalizeKey(rawKey)}`;
21
+ }
22
+ export function emit(level, qcVerb, rawKey, ctx) {
23
+ let message;
24
+ try {
25
+ const qcKey = normalizeKey(rawKey);
26
+ message = formatMessage(qcVerb, rawKey);
27
+ // Caller ctx is spread first so it can never clobber the canonical fields.
28
+ // Run/actor identity is not attached here — Mezmo enriches lines with it.
29
+ log[level](message, { ...ctx, level, qcKey, qcVerb });
30
+ return message;
31
+ }
32
+ catch {
33
+ // Telemetry must never break a run.
34
+ message ??= `qc:unknown:qc-error-generating-key`;
35
+ return message;
36
+ }
37
+ }
38
+ //# sourceMappingURL=structured-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-logger.js","sourceRoot":"","sources":["../../../src/qc-logger/structured-logger.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAI7B;;;;;GAKG;AACH,SAAS,YAAY,CAAC,GAAW;IAC7B,OAAO,CACH,MAAM,CAAC,GAAG,CAAC;SACN,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,aAAa,CAC9C,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,MAAc;IACxD,OAAO,MAAM,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,KAA6C,EAAE,MAAc,EAAE,MAAc,EAAE,GAAS;IACzG,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,2EAA2E;QAC3E,0EAA0E;QAC1E,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACL,oCAAoC;QACpC,OAAO,KAAK,oCAAoC,CAAC;QACjD,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {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EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,EACd,OAAO,GAAE,mBAAwB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAehC"}
@@ -1,6 +1,13 @@
1
1
  // safePushData: parse the Apify dataset schema-validation error, repair the
2
2
  // offending items (strip bad fields, placeholder missing required ones), and
3
3
  // retry the push.
4
+ //
5
+ // NOTE: instead of recursively healing the data one error-round at a time, we
6
+ // could parse the Actor's `dataset_schema.json` up front and fix every item in
7
+ // a single pass (we'd know each field's expected type / constraints without
8
+ // waiting for the API to report them). That would avoid the multi-round retry
9
+ // loop, but requires heavier code (locating + loading the schema, resolving
10
+ // $refs, walking the schema tree). Something to consider in the future.
4
11
  const SCHEMA_ERROR_TYPE = 'schema-validation-error';
5
12
  export function isSchemaValidationError(err) {
6
13
  if (!err || typeof err !== 'object')
@@ -167,80 +174,46 @@ function cleanItemFields(item, validationErrors, placeholderPaths) {
167
174
  return cloned;
168
175
  }
169
176
  // Pick a value that will satisfy `err.keyword` on a placeholder field.
170
- // Returns ok:false when we don't have a sensible default (e.g. `pattern`,
171
- // custom formats); the caller drops the item in that case.
177
+ // Returns ok:false when we don't have a sensible default; the caller drops
178
+ // the item in that case.
179
+ //
180
+ // We deliberately only placeholder the four "empty" values — `''`, `[]`, `{}`,
181
+ // and `null`. These are unambiguously empty and can't be mistaken for real
182
+ // data. We do NOT fabricate values for `enum`, `format`, `minLength`, numeric
183
+ // bounds, etc.: a made-up email, a first-enum-value, or a `'_'.repeat(N)`
184
+ // string all silently poison the customer's dataset with plausible-looking
185
+ // junk. Better to drop the item than to lie about its contents. As a result
186
+ // the only keyword we handle is `type` (only for those four target types) —
187
+ // everything else falls through to ok:false and the item is dropped.
172
188
  function placeholderFor(err) {
173
189
  const params = err.params ?? {};
174
- switch (err.keyword) {
175
- case 'type': {
176
- // params.type is the expected type as a string, or array of strings.
177
- const t = Array.isArray(params.type) ? params.type[0] : params.type;
178
- switch (t) {
179
- case 'string':
180
- return { ok: true, value: '' };
181
- case 'integer':
182
- case 'number':
183
- return { ok: true, value: 0 };
184
- case 'boolean':
185
- return { ok: true, value: false };
186
- case 'array':
187
- return { ok: true, value: [] };
188
- case 'object':
189
- return { ok: true, value: {} };
190
- case 'null':
191
- return { ok: true, value: null };
192
- default:
193
- break;
194
- }
195
- return { ok: false };
196
- }
197
- case 'minLength': {
198
- const limit = Number(params.limit) || 1;
199
- return { ok: true, value: '_'.repeat(limit) };
200
- }
201
- case 'maxLength':
202
- return { ok: true, value: '' };
203
- case 'minimum':
204
- case 'exclusiveMinimum': {
205
- const limit = Number(params.limit);
206
- if (!Number.isFinite(limit))
207
- return { ok: false };
208
- return { ok: true, value: err.keyword === 'exclusiveMinimum' ? limit + 1 : limit };
209
- }
210
- case 'maximum':
211
- case 'exclusiveMaximum': {
212
- const limit = Number(params.limit);
213
- if (!Number.isFinite(limit))
214
- return { ok: false };
215
- return { ok: true, value: err.keyword === 'exclusiveMaximum' ? limit - 1 : limit };
216
- }
217
- case 'enum': {
218
- const allowed = params.allowedValues;
219
- if (Array.isArray(allowed) && allowed.length > 0)
220
- return { ok: true, value: allowed[0] };
221
- return { ok: false };
222
- }
223
- case 'format': {
224
- switch (params.format) {
225
- case 'email':
226
- return { ok: true, value: 'placeholder@example.com' };
227
- case 'uri':
228
- case 'uri-reference':
229
- case 'url':
230
- return { ok: true, value: 'about:blank' };
231
- case 'date':
232
- return { ok: true, value: '1970-01-01' };
233
- case 'date-time':
234
- return { ok: true, value: '1970-01-01T00:00:00Z' };
235
- case 'uuid':
236
- return { ok: true, value: '00000000-0000-0000-0000-000000000000' };
237
- default:
238
- break;
239
- }
240
- return { ok: false };
190
+ if (err.keyword !== 'type')
191
+ return { ok: false };
192
+ // params.type is the expected type as a string, or an array of strings
193
+ // when the field allows multiple types (e.g. `['string', 'null']`).
194
+ const types = Array.isArray(params.type) ? params.type : [params.type];
195
+ // Union type that permits null: prefer null. It's the cleanest possible
196
+ // placeholder — it commits to no concrete value at all — so whenever the
197
+ // schema allows it, that's what we use.
198
+ if (types.length > 1 && types.includes('null')) {
199
+ return { ok: true, value: null };
200
+ }
201
+ // Otherwise take the first allowed type we have an "empty" default for.
202
+ // integer / number / boolean are intentionally absent: 0 / false read as
203
+ // real data, so a field of only those types is dropped instead.
204
+ for (const t of types) {
205
+ switch (t) {
206
+ case 'null':
207
+ return { ok: true, value: null };
208
+ case 'string':
209
+ return { ok: true, value: '' };
210
+ case 'array':
211
+ return { ok: true, value: [] };
212
+ case 'object':
213
+ return { ok: true, value: {} };
214
+ default:
215
+ break;
241
216
  }
242
- default:
243
- break;
244
217
  }
245
218
  return { ok: false };
246
219
  }
@@ -1 +1 @@
1
- {"version":3,"file":"safePushData.js","sourceRoot":"","sources":["../../src/safePushData.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,kBAAkB;AAElB,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AA4BpD,MAAM,UAAU,uBAAuB,CAAC,GAAY;IAChD,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,CAAC,GAAG,GAAqC,CAAC;IAChD,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAmBD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAC9B,MAAiB,EACjB,KAAc,EACd,UAA+B,EAAE;IAEjC,MAA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AC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACpD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACrB,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { unreachable } from './unreachable.js';
2
+ export type { Falsy, Nullish, Truthy, Defined } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { unreachable } from './unreachable.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,23 @@
1
+ export type Falsy = false | 0 | '' | null | undefined;
2
+ export type Nullish = null | undefined;
3
+ /**
4
+ * Narrows `T` to only its truthy members by stripping every {@link Falsy}
5
+ * value (`false`, `0`, `''`, `null`, `undefined`).
6
+ *
7
+ * Unlike `Exclude<T, Falsy>`, this checks each falsy literal individually so a
8
+ * broad type such as `boolean` or `number` is preserved rather than collapsed:
9
+ * `boolean` only loses `false` if `false` is the whole type, not when it's part
10
+ * of `boolean`. Object types short-circuit first, so `''`/`0` don't accidentally
11
+ * match structural (`{}`) types.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * type A = Truthy<string | undefined>; // string
16
+ * type B = Truthy<0 | 1 | 2>; // 1 | 2
17
+ * type C = Truthy<'' | 'hello'>; // 'hello'
18
+ * type D = Truthy<false>; // never
19
+ * ```
20
+ */
21
+ export type Truthy<T> = T extends object ? T : false extends T ? never : 0 extends T ? never : '' extends T ? never : null extends T ? never : undefined extends T ? never : T;
22
+ export type Defined<T> = Exclude<T, Nullish>;
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/type-utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AACtD,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAEhB,CAAC,SAAS,MAAM,GACV,CAAC,GACD,KAAK,SAAS,CAAC,GACb,KAAK,GACL,CAAC,SAAS,CAAC,GACT,KAAK,GACL,EAAE,SAAS,CAAC,GACV,KAAK,GACL,IAAI,SAAS,CAAC,GACZ,KAAK,GACL,SAAS,SAAS,CAAC,GACjB,KAAK,GACL,CAAC,CAAC;AAEtB,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/type-utils/types.ts"],"names":[],"mappings":""}
@@ -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.0",
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
  }