@outputai/core 0.8.2-next.4b5c049.0 → 0.8.2-next.57bc8d6.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 (73) hide show
  1. package/package.json +4 -8
  2. package/src/bus.js +1 -1
  3. package/src/helpers/component.js +12 -0
  4. package/src/helpers/component.spec.js +54 -0
  5. package/src/helpers/fetch.js +105 -0
  6. package/src/helpers/fetch.spec.js +203 -0
  7. package/src/helpers/function.js +15 -0
  8. package/src/helpers/function.spec.js +48 -0
  9. package/src/helpers/object.js +98 -0
  10. package/src/helpers/object.spec.js +377 -0
  11. package/src/helpers/promise.js +29 -0
  12. package/src/helpers/promise.spec.js +35 -0
  13. package/src/helpers/string.js +30 -0
  14. package/src/helpers/string.spec.js +64 -0
  15. package/src/hooks/index.d.ts +102 -30
  16. package/src/hooks/index.js +16 -1
  17. package/src/hooks/index.spec.js +55 -1
  18. package/src/index.d.ts +2 -2
  19. package/src/interface/evaluator.d.ts +2 -2
  20. package/src/interface/evaluator.js +14 -12
  21. package/src/interface/evaluator.spec.js +10 -6
  22. package/src/interface/index.d.ts +1 -1
  23. package/src/interface/index.js +1 -1
  24. package/src/interface/logger.d.ts +52 -44
  25. package/src/interface/logger.js +17 -12
  26. package/src/interface/logger.spec.js +35 -1
  27. package/src/interface/step.d.ts +1 -1
  28. package/src/interface/step.js +15 -12
  29. package/src/interface/step.spec.js +10 -6
  30. package/src/interface/webhook.d.ts +21 -2
  31. package/src/interface/workflow.d.ts +2 -2
  32. package/src/interface/workflow.js +85 -79
  33. package/src/interface/workflow.spec.js +11 -4
  34. package/src/internal_activities/index.js +38 -36
  35. package/src/internal_activities/index.spec.js +27 -4
  36. package/src/logger/development.js +1 -1
  37. package/src/logger/development.spec.js +1 -1
  38. package/src/sdk/helpers/index.d.ts +1 -0
  39. package/src/sdk/helpers/index.js +1 -0
  40. package/src/sdk/helpers/objects.d.ts +51 -0
  41. package/src/sdk/helpers/objects.js +8 -0
  42. package/src/sdk/helpers/objects.spec.js +16 -0
  43. package/src/tracing/processors/s3/redis_client.spec.js +0 -6
  44. package/src/tracing/processors/s3/s3_client.spec.js +0 -6
  45. package/src/tracing/trace_engine.js +1 -1
  46. package/src/worker/catalog_workflow/catalog_job.js +1 -1
  47. package/src/worker/catalog_workflow/index.spec.js +8 -11
  48. package/src/worker/configs.js +1 -1
  49. package/src/worker/connection_monitor.js +1 -1
  50. package/src/worker/global_functions.js +2 -8
  51. package/src/worker/index.js +1 -1
  52. package/src/worker/interceptors/activity.js +8 -11
  53. package/src/worker/interceptors/activity.spec.js +25 -26
  54. package/src/worker/interceptors/workflow.js +3 -3
  55. package/src/worker/interceptors/workflow.spec.js +1 -1
  56. package/src/worker/loader/matchers.js +1 -1
  57. package/src/worker/sinks.js +1 -1
  58. package/src/worker/sinks.spec.js +1 -1
  59. package/src/internal_utils/component.js +0 -9
  60. package/src/utils/index.d.ts +0 -148
  61. package/src/utils/index.js +0 -1
  62. package/src/utils/utils.js +0 -307
  63. package/src/utils/utils.spec.js +0 -723
  64. /package/src/{internal_utils → helpers}/aggregations.js +0 -0
  65. /package/src/{internal_utils → helpers}/aggregations.spec.js +0 -0
  66. /package/src/{internal_utils → helpers}/errors.js +0 -0
  67. /package/src/{internal_utils → helpers}/errors.spec.js +0 -0
  68. /package/src/{internal_utils → helpers}/temporal_context.js +0 -0
  69. /package/src/{internal_utils → helpers}/temporal_context.spec.ts +0 -0
  70. /package/src/{internal_utils → helpers}/trace_info.js +0 -0
  71. /package/src/{internal_utils → helpers}/trace_info.spec.js +0 -0
  72. /package/src/{internal_utils → helpers}/workflow_context.js +0 -0
  73. /package/src/{internal_utils → helpers}/workflow_context.spec.js +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Storage } from '#async_storage';
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { serializeError } from './tools/utils.js';
4
- import { isStringboolTrue } from '#utils';
4
+ import { isStringboolTrue } from '#helpers/string';
5
5
  import * as localProcessor from './processors/local/index.js';
6
6
  import * as s3Processor from './processors/s3/index.js';
7
7
  import { ComponentType } from '#consts';
@@ -3,7 +3,7 @@ import { WorkflowExecutionAlreadyStartedError, WorkflowIdConflictPolicy } from '
3
3
  import { WORKFLOW_CATALOG } from '#consts';
4
4
  import { catalogId, taskQueue } from '../configs.js';
5
5
  import { createChildLogger } from '#logger';
6
- import { CancellablePromise } from '#utils';
6
+ import { CancellablePromise } from '#helpers/promise';
7
7
 
8
8
  const log = createChildLogger( 'Catalog' );
9
9
 
@@ -7,9 +7,6 @@ vi.mock( '#consts', () => ( {
7
7
  METADATA_ACCESS_SYMBOL
8
8
  } ) );
9
9
 
10
- const setMetadata = ( target, values ) =>
11
- Object.defineProperty( target, METADATA_ACCESS_SYMBOL, { value: values, writable: false, enumerable: false, configurable: false } );
12
-
13
10
  describe( 'createCatalog', () => {
14
11
  it( 'builds catalog with activities grouped by workflow path and returns Catalog with CatalogWorkflow entries', async () => {
15
12
  const { createCatalog } = await import( './index.js' );
@@ -32,40 +29,40 @@ describe( 'createCatalog', () => {
32
29
  ];
33
30
 
34
31
  const activity1 = () => {};
35
- setMetadata( activity1, {
32
+ activity1[METADATA_ACCESS_SYMBOL] = {
36
33
  name: 'A1',
37
34
  path: '/flows/flow1#A1',
38
35
  description: 'desc-a1',
39
36
  inputSchema: z.object( { in: z.literal( 'a1' ) } ),
40
37
  outputSchema: z.object( { out: z.literal( 'a1' ) } )
41
- } );
38
+ };
42
39
 
43
40
  const activity2 = () => {};
44
- setMetadata( activity2, {
41
+ activity2[METADATA_ACCESS_SYMBOL] = {
45
42
  name: 'A2',
46
43
  path: '/flows/flow1#A2',
47
44
  description: 'desc-a2',
48
45
  inputSchema: z.object( { in: z.literal( 'a2' ) } ),
49
46
  outputSchema: z.object( { out: z.literal( 'a2' ) } )
50
- } );
47
+ };
51
48
 
52
49
  const activity3 = () => {};
53
- setMetadata( activity3, {
50
+ activity3[METADATA_ACCESS_SYMBOL] = {
54
51
  name: 'B1',
55
52
  path: '/flows/flow2#B1',
56
53
  description: 'desc-b1',
57
54
  inputSchema: z.object( { in: z.literal( 'b1' ) } ),
58
55
  outputSchema: z.object( { out: z.literal( 'b1' ) } )
59
- } );
56
+ };
60
57
 
61
58
  const activity4 = () => {};
62
- setMetadata( activity4, {
59
+ activity4[METADATA_ACCESS_SYMBOL] = {
63
60
  name: 'X',
64
61
  path: '/other#X',
65
62
  description: 'desc-x',
66
63
  inputSchema: z.object( { in: z.literal( 'x' ) } ),
67
64
  outputSchema: z.object( { out: z.literal( 'x' ) } )
68
- } );
65
+ };
69
66
 
70
67
  const activities = {
71
68
  '/flows/flow1#A1': activity1,
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod';
2
- import { isStringboolTrue } from '#utils';
2
+ import { isStringboolTrue } from '#helpers/string';
3
3
 
4
4
  class InvalidEnvVarsErrors extends Error { }
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { createChildLogger } from '#logger';
2
2
  import { setTimeout as delay } from 'node:timers/promises';
3
- import { CancellablePromise } from '#utils';
3
+ import { CancellablePromise } from '#helpers/promise';
4
4
 
5
5
  const log = createChildLogger( 'Connection' );
6
6
 
@@ -1,20 +1,14 @@
1
1
  import { messageBus } from '#bus';
2
2
  import { ACTIVITY_LOGGER_SYMBOL, BusEventType } from '#consts';
3
3
  import { activityInfo as activityInfoFn } from '@temporalio/activity';
4
-
5
- const setFunction = ( key, fn ) => Object.defineProperty( globalThis, key, {
6
- value: fn,
7
- enumerable: false,
8
- configurable: false,
9
- writable: false
10
- } );
4
+ import { assignImmutableProperty } from '#helpers/object';
11
5
 
12
6
  /**
13
7
  * Sets global functions on globalThis
14
8
  */
15
9
  export const bindGlobalFunctions = () => {
16
10
  /** Defines the activity logger function, accessible in activity context via logger interface */
17
- setFunction( ACTIVITY_LOGGER_SYMBOL, ( { level, message, metadata } ) =>
11
+ assignImmutableProperty( globalThis, ACTIVITY_LOGGER_SYMBOL, ( { level, message, metadata } ) =>
18
12
  messageBus.emit( BusEventType.ACTIVITY_LOG, { level, message, metadata, activityInfo: activityInfoFn() } )
19
13
  );
20
14
  };
@@ -18,7 +18,7 @@ import { BusEventType } from '#consts';
18
18
  import { setupTelemetry } from './telemetry.js';
19
19
  import { TemporalConnectionMonitor } from './connection_monitor.js';
20
20
  import { bindGlobalFunctions } from './global_functions.js';
21
- import { runOnce } from '#utils';
21
+ import { runOnce } from '#helpers/function';
22
22
 
23
23
  import './log_hooks.js';
24
24
 
@@ -5,8 +5,8 @@ import { headersToObject } from './headers.js';
5
5
  import { ACTIVITY_WRAPPER_VERSION_FIELD, BusEventType, METADATA_ACCESS_SYMBOL } from '#consts';
6
6
  import { activityHeartbeatEnabled, activityHeartbeatIntervalMs } from '../configs.js';
7
7
  import { messageBus } from '#bus';
8
- import { aggregateAttributes } from '#internal_utils/aggregations';
9
- import { buildApplicationFailureWithDetails } from '#internal_utils/errors';
8
+ import { aggregateAttributes } from '#helpers/aggregations';
9
+ import { buildApplicationFailureWithDetails } from '#helpers/errors';
10
10
 
11
11
  /*
12
12
  This interceptor wraps every activity execution with cross-cutting concerns:
@@ -77,20 +77,17 @@ export class ActivityExecutionInterceptor {
77
77
 
78
78
  const output = await Storage.runWithContext( async _ => next( input ), storageContext );
79
79
 
80
- messageBus.emit( BusEventType.ACTIVITY_END, { activityInfo, workflowDetails, outputActivityKind } );
80
+ const aggregations = state.attributes.length > 0 ? aggregateAttributes( state.attributes ) : null;
81
+
82
+ messageBus.emit( BusEventType.ACTIVITY_END, { activityInfo, aggregations, workflowDetails, outputActivityKind } );
81
83
  Tracing.addEventEnd( { id: activityId, details: output, traceInfo } );
82
84
 
83
- return {
84
- [ACTIVITY_WRAPPER_VERSION_FIELD]: 1,
85
- output,
86
- aggregations: state.attributes.length > 0 ? aggregateAttributes( state.attributes ) : null
87
- };
85
+ return { [ACTIVITY_WRAPPER_VERSION_FIELD]: 1, output, aggregations };
88
86
 
89
87
  } catch ( error ) {
90
- messageBus.emit( BusEventType.ACTIVITY_ERROR, { activityInfo, workflowDetails, outputActivityKind, error } );
91
- Tracing.addEventError( { id: activityId, details: error, traceInfo } );
92
-
93
88
  const aggregations = state.attributes.length > 0 ? aggregateAttributes( state.attributes ) : null;
89
+ messageBus.emit( BusEventType.ACTIVITY_ERROR, { activityInfo, aggregations, workflowDetails, outputActivityKind, error } );
90
+ Tracing.addEventError( { id: activityId, details: error, traceInfo } );
94
91
 
95
92
  throw aggregations ? buildApplicationFailureWithDetails( error, { aggregations } ) : error;
96
93
  } finally {
@@ -100,6 +100,12 @@ const httpRequestAttribute = {
100
100
  requestId: 'req-1'
101
101
  };
102
102
 
103
+ const httpRequestAggregations = {
104
+ cost: { total: 0 },
105
+ tokens: { total: 0 },
106
+ httpRequests: { total: 1 }
107
+ };
108
+
103
109
  describe( 'ActivityExecutionInterceptor', () => {
104
110
  beforeEach( () => {
105
111
  vi.clearAllMocks();
@@ -136,7 +142,7 @@ describe( 'ActivityExecutionInterceptor', () => {
136
142
  );
137
143
  expect( messageBusEmitMock ).toHaveBeenCalledWith(
138
144
  BusEventType.ACTIVITY_END,
139
- { activityInfo: activityInfoMock, workflowDetails: workflowDetailsMock, outputActivityKind: 'step' }
145
+ { activityInfo: activityInfoMock, aggregations: null, workflowDetails: workflowDetailsMock, outputActivityKind: 'step' }
140
146
  );
141
147
  expect( addEventStartMock ).toHaveBeenCalledWith( {
142
148
  id: 'act-1',
@@ -189,14 +195,16 @@ describe( 'ActivityExecutionInterceptor', () => {
189
195
 
190
196
  await expect( interceptor.execute( makeInput(), next ) ).resolves.toEqual( {
191
197
  output: { result: 'ok' },
192
- aggregations: {
193
- cost: { total: 0 },
194
- tokens: { total: 0 },
195
- httpRequests: { total: 1 }
196
- },
198
+ aggregations: httpRequestAggregations,
197
199
  [ACTIVITY_WRAPPER_VERSION_FIELD]: 1
198
200
  } );
199
201
 
202
+ expect( messageBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_END, {
203
+ activityInfo: activityInfoMock,
204
+ aggregations: httpRequestAggregations,
205
+ workflowDetails: workflowDetailsMock,
206
+ outputActivityKind: 'step'
207
+ } );
200
208
  } );
201
209
 
202
210
  it( 'stores collected aggregations in ApplicationFailure details after failed execution', async () => {
@@ -215,15 +223,17 @@ describe( 'ActivityExecutionInterceptor', () => {
215
223
  message: 'step failed',
216
224
  type: 'Error',
217
225
  details: [ {
218
- aggregations: {
219
- cost: { total: 0 },
220
- tokens: { total: 0 },
221
- httpRequests: { total: 1 }
222
- }
226
+ aggregations: httpRequestAggregations
223
227
  } ],
224
228
  cause: error
225
229
  } );
226
- expect( messageBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_ERROR, expect.objectContaining( { error } ) );
230
+ expect( messageBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_ERROR, {
231
+ activityInfo: activityInfoMock,
232
+ aggregations: httpRequestAggregations,
233
+ workflowDetails: workflowDetailsMock,
234
+ outputActivityKind: 'step',
235
+ error
236
+ } );
227
237
  expect( addEventErrorMock ).toHaveBeenCalledOnce();
228
238
  expect( addEventEndMock ).not.toHaveBeenCalled();
229
239
  } );
@@ -243,13 +253,7 @@ describe( 'ActivityExecutionInterceptor', () => {
243
253
 
244
254
  expect( thrown.details ).toEqual( [
245
255
  { domain: { reason: 'bad-input' } },
246
- {
247
- aggregations: {
248
- cost: { total: 0 },
249
- tokens: { total: 0 },
250
- httpRequests: { total: 1 }
251
- }
252
- }
256
+ { aggregations: httpRequestAggregations }
253
257
  ] );
254
258
  } );
255
259
 
@@ -300,13 +304,7 @@ describe( 'ActivityExecutionInterceptor', () => {
300
304
  nonRetryable: true,
301
305
  details: [
302
306
  { domain: { reason: 'bad-input' } },
303
- {
304
- aggregations: {
305
- cost: { total: 0 },
306
- tokens: { total: 0 },
307
- httpRequests: { total: 1 }
308
- }
309
- }
307
+ { aggregations: httpRequestAggregations }
310
308
  ]
311
309
  } );
312
310
  } );
@@ -324,6 +322,7 @@ describe( 'ActivityExecutionInterceptor', () => {
324
322
  expect( messageBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_START, expect.any( Object ) );
325
323
  expect( messageBusEmitMock ).toHaveBeenCalledWith( BusEventType.ACTIVITY_ERROR, {
326
324
  activityInfo: activityInfoMock,
325
+ aggregations: null,
327
326
  workflowDetails: workflowDetailsMock,
328
327
  outputActivityKind: 'step',
329
328
  error
@@ -1,10 +1,10 @@
1
1
  // THIS RUNS IN THE TEMPORAL'S SANDBOX ENVIRONMENT
2
2
  import { workflowInfo, proxySinks, ContinueAsNew, isCancellation } from '@temporalio/workflow';
3
3
  import { memoToHeaders } from './headers.js';
4
- import { deepMerge } from '#utils';
5
- import { buildApplicationFailureWithDetails } from '#internal_utils/errors';
4
+ import { deepMerge } from '#helpers/object';
5
+ import { buildApplicationFailureWithDetails } from '#helpers/errors';
6
6
  import { METADATA_ACCESS_SYMBOL, WorkflowSpecialOutput } from '#consts';
7
- import { createWorkflowDetails } from '#internal_utils/temporal_context';
7
+ import { createWorkflowDetails } from '#helpers/temporal_context';
8
8
 
9
9
  // this is a dynamic generated file with activity configs overwrites
10
10
  import stepOptions from '../temp/__activity_options.js';
@@ -54,7 +54,7 @@ const memoToHeadersMock = vi.fn( memo => ( memo ? { ...memo, __asHeaders: true }
54
54
  vi.mock( './headers.js', () => ( { memoToHeaders: ( ...args ) => memoToHeadersMock( ...args ) } ) );
55
55
 
56
56
  const deepMergeMock = vi.fn( ( a, b ) => ( { ...( a || {} ), ...( b || {} ) } ) );
57
- vi.mock( '#utils', () => ( { deepMerge: ( ...args ) => deepMergeMock( ...args ) } ) );
57
+ vi.mock( '#helpers/object', () => ( { deepMerge: ( ...args ) => deepMergeMock( ...args ) } ) );
58
58
 
59
59
  const stepOptionsDefault = {};
60
60
  vi.mock( '../temp/__activity_options.js', () => ( { default: stepOptionsDefault } ) );
@@ -1,5 +1,5 @@
1
1
  import { sep } from 'node:path';
2
- import { rxEscape } from '#utils';
2
+ import { rxEscape } from '#helpers/string';
3
3
 
4
4
  /**
5
5
  * Creates a matcher function that based on "path", matches:
@@ -1,7 +1,7 @@
1
1
  import { BusEventType, ComponentType } from '#consts';
2
2
  import * as Tracing from '#tracing';
3
3
  import { messageBus } from '#bus';
4
- import { createWorkflowDetails } from '#internal_utils/temporal_context';
4
+ import { createWorkflowDetails } from '#helpers/temporal_context';
5
5
 
6
6
  // This sink allow for sandbox Temporal environment to send trace logs back to the main thread.
7
7
  export const sinks = {
@@ -21,7 +21,7 @@ vi.mock( '#tracing', () => ( {
21
21
  addEventEnd: addEventEndMock,
22
22
  addEventError: addEventErrorMock
23
23
  } ) );
24
- vi.mock( '#internal_utils/temporal_context', () => ( {
24
+ vi.mock( '#helpers/temporal_context', () => ( {
25
25
  createWorkflowDetails: createWorkflowDetailsMock
26
26
  } ) );
27
27
 
@@ -1,9 +0,0 @@
1
- import { METADATA_ACCESS_SYMBOL } from '#consts';
2
-
3
- /**
4
- * Add metadata "values" property to a given object
5
- * @param {object} target
6
- * @param {object} values
7
- */
8
- export const setMetadata = ( target, values ) =>
9
- Object.defineProperty( target, METADATA_ACCESS_SYMBOL, { value: values, writable: false, enumerable: false, configurable: false } );
@@ -1,148 +0,0 @@
1
- /**
2
- * > [!WARNING]
3
- * > **Internal use only.** Not part of the public API; may change without notice.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- /**
9
- * Node safe clone implementation that doesn't use global structuredClone().
10
- *
11
- * Returns a cloned version of the object.
12
- *
13
- * Only clones static properties. Getters become static properties.
14
- *
15
- * @param object
16
- */
17
- export function clone( object: object ): object;
18
-
19
- /** Represents a {Response} serialized to plain object */
20
- export type SerializedFetchResponse = {
21
- /** The response url */
22
- url: string,
23
-
24
- /** The response status code */
25
- status: number,
26
-
27
- /** The response status text */
28
- statusText: string,
29
-
30
- /** Flag indicating if the request succeeded */
31
- ok: boolean,
32
-
33
- /** Object with response headers */
34
- headers: Record<string, string>,
35
-
36
- /** Response body, either JSON, text or arrayBuffer converter to base64 */
37
- body: object | string
38
- };
39
-
40
- /**
41
- * Consumes an HTTP `Response` and serializes it to a plain object.
42
- *
43
- * @param response - The response to serialize.
44
- * @returns SerializedFetchResponse
45
- */
46
- export function serializeFetchResponse( response: Response ): SerializedFetchResponse;
47
-
48
- export type SerializedBodyAndContentType = {
49
- /** The body as a string when possible; otherwise the original value */
50
- body: string | unknown,
51
- /** The inferred `Content-Type` header value, if any */
52
- contentType: string | undefined
53
- };
54
-
55
- /**
56
- * Serializes a payload for use as a fetch POST body and infers its `Content-Type`.
57
- *
58
- * @param body - The payload to serialize.
59
- * @returns The serialized body and inferred `Content-Type`.
60
- */
61
- export function serializeBodyAndInferContentType( body: unknown ): SerializedBodyAndContentType;
62
-
63
- /**
64
- * Returns true if the value is a plain object:
65
- * - `{}`
66
- * - `new Object()`
67
- * - `Object.create(null)`
68
- *
69
- * @param object - The value to check.
70
- * @returns Whether the value is a plain object.
71
- */
72
- export function isPlainObject( object: unknown ): boolean;
73
-
74
- /**
75
- * Returns a copy of an array with its content shuffled.
76
- *
77
- * @param arr - The array to shuffle
78
- * @returns A shuffled array copy
79
- */
80
- export function shuffleArray( arr: unknown[] ): unknown[];
81
-
82
- /**
83
- * Creates a new object by merging object `b` onto object `a`, biased toward `b`:
84
- * - Fields in `b` overwrite fields in `a`.
85
- * - Fields in `b` that don't exist in `a` are created.
86
- * - Fields in `a` that don't exist in `b` are left unchanged.
87
- *
88
- * @param a - The base object.
89
- * @param b - The overriding object.
90
- * @throws {Error} If either `a` or `b` is not a plain object.
91
- * @returns A new merged object.
92
- */
93
- export function deepMerge( a: object, b: object | null | undefined ): object;
94
-
95
- /**
96
- * Creates a new object by merging object `b` onto object `a`, biased toward `b`:
97
- * - Fields in `b` that don't exist in `a` are created.
98
- * - Fields in `a` that don't exist in `b` are left unchanged.
99
- * - Fields in `a` and `b` are passed as arguments to the resolve function (a,b) and its return assigns the new value.
100
- *
101
- * @param a - The base object.
102
- * @param b - The overriding object.
103
- * @param resolver - The resolver function.
104
- * @throws {Error} If either `a` or `b` is not a plain object.
105
- * @returns A new merged object.
106
- */
107
- export function deepMergeWithResolver( a: object, b: object | null | undefined, resolver: function ): object;
108
-
109
- /**
110
- * Shortens a UUID to a url-safe base64-like string (custom 64-char alphabet).
111
- * Temporal-friendly: no Buffer or crypto; safe to use inside workflows.
112
- *
113
- * @param uuid - Standard UUID (e.g. `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`).
114
- * @returns Short string using A–Z, a–z, 0–9, `_`, `-` (typically 21–22 chars).
115
- */
116
- export function toUrlSafeBase64( uuid: string ): string;
117
-
118
- /**
119
- * Similar to native Promise.allSettled, but rejects with `{ isTimeout: true }`
120
- * if the execution exceeds the given timeout.
121
- *
122
- * @param promises - Values or promises to wait for.
123
- * @param timeoutMs - Maximum wait time in milliseconds.
124
- * @returns Native Promise.allSettled-style results.
125
- */
126
- export function allSettledWithTimeout<T>(
127
- promises: Array<T | PromiseLike<T>>,
128
- timeoutMs: number
129
- ): Promise<PromiseSettledResult<Awaited<T>>[]>;
130
-
131
- /**
132
- * Promise wrapper that can be resolved externally.
133
- */
134
- export class CancellablePromise {
135
- /** The internal promise */
136
- readonly promise: Promise<void>;
137
- /** Whether the promise is already resolved or not */
138
- readonly completed: boolean;
139
- /** Resolves the promise */
140
- complete(): void;
141
- }
142
-
143
- /**
144
- * Returns a function that invokes the wrapped function once.
145
- */
146
- export function runOnce<Args extends unknown[], Return>(
147
- fn: ( ...args: Args ) => Return
148
- ): ( ...args: Args ) => Return;
@@ -1 +0,0 @@
1
- export * from './utils.js';