@outputai/core 0.14.1-next.bd031f8.0 → 0.14.1-next.e9dfa49.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 (103) hide show
  1. package/dist/credentials/credentials.d.ts +6 -0
  2. package/dist/credentials/credentials.js +87 -0
  3. package/dist/credentials/encrypted_yaml_provider.d.ts +2 -0
  4. package/dist/credentials/encrypted_yaml_provider.js +77 -0
  5. package/dist/credentials/encryption.d.ts +3 -0
  6. package/dist/credentials/encryption.js +6 -0
  7. package/dist/credentials/errors.d.ts +13 -0
  8. package/dist/credentials/errors.js +39 -0
  9. package/dist/credentials/index.d.ts +6 -0
  10. package/dist/credentials/index.js +5 -0
  11. package/dist/credentials/init.d.ts +1 -0
  12. package/dist/credentials/init.js +7 -0
  13. package/dist/credentials/paths.d.ts +7 -0
  14. package/dist/credentials/paths.js +14 -0
  15. package/dist/credentials/provider_registry.d.ts +3 -0
  16. package/dist/credentials/provider_registry.js +6 -0
  17. package/dist/credentials/types.d.ts +12 -0
  18. package/dist/credentials/types.js +1 -0
  19. package/package.json +25 -14
  20. package/src/async_storage.d.ts +4 -0
  21. package/src/consts.js +0 -2
  22. package/src/helpers/object.d.ts +2 -0
  23. package/src/helpers/search_attributes.js +25 -0
  24. package/src/helpers/temporal_context.js +4 -1
  25. package/src/hooks/index.d.ts +6 -8
  26. package/src/hooks/index.js +0 -3
  27. package/src/interface/workflow.js +10 -2
  28. package/src/logger/index.d.ts +4 -0
  29. package/src/worker/index.js +3 -1
  30. package/bin/healthcheck.spec.js +0 -90
  31. package/src/bus.spec.js +0 -196
  32. package/src/errors.spec.js +0 -19
  33. package/src/helpers/activity_options.spec.js +0 -55
  34. package/src/helpers/component.spec.js +0 -54
  35. package/src/helpers/error_serializer.spec.js +0 -479
  36. package/src/helpers/errors.spec.js +0 -189
  37. package/src/helpers/fetch.spec.js +0 -292
  38. package/src/helpers/function.spec.js +0 -24
  39. package/src/helpers/object.spec.js +0 -425
  40. package/src/helpers/promise.spec.js +0 -62
  41. package/src/helpers/redact.spec.js +0 -66
  42. package/src/helpers/string.spec.js +0 -99
  43. package/src/helpers/temporal_context.spec.ts +0 -83
  44. package/src/helpers/trace_info.spec.js +0 -45
  45. package/src/helpers/workflow_context.spec.js +0 -46
  46. package/src/hooks/index.spec.js +0 -265
  47. package/src/hooks/pending_hooks.spec.js +0 -62
  48. package/src/interface/evaluator.spec.js +0 -685
  49. package/src/interface/logger.spec.js +0 -172
  50. package/src/interface/step.spec.js +0 -128
  51. package/src/interface/validations/index.spec.js +0 -197
  52. package/src/interface/validations/schemas.spec.js +0 -229
  53. package/src/interface/webhook.spec.js +0 -170
  54. package/src/interface/workflow.spec.js +0 -710
  55. package/src/interface/workflow_utils.spec.js +0 -271
  56. package/src/interface/zod_integration.spec.js +0 -646
  57. package/src/internal_activities/index.spec.js +0 -186
  58. package/src/logger/development.spec.js +0 -87
  59. package/src/logger/index.spec.js +0 -27
  60. package/src/logger/production.spec.js +0 -71
  61. package/src/sdk/helpers/component_metadata.spec.js +0 -30
  62. package/src/sdk/helpers/objects.spec.js +0 -16
  63. package/src/sdk/helpers/path.spec.js +0 -102
  64. package/src/sdk/runtime/context.spec.js +0 -37
  65. package/src/sdk/runtime/events.spec.js +0 -40
  66. package/src/temporal/client.spec.js +0 -124
  67. package/src/tracing/processors/local/index.spec.js +0 -204
  68. package/src/tracing/processors/s3/configs.spec.js +0 -64
  69. package/src/tracing/processors/s3/index.spec.js +0 -185
  70. package/src/tracing/processors/s3/redis_client.spec.js +0 -179
  71. package/src/tracing/processors/s3/s3_client.spec.js +0 -68
  72. package/src/tracing/tools/build_trace_tree.spec.js +0 -216
  73. package/src/tracing/trace_engine.spec.js +0 -299
  74. package/src/worker/bundle.spec.js +0 -53
  75. package/src/worker/bundler_options.spec.js +0 -62
  76. package/src/worker/catalog_workflow/catalog_publisher.spec.js +0 -317
  77. package/src/worker/catalog_workflow/index.spec.js +0 -222
  78. package/src/worker/configs.spec.js +0 -213
  79. package/src/worker/configs_tuner_schema.spec.js +0 -127
  80. package/src/worker/connection_monitor.spec.js +0 -328
  81. package/src/worker/global_functions.spec.js +0 -55
  82. package/src/worker/index.spec.js +0 -526
  83. package/src/worker/interceptors/activity.spec.js +0 -369
  84. package/src/worker/interceptors/headers.spec.js +0 -73
  85. package/src/worker/interceptors/workflow.spec.js +0 -357
  86. package/src/worker/interruption.spec.js +0 -177
  87. package/src/worker/loader/activities.spec.js +0 -212
  88. package/src/worker/loader/hooks.spec.js +0 -64
  89. package/src/worker/loader/matchers.spec.js +0 -140
  90. package/src/worker/loader/tools.spec.js +0 -595
  91. package/src/worker/loader/workflows.spec.js +0 -287
  92. package/src/worker/log_hooks.spec.js +0 -303
  93. package/src/worker/shutdown.spec.js +0 -197
  94. package/src/worker/sinks.spec.js +0 -220
  95. package/src/worker/telemetry.spec.js +0 -80
  96. package/src/worker/temporal_logger.spec.js +0 -90
  97. package/src/worker/webpack_loaders/tools.spec.js +0 -314
  98. package/src/worker/webpack_loaders/workflow_rewriter/collect_target_imports.spec.js +0 -134
  99. package/src/worker/webpack_loaders/workflow_rewriter/index.spec.js +0 -154
  100. package/src/worker/webpack_loaders/workflow_rewriter/rewrite_activity_calls.spec.js +0 -165
  101. package/src/worker/webpack_loaders/workflow_validator/index.spec.js +0 -202
  102. package/src/worker/webpack_loaders/workflow_validator/npm_workflow_export_resolve.spec.js +0 -374
  103. package/src/worker/worker_runner.spec.js +0 -220
@@ -1,292 +0,0 @@
1
- import { afterEach, describe, it, expect } from 'vitest';
2
- import { Readable } from 'node:stream';
3
- import { hydrateHeaders, serializeBodyAndInferContentType, serializeResponse } from './fetch.js';
4
-
5
- describe( 'hydrateHeaders', () => {
6
- afterEach( () => {
7
- delete process.env.TOKEN;
8
- delete process.env.API_KEY;
9
- } );
10
-
11
- it( 'replaces environment variable tokens in header values', () => {
12
- process.env.TOKEN = 'secret-token';
13
-
14
- expect( hydrateHeaders( {
15
- Authorization: 'Bearer $TOKEN'
16
- } ) ).toEqual( {
17
- Authorization: 'Bearer secret-token'
18
- } );
19
- } );
20
-
21
- it( 'replaces repeated and multiple environment variable tokens', () => {
22
- process.env.TOKEN = 'secret-token';
23
- process.env.API_KEY = 'api-key';
24
-
25
- expect( hydrateHeaders( {
26
- Authorization: 'Bearer $TOKEN',
27
- 'X-Composite': '$TOKEN:$API_KEY:$TOKEN'
28
- } ) ).toEqual( {
29
- Authorization: 'Bearer secret-token',
30
- 'X-Composite': 'secret-token:api-key:secret-token'
31
- } );
32
- } );
33
-
34
- it( 'preserves headers without environment variable tokens', () => {
35
- expect( hydrateHeaders( {
36
- Accept: 'application/json',
37
- 'Content-Type': 'application/json'
38
- } ) ).toEqual( {
39
- Accept: 'application/json',
40
- 'Content-Type': 'application/json'
41
- } );
42
- } );
43
-
44
- it( 'handles missing headers', () => {
45
- expect( hydrateHeaders() ).toEqual( {} );
46
- } );
47
-
48
- it( 'throws when an environment variable token is missing', () => {
49
- expect( () => hydrateHeaders( {
50
- Authorization: 'Bearer $TOKEN'
51
- } ) ).toThrow( 'Missing environment variable "TOKEN" while hydrating headers.' );
52
- } );
53
- } );
54
-
55
- describe( 'serializeResponse', () => {
56
- it( 'serializes response metadata by default', async () => {
57
- const response = new Response( '{not json', {
58
- status: 200,
59
- statusText: 'OK',
60
- headers: { 'content-type': 'application/json' }
61
- } );
62
-
63
- await expect( serializeResponse( response ) ).resolves.toEqual( {
64
- url: '',
65
- status: 200,
66
- statusText: 'OK',
67
- ok: true
68
- } );
69
- } );
70
-
71
- it( 'includes redacted headers when requested', async () => {
72
- const response = new Response( null, {
73
- status: 204,
74
- statusText: 'No Content',
75
- headers: {
76
- authorization: 'Bearer token',
77
- 'content-type': 'application/json'
78
- }
79
- } );
80
-
81
- const result = await serializeResponse( response, { includeHeaders: true } );
82
-
83
- expect( result ).toEqual( {
84
- url: '',
85
- status: 204,
86
- statusText: 'No Content',
87
- ok: true,
88
- headers: {
89
- authorization: '[REDACTED]',
90
- 'content-type': 'application/json'
91
- }
92
- } );
93
- } );
94
-
95
- it( 'includes JSON body when requested', async () => {
96
- const payload = { a: 1, b: 'two' };
97
- const response = new Response( JSON.stringify( payload ), {
98
- status: 200,
99
- statusText: 'OK',
100
- headers: { 'content-type': 'application/json' }
101
- } );
102
-
103
- const result = await serializeResponse( response, { includeBody: true } );
104
-
105
- expect( result.body ).toEqual( payload );
106
- } );
107
-
108
- it( 'includes structured syntax JSON body when requested', async () => {
109
- const payload = { error: 'Invalid input' };
110
- const response = new Response( JSON.stringify( payload ), {
111
- status: 400,
112
- statusText: 'Bad Request',
113
- headers: { 'content-type': 'application/problem+json; charset=utf-8' }
114
- } );
115
-
116
- const result = await serializeResponse( response, { includeBody: true } );
117
-
118
- expect( result.body ).toEqual( payload );
119
- } );
120
-
121
- it( 'includes text body when requested', async () => {
122
- const bodyText = 'hello world';
123
- const response = new Response( bodyText, {
124
- status: 201,
125
- statusText: 'Created',
126
- headers: { 'content-type': 'Text/Plain; charset=utf-8' }
127
- } );
128
-
129
- const result = await serializeResponse( response, { includeBody: true } );
130
-
131
- expect( result.body ).toBe( bodyText );
132
- } );
133
-
134
- if ( typeof ReadableStream !== 'undefined' ) {
135
- it( 'includes ReadableStream text body when requested', async () => {
136
- const encoder = new TextEncoder();
137
- const chunk = encoder.encode( 'streamed text' );
138
- const stream = new ReadableStream( {
139
- start( controller ) {
140
- controller.enqueue( chunk );
141
- controller.close();
142
- }
143
- } );
144
- const response = new Response( stream, {
145
- status: 200,
146
- statusText: 'OK',
147
- headers: { 'content-type': 'text/plain; charset=utf-8' }
148
- } );
149
-
150
- const result = await serializeResponse( response, { includeBody: true } );
151
-
152
- expect( result.body ).toBe( 'streamed text' );
153
- } );
154
- }
155
-
156
- it( 'includes non-text non-json response as base64 when requested', async () => {
157
- const bytes = Uint8Array.from( [ 0, 1, 2, 3 ] );
158
- const response = new Response( bytes, {
159
- status: 200,
160
- statusText: 'OK',
161
- headers: { 'content-type': 'application/octet-stream' }
162
- } );
163
-
164
- const result = await serializeResponse( response, { includeBody: true } );
165
-
166
- expect( result.body ).toBe( Buffer.from( bytes ).toString( 'base64' ) );
167
- } );
168
-
169
- it( 'defaults to base64 body when content-type header is missing and body is requested', async () => {
170
- const bytes = Uint8Array.from( [ 0, 1, 2, 3 ] );
171
- const response = new Response( bytes, { status: 200 } );
172
-
173
- const result = await serializeResponse( response, { includeBody: true } );
174
-
175
- expect( result.body ).toBe( Buffer.from( bytes ).toString( 'base64' ) );
176
- } );
177
- } );
178
-
179
- describe( 'serializeBodyAndInferContentType', () => {
180
- it( 'returns undefineds for null payload', () => {
181
- const { body, contentType } = serializeBodyAndInferContentType( null );
182
- expect( body ).toBeUndefined();
183
- expect( contentType ).toBeUndefined();
184
- } );
185
-
186
- it( 'returns undefineds for undefined payload', () => {
187
- const { body, contentType } = serializeBodyAndInferContentType( undefined );
188
- expect( body ).toBeUndefined();
189
- expect( contentType ).toBeUndefined();
190
- } );
191
-
192
- it( 'handles ArrayBuffer with octet-stream', () => {
193
- const buf = new ArrayBuffer( 4 );
194
- const { body, contentType } = serializeBodyAndInferContentType( buf );
195
- expect( body ).toBe( buf );
196
- expect( contentType ).toBe( 'application/octet-stream' );
197
- } );
198
-
199
- it( 'handles TypedArray with octet-stream', () => {
200
- const view = new Uint8Array( [ 1, 2, 3 ] );
201
- const { body, contentType } = serializeBodyAndInferContentType( view );
202
- expect( body ).toBe( view );
203
- expect( contentType ).toBe( 'application/octet-stream' );
204
- } );
205
-
206
- it( 'handles DataView with octet-stream', () => {
207
- const ab = new ArrayBuffer( 2 );
208
- const dv = new DataView( ab );
209
- const { body, contentType } = serializeBodyAndInferContentType( dv );
210
- expect( body ).toBe( dv );
211
- expect( contentType ).toBe( 'application/octet-stream' );
212
- } );
213
-
214
- // Environment-provided web types
215
- if ( typeof URLSearchParams !== 'undefined' ) {
216
- it( 'passes through URLSearchParams without content type', () => {
217
- const usp = new URLSearchParams( { a: '1', b: 'two' } );
218
- const { body, contentType } = serializeBodyAndInferContentType( usp );
219
- expect( body ).toBe( usp );
220
- expect( contentType ).toBeUndefined();
221
- } );
222
- }
223
-
224
- if ( typeof FormData !== 'undefined' ) {
225
- it( 'passes through FormData without content type', () => {
226
- const fd = new FormData();
227
- fd.append( 'a', '1' );
228
- const { body, contentType } = serializeBodyAndInferContentType( fd );
229
- expect( body ).toBe( fd );
230
- expect( contentType ).toBeUndefined();
231
- } );
232
- }
233
-
234
- if ( typeof Blob !== 'undefined' ) {
235
- it( 'passes through Blob without content type', () => {
236
- const blob = new Blob( [ 'abc' ], { type: 'text/plain' } );
237
- const { body, contentType } = serializeBodyAndInferContentType( blob );
238
- expect( body ).toBe( blob );
239
- expect( contentType ).toBeUndefined();
240
- } );
241
- }
242
-
243
- if ( typeof File !== 'undefined' ) {
244
- it( 'passes through File without content type', () => {
245
- const file = new File( [ 'abc' ], 'a.txt', { type: 'text/plain' } );
246
- const { body, contentType } = serializeBodyAndInferContentType( file );
247
- expect( body ).toBe( file );
248
- expect( contentType ).toBeUndefined();
249
- } );
250
- }
251
-
252
- it( 'passes through async iterator without content type', () => {
253
- const asyncIter = ( async function *() {
254
- yield 'chunk';
255
- } )();
256
- const { body, contentType } = serializeBodyAndInferContentType( asyncIter );
257
- expect( typeof body[Symbol.asyncIterator] ).toBe( 'function' );
258
- expect( contentType ).toBeUndefined();
259
- } );
260
-
261
- it( 'passes through Node Readable without content type', () => {
262
- const readable = Readable.from( [ 'a', 'b' ] );
263
- const { body, contentType } = serializeBodyAndInferContentType( readable );
264
- expect( body ).toBe( readable );
265
- expect( contentType ).toBeUndefined();
266
- } );
267
-
268
- it( 'serializes plain object as JSON with JSON content type', () => {
269
- const input = { a: 1, b: 'two' };
270
- const { body, contentType } = serializeBodyAndInferContentType( input );
271
- expect( body ).toBe( JSON.stringify( input ) );
272
- expect( contentType ).toBe( 'application/json; charset=UTF-8' );
273
- } );
274
-
275
- it( 'serializes string primitive with text/plain content type', () => {
276
- const { body, contentType } = serializeBodyAndInferContentType( 'hello' );
277
- expect( body ).toBe( 'hello' );
278
- expect( contentType ).toBe( 'text/plain; charset=UTF-8' );
279
- } );
280
-
281
- it( 'serializes number primitive with text/plain content type', () => {
282
- const { body, contentType } = serializeBodyAndInferContentType( 42 );
283
- expect( body ).toBe( '42' );
284
- expect( contentType ).toBe( 'text/plain; charset=UTF-8' );
285
- } );
286
-
287
- it( 'serializes boolean primitive with text/plain content type', () => {
288
- const { body, contentType } = serializeBodyAndInferContentType( true );
289
- expect( body ).toBe( 'true' );
290
- expect( contentType ).toBe( 'text/plain; charset=UTF-8' );
291
- } );
292
- } );
@@ -1,24 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { tryOrUndefined } from './function.js';
3
-
4
- describe( 'tryOrUndefined', () => {
5
- it( 'returns the invoked function result', () => {
6
- const fn = vi.fn( () => 'result' );
7
-
8
- expect( tryOrUndefined( fn ) ).toBe( 'result' );
9
- expect( fn ).toHaveBeenCalledOnce();
10
- } );
11
-
12
- it( 'returns undefined when the invoked function throws', () => {
13
- const fn = vi.fn( () => {
14
- throw new Error( 'unavailable' );
15
- } );
16
-
17
- expect( tryOrUndefined( fn ) ).toBeUndefined();
18
- expect( fn ).toHaveBeenCalledOnce();
19
- } );
20
-
21
- it( 'preserves an explicit undefined result', () => {
22
- expect( tryOrUndefined( () => undefined ) ).toBeUndefined();
23
- } );
24
- } );