@outputai/core 0.10.1-dev.b7b2fbe.0 → 0.10.1-next.1070949.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 (77) hide show
  1. package/package.json +8 -7
  2. package/src/bus.js +58 -20
  3. package/src/bus.spec.js +135 -77
  4. package/src/consts.js +5 -2
  5. package/src/errors.d.ts +12 -2
  6. package/src/errors.js +17 -3
  7. package/src/errors.spec.js +19 -0
  8. package/src/helpers/activity_options.js +21 -0
  9. package/src/helpers/activity_options.spec.js +55 -0
  10. package/src/helpers/error_serializer.js +236 -0
  11. package/src/helpers/error_serializer.spec.js +413 -0
  12. package/src/helpers/errors.js +23 -14
  13. package/src/helpers/errors.spec.js +31 -75
  14. package/src/helpers/fetch.js +1 -38
  15. package/src/helpers/fetch.spec.js +1 -39
  16. package/src/helpers/function.js +13 -0
  17. package/src/helpers/function.spec.js +23 -1
  18. package/src/helpers/object.js +5 -1
  19. package/src/helpers/object.spec.js +5 -0
  20. package/src/helpers/redact.js +51 -0
  21. package/src/helpers/redact.spec.js +66 -0
  22. package/src/helpers/string.js +10 -0
  23. package/src/helpers/string.spec.js +36 -1
  24. package/src/hooks/index.d.ts +76 -78
  25. package/src/hooks/index.js +57 -49
  26. package/src/hooks/index.spec.js +104 -105
  27. package/src/hooks/pending_hooks.js +24 -0
  28. package/src/hooks/pending_hooks.spec.js +62 -0
  29. package/src/interface/evaluator.d.ts +10 -9
  30. package/src/interface/evaluator.js +1 -6
  31. package/src/interface/evaluator.spec.js +10 -10
  32. package/src/interface/index.js +2 -1
  33. package/src/interface/step.d.ts +16 -15
  34. package/src/interface/step.js +1 -6
  35. package/src/interface/step.spec.js +10 -10
  36. package/src/interface/validations/index.js +33 -53
  37. package/src/interface/validations/index.spec.js +25 -17
  38. package/src/interface/webhook.js +1 -2
  39. package/src/interface/webhook.spec.js +25 -19
  40. package/src/interface/workflow.d.ts +25 -18
  41. package/src/interface/workflow.js +24 -52
  42. package/src/interface/workflow.spec.js +109 -108
  43. package/src/interface/workflow_activity_options.js +2 -5
  44. package/src/interface/workflow_utils.d.ts +15 -0
  45. package/src/interface/workflow_utils.js +19 -0
  46. package/src/interface/workflow_utils.spec.js +82 -1
  47. package/src/sdk/runtime/events.d.ts +4 -6
  48. package/src/sdk/runtime/events.js +2 -15
  49. package/src/sdk/runtime/events.spec.js +14 -92
  50. package/src/tracing/trace_engine.js +9 -11
  51. package/src/tracing/trace_engine.spec.js +67 -28
  52. package/src/worker/catalog_workflow/catalog_job.js +3 -3
  53. package/src/worker/catalog_workflow/catalog_job.spec.js +1 -1
  54. package/src/worker/configs.js +0 -3
  55. package/src/worker/global_functions.js +2 -2
  56. package/src/worker/global_functions.spec.js +3 -3
  57. package/src/worker/index.js +20 -11
  58. package/src/worker/index.spec.js +29 -16
  59. package/src/worker/interceptors/activity.js +34 -21
  60. package/src/worker/interceptors/activity.spec.js +77 -172
  61. package/src/worker/interceptors/workflow.js +53 -11
  62. package/src/worker/interceptors/workflow.spec.js +176 -49
  63. package/src/worker/loader/workflows.js +16 -3
  64. package/src/worker/loader/workflows.spec.js +37 -5
  65. package/src/worker/log_hooks.js +22 -19
  66. package/src/worker/log_hooks.spec.js +14 -6
  67. package/src/worker/sinks.js +8 -8
  68. package/src/worker/sinks.spec.js +9 -9
  69. package/src/worker/telemetry.js +2 -1
  70. package/src/worker/temporal_logger.js +33 -0
  71. package/src/worker/temporal_logger.spec.js +90 -0
  72. package/src/helpers/aggregations.js +0 -44
  73. package/src/helpers/aggregations.spec.js +0 -92
  74. package/src/tracing/tools/utils.js +0 -42
  75. package/src/tracing/tools/utils.spec.js +0 -83
  76. package/src/worker/proxy.js +0 -20
  77. package/src/worker/proxy.spec.js +0 -51
@@ -1,89 +1,45 @@
1
1
  import { describe, expect, it } from 'vitest';
2
- import { ApplicationFailure } from '@temporalio/common';
3
- import { buildApplicationFailureWithDetails } from './errors.js';
2
+ import { inheritsFromAnyNamedType } from './errors.js';
4
3
 
5
- class CustomFailure extends Error {}
4
+ describe( 'inheritsFromAnyNamedType', () => {
5
+ class BaseFailure extends Error {}
6
+ class DomainFailure extends BaseFailure {}
7
+ class RequestFailure extends DomainFailure {}
8
+ class UnrelatedFailure extends Error {}
6
9
 
7
- describe( 'buildApplicationFailureWithDetails', () => {
8
- it( 'wraps a regular error in an ApplicationFailure with appended details', () => {
9
- const error = new Error( 'step failed' );
10
- const info = { aggregations: { cost: { total: 1 } } };
10
+ it( 'matches exact, parent, and grandparent constructor names', () => {
11
+ const error = new RequestFailure( 'request failed' );
11
12
 
12
- const failure = buildApplicationFailureWithDetails( error, info );
13
-
14
- expect( failure ).toBeInstanceOf( ApplicationFailure );
15
- expect( failure ).toMatchObject( {
16
- message: 'step failed',
17
- type: 'Error',
18
- nonRetryable: false,
19
- details: [ info ],
20
- cause: error
21
- } );
22
- } );
23
-
24
- it( 'uses the original constructor name for custom errors', () => {
25
- const error = new CustomFailure( 'custom failed' );
26
- const info = { trace: { destinations: { local: '/tmp/trace' } } };
27
-
28
- const failure = buildApplicationFailureWithDetails( error, info );
29
-
30
- expect( failure ).toMatchObject( {
31
- message: 'custom failed',
32
- type: 'CustomFailure',
33
- details: [ info ],
34
- cause: error
35
- } );
13
+ expect( inheritsFromAnyNamedType( error, [ 'RequestFailure' ] ) ).toBe( true );
14
+ expect( inheritsFromAnyNamedType( error, [ 'DomainFailure' ] ) ).toBe( true );
15
+ expect( inheritsFromAnyNamedType( error, [ 'BaseFailure' ] ) ).toBe( true );
16
+ expect( inheritsFromAnyNamedType( error, [ 'OtherFailure', 'BaseFailure' ] ) ).toBe( true );
36
17
  } );
37
18
 
38
- it( 'preserves existing details and appends new info without mutating the original error', () => {
39
- const existingDetails = [ { domain: { reason: 'bad-input' } } ];
40
- const error = new Error( 'step failed' );
41
- error.details = existingDetails;
42
- const info = { aggregations: { httpRequests: { total: 1 } } };
43
-
44
- const failure = buildApplicationFailureWithDetails( error, info );
45
-
46
- expect( failure.details ).toEqual( [
47
- { domain: { reason: 'bad-input' } },
48
- info
49
- ] );
50
- expect( error.details ).toBe( existingDetails );
51
- expect( error.details ).toEqual( [ { domain: { reason: 'bad-input' } } ] );
19
+ it( 'does not match unrelated or descendant constructor names', () => {
20
+ expect( inheritsFromAnyNamedType( new RequestFailure(), [ 'UnrelatedFailure' ] ) ).toBe( false );
21
+ expect( inheritsFromAnyNamedType( new BaseFailure(), [ 'RequestFailure' ] ) ).toBe( false );
22
+ expect( inheritsFromAnyNamedType( new UnrelatedFailure(), [ 'BaseFailure' ] ) ).toBe( false );
52
23
  } );
53
24
 
54
- it( 'ignores non-array details on the original error', () => {
55
- const error = new Error( 'step failed' );
56
- error.details = { domain: { reason: 'bad-input' } };
57
- const info = { aggregations: { tokens: { total: 3 } } };
58
-
59
- const failure = buildApplicationFailureWithDetails( error, info );
25
+ it( 'ignores a spoofed own constructor property', () => {
26
+ const error = new RequestFailure();
27
+ Object.defineProperty( error, 'constructor', {
28
+ value: { name: 'SpoofedFailure' }
29
+ } );
60
30
 
61
- expect( failure.details ).toEqual( [ info ] );
31
+ expect( inheritsFromAnyNamedType( error, [ 'SpoofedFailure' ] ) ).toBe( false );
32
+ expect( inheritsFromAnyNamedType( error, [ 'RequestFailure' ] ) ).toBe( true );
62
33
  } );
63
34
 
64
- it( 'preserves ApplicationFailure type, nonRetryable flag, and details while avoiding self-cause', () => {
65
- const original = ApplicationFailure.create( {
66
- message: 'application failed',
67
- type: 'DomainFailure',
68
- nonRetryable: true,
69
- details: [ { domain: { reason: 'bad-input' } } ]
70
- } );
71
- const info = { aggregations: { cost: { total: 2 } } };
72
-
73
- const failure = buildApplicationFailureWithDetails( original, info );
35
+ it( 'rejects empty names and invalid values without false positives', () => {
36
+ const unnamedConstructor = function NamedConstructor() {};
37
+ Object.defineProperty( unnamedConstructor, 'name', { value: '' } );
38
+ const value = Object.create( { constructor: unnamedConstructor } );
74
39
 
75
- expect( failure ).toBeInstanceOf( ApplicationFailure );
76
- expect( failure ).not.toBe( original );
77
- expect( failure.cause ).toBe( original );
78
- expect( failure.cause ).not.toBe( failure );
79
- expect( failure ).toMatchObject( {
80
- message: 'application failed',
81
- type: 'DomainFailure',
82
- nonRetryable: true,
83
- details: [
84
- { domain: { reason: 'bad-input' } },
85
- info
86
- ]
87
- } );
40
+ expect( inheritsFromAnyNamedType( value, [ '', undefined ] ) ).toBe( false );
41
+ expect( inheritsFromAnyNamedType( value, [] ) ).toBe( false );
42
+ expect( inheritsFromAnyNamedType( null, [ 'BaseFailure' ] ) ).toBe( false );
43
+ expect( inheritsFromAnyNamedType( 'failure', [ 'String' ] ) ).toBe( false );
88
44
  } );
89
45
  } );
@@ -1,42 +1,5 @@
1
1
  import { FatalError } from '#errors';
2
-
3
- /** Matches red int "hot-red-pie", but not int "redact" */
4
- const wordMatcher = term => new RegExp( `(?<![a-z\\d])${term}(?![a-z\\d])`, 'i' );
5
-
6
- /** Matches red in "acquired", but not in "redact" */
7
- const wordEndMatcher = term => new RegExp( `${term}(?![a-z\\d])`, 'i' );
8
-
9
- /**
10
- * Redacts sensitive headers
11
- * @param {object} headers
12
- * @returns {object} The redacted headers
13
- */
14
- export const redactHeaders = headers => {
15
- /** Header names that look sensitive by substring rules but are not secret material. */
16
- const ignoreHeaders = new Set( [
17
- 'x-csrf-token',
18
- 'public-key-pins'
19
- ] );
20
-
21
- /** * Sensitive header patterns for redaction (case-insensitive). */
22
- const sensitiveHeadersPatterns = [
23
- // matches headers that contain these exact words
24
- wordMatcher( 'authorization' ),
25
- wordMatcher( 'token' ),
26
- wordMatcher( 'secret' ),
27
- wordMatcher( 'password' ),
28
- wordMatcher( 'pwd' ),
29
- wordMatcher( 'cookie' ),
30
- // matches header that contain words ending with these sequences
31
- wordEndMatcher( 'key' )
32
- ];
33
-
34
- return Object.entries( headers ).reduce( ( redacted, [ key, value ] ) => {
35
- const lowKey = key.toLowerCase();
36
- const isSensitive = !ignoreHeaders.has( lowKey ) && sensitiveHeadersPatterns.some( rx => rx.test( lowKey ) );
37
- return Object.assign( redacted, { [key]: isSensitive ? '[REDACTED]' : value } );
38
- }, {} );
39
- };
2
+ import { redactHeaders } from './redact.js';
40
3
 
41
4
  /**
42
5
  * Consume the body of a Response according it its content-type and returns it
@@ -1,44 +1,6 @@
1
1
  import { afterEach, describe, it, expect } from 'vitest';
2
2
  import { Readable } from 'node:stream';
3
- import { hydrateHeaders, redactHeaders, serializeBodyAndInferContentType, serializeResponse } from './fetch.js';
4
-
5
- describe( 'redactHeaders', () => {
6
- it( 'redacts sensitive header names', () => {
7
- const result = redactHeaders( {
8
- Authorization: 'Bearer token',
9
- 'X-Api-Key': 'api-key',
10
- Cookie: 'session=id',
11
- 'x-client-secret': 'secret'
12
- } );
13
-
14
- expect( result ).toEqual( {
15
- Authorization: '[REDACTED]',
16
- 'X-Api-Key': '[REDACTED]',
17
- Cookie: '[REDACTED]',
18
- 'x-client-secret': '[REDACTED]'
19
- } );
20
- } );
21
-
22
- it( 'preserves non-sensitive header names and ignored false positives', () => {
23
- const result = redactHeaders( {
24
- Accept: 'application/json',
25
- 'Content-Type': 'application/json',
26
- 'x-csrf-token': 'csrf-token',
27
- 'public-key-pins': 'pin'
28
- } );
29
-
30
- expect( result ).toEqual( {
31
- Accept: 'application/json',
32
- 'Content-Type': 'application/json',
33
- 'x-csrf-token': 'csrf-token',
34
- 'public-key-pins': 'pin'
35
- } );
36
- } );
37
-
38
- it( 'handles empty headers', () => {
39
- expect( redactHeaders( {} ) ).toEqual( {} );
40
- } );
41
- } );
3
+ import { hydrateHeaders, serializeBodyAndInferContentType, serializeResponse } from './fetch.js';
42
4
 
43
5
  describe( 'hydrateHeaders', () => {
44
6
  afterEach( () => {
@@ -13,3 +13,16 @@ export const runOnce = fn => {
13
13
  return state.result;
14
14
  };
15
15
  };
16
+
17
+ /**
18
+ * Calls a given function and in case it throws errors, returns `undefined`
19
+ * @param {Function} fn
20
+ * @returns {unknown|undefined}
21
+ */
22
+ export const tryOrUndefined = fn => {
23
+ try {
24
+ return fn();
25
+ } catch {
26
+ return undefined; // eslint-disable-line consistent-return
27
+ }
28
+ };
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { runOnce } from './function.js';
2
+ import { runOnce, tryOrUndefined } from './function.js';
3
3
 
4
4
  describe( 'runOnce', () => {
5
5
  it( 'calls the wrapped function only once', () => {
@@ -46,3 +46,25 @@ describe( 'runOnce', () => {
46
46
  expect( fn ).toHaveBeenCalledOnce();
47
47
  } );
48
48
  } );
49
+
50
+ describe( 'tryOrUndefined', () => {
51
+ it( 'returns the invoked function result', () => {
52
+ const fn = vi.fn( () => 'result' );
53
+
54
+ expect( tryOrUndefined( fn ) ).toBe( 'result' );
55
+ expect( fn ).toHaveBeenCalledOnce();
56
+ } );
57
+
58
+ it( 'returns undefined when the invoked function throws', () => {
59
+ const fn = vi.fn( () => {
60
+ throw new Error( 'unavailable' );
61
+ } );
62
+
63
+ expect( tryOrUndefined( fn ) ).toBeUndefined();
64
+ expect( fn ).toHaveBeenCalledOnce();
65
+ } );
66
+
67
+ it( 'preserves an explicit undefined result', () => {
68
+ expect( tryOrUndefined( () => undefined ) ).toBeUndefined();
69
+ } );
70
+ } );
@@ -44,7 +44,11 @@ export const deepMergeWithResolver = ( base, ...args ) => {
44
44
  const resolver = args.at( -1 );
45
45
 
46
46
  if ( !isPlainObject( base ) ) {
47
- throw new Error( 'First argument is not an object.' );
47
+ throw new Error( 'First argument (base object) is not an object.' );
48
+ }
49
+
50
+ if ( typeof resolver !== 'function' ) {
51
+ throw new Error( 'Last argument (resolver) is not a function.' );
48
52
  }
49
53
 
50
54
  return objects.reduce( ( merged, object ) => {
@@ -224,6 +224,11 @@ describe( 'deepMergeWithResolver', () => {
224
224
  expect( () => deepMergeWithResolver( 'a', {}, ( x, y ) => x + y ) ).toThrow( Error );
225
225
  } );
226
226
 
227
+ it( 'throws when last argument is not a resolver function', () => {
228
+ expect( () => deepMergeWithResolver( { a: 1 }, { a: 2 } ) )
229
+ .toThrow( 'Last argument (resolver) is not a function.' );
230
+ } );
231
+
227
232
  it( 'merges multiple objects using the resolver from left to right', () => {
228
233
  const resolver = vi.fn( ( x, y ) => `${ x }:${ y }` );
229
234
 
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Redacts a given URL object by setting each search param, hash, username and password to '***'
3
+ * @param {URL|string} target
4
+ * @returns {string} Redacted URL as a string
5
+ */
6
+ export const redactUrl = target => {
7
+ const url = new URL( target );
8
+ url.search = new URLSearchParams( url.searchParams.entries().map( ( [ p ] ) => [ p, '***' ] ) ).toString();
9
+ url.username = url.username.length > 0 ? '***' : '';
10
+ url.password = url.password.length > 0 ? '***' : '';
11
+ url.hash = url.hash ? '#***' : '';
12
+ return url.toString();
13
+ };
14
+
15
+ /** Matches red in "hot-red-pie", but not in "redact" */
16
+ const wordMatcher = term => new RegExp( `(?<![a-z\\d])${term}(?![a-z\\d])`, 'i' );
17
+
18
+ /** Matches red in "acquired", but not in "redact" */
19
+ const wordEndMatcher = term => new RegExp( `${term}(?![a-z\\d])`, 'i' );
20
+
21
+ /**
22
+ * Redacts sensitive headers
23
+ * @param {object} headers
24
+ * @returns {object} The redacted headers
25
+ */
26
+ export const redactHeaders = headers => {
27
+ /** Header names that look sensitive by substring rules but are not secret material. */
28
+ const ignoreHeaders = new Set( [
29
+ 'x-csrf-token',
30
+ 'public-key-pins'
31
+ ] );
32
+
33
+ /** * Sensitive header patterns for redaction (case-insensitive). */
34
+ const sensitiveHeadersPatterns = [
35
+ // matches headers that contain these exact words
36
+ wordMatcher( 'authorization' ),
37
+ wordMatcher( 'token' ),
38
+ wordMatcher( 'secret' ),
39
+ wordMatcher( 'password' ),
40
+ wordMatcher( 'pwd' ),
41
+ wordMatcher( 'cookie' ),
42
+ // matches header that contain words ending with these sequences
43
+ wordEndMatcher( 'key' )
44
+ ];
45
+
46
+ return Object.entries( headers ).reduce( ( redacted, [ key, value ] ) => {
47
+ const lowKey = key.toLowerCase();
48
+ const isSensitive = !ignoreHeaders.has( lowKey ) && sensitiveHeadersPatterns.some( rx => rx.test( lowKey ) );
49
+ return Object.assign( redacted, { [key]: isSensitive ? '[REDACTED]' : value } );
50
+ }, {} );
51
+ };
@@ -0,0 +1,66 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { redactHeaders, redactUrl } from './redact.js';
3
+
4
+ describe( 'redactUrl', () => {
5
+ it( 'redacts credentials, query values, and the fragment while preserving URL structure', () => {
6
+ const result = redactUrl( 'https://user:password@example.com/models?model=gpt-5&token=secret#debug' );
7
+
8
+ expect( result ).toBe( 'https://***:***@example.com/models?model=***&token=***#***' );
9
+ } );
10
+
11
+ it( 'preserves duplicate query parameters and their order', () => {
12
+ const result = redactUrl( 'https://example.com/search?tag=first&tag=second&empty=#results' );
13
+
14
+ expect( result ).toBe( 'https://example.com/search?tag=***&tag=***&empty=***#***' );
15
+ } );
16
+
17
+ it( 'returns URLs without redacted components unchanged', () => {
18
+ expect( redactUrl( 'https://example.com/path' ) ).toBe( 'https://example.com/path' );
19
+ } );
20
+
21
+ it( 'does not mutate URL instances', () => {
22
+ const originalValue = 'ftp://user:password@example.com/file.txt?download=true#details';
23
+ const url = new URL( originalValue );
24
+
25
+ expect( redactUrl( url ) ).toBe( 'ftp://***:***@example.com/file.txt?download=***#***' );
26
+ expect( url.toString() ).toBe( originalValue );
27
+ } );
28
+ } );
29
+
30
+ describe( 'redactHeaders', () => {
31
+ it( 'redacts sensitive header names', () => {
32
+ const result = redactHeaders( {
33
+ Authorization: 'Bearer token',
34
+ 'X-Api-Key': 'api-key',
35
+ Cookie: 'session=id',
36
+ 'x-client-secret': 'secret'
37
+ } );
38
+
39
+ expect( result ).toEqual( {
40
+ Authorization: '[REDACTED]',
41
+ 'X-Api-Key': '[REDACTED]',
42
+ Cookie: '[REDACTED]',
43
+ 'x-client-secret': '[REDACTED]'
44
+ } );
45
+ } );
46
+
47
+ it( 'preserves non-sensitive header names and ignored false positives', () => {
48
+ const result = redactHeaders( {
49
+ Accept: 'application/json',
50
+ 'Content-Type': 'application/json',
51
+ 'x-csrf-token': 'csrf-token',
52
+ 'public-key-pins': 'pin'
53
+ } );
54
+
55
+ expect( result ).toEqual( {
56
+ Accept: 'application/json',
57
+ 'Content-Type': 'application/json',
58
+ 'x-csrf-token': 'csrf-token',
59
+ 'public-key-pins': 'pin'
60
+ } );
61
+ } );
62
+
63
+ it( 'handles empty headers', () => {
64
+ expect( redactHeaders( {} ) ).toEqual( {} );
65
+ } );
66
+ } );
@@ -28,3 +28,13 @@ export const toUrlSafeBase64 = uuid => {
28
28
  * @returns
29
29
  */
30
30
  export const rxEscape = v => v.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
31
+
32
+ const URL_SCHEME_RX = /^[a-z][a-z\d+.-]*:\/\//i;
33
+
34
+ /**
35
+ * Detects if string is an URL starting with `<protocol>://`
36
+ *
37
+ * @param {string} s
38
+ * @returns {boolean}
39
+ */
40
+ export const isUrl = s => typeof s === 'string' && URL_SCHEME_RX.test( s.trim() ) && URL.canParse( s );
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { toUrlSafeBase64, rxEscape } from './string.js';
2
+ import { isUrl, toUrlSafeBase64, rxEscape } from './string.js';
3
3
 
4
4
  describe( 'toUrlSafeBase64', () => {
5
5
  const urlSafeAlphabet = /^[A-Za-z0-9_-]+$/;
@@ -62,3 +62,38 @@ describe( 'rxEscape', () => {
62
62
  expect( rx.test( String.raw`C:\foo\bar\baz` ) ).toBe( false );
63
63
  } );
64
64
  } );
65
+
66
+ describe( 'isUrl', () => {
67
+ it.each( [
68
+ 'https://example.com/path?token=secret#section',
69
+ 'ftp://user:password@example.com/file.txt',
70
+ 'ftps://example.com/file.txt',
71
+ 'git+ssh://example.com/repository',
72
+ 'custom.protocol-v2://example.com/resource'
73
+ ] )( 'accepts a valid URL starting with a protocol: %s', value => {
74
+ expect( isUrl( value ) ).toBe( true );
75
+ } );
76
+
77
+ it.each( [
78
+ 'Error: fetch failed',
79
+ 'TypeError: invalid input',
80
+ 'mailto:user@example.com',
81
+ 'urn:isbn:978014',
82
+ 'data:text/plain,hello'
83
+ ] )( 'rejects non-authority URI-like strings: %s', value => {
84
+ expect( isUrl( value ) ).toBe( false );
85
+ } );
86
+
87
+ it.each( [
88
+ '//example.com/path',
89
+ '/relative/path',
90
+ 'https://',
91
+ 'not a URL'
92
+ ] )( 'rejects malformed or relative values: %s', value => {
93
+ expect( isUrl( value ) ).toBe( false );
94
+ } );
95
+
96
+ it.each( [ undefined, null, 42, new URL( 'https://example.com' ) ] )( 'rejects non-string values', value => {
97
+ expect( isUrl( value ) ).toBe( false );
98
+ } );
99
+ } );