@pumped-fn/core-next 0.5.62 → 0.5.64

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pumped-fn/core-next
2
2
 
3
+ ## 0.5.64
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d73cdd3`](https://github.com/pumped-fn/pumped-fn/commit/d73cdd3ef852d10e387daf76a36e68868346dd7a) Thanks [@lagz0ne](https://github.com/lagz0ne)! - fix: corrected pod behavior along with presets
8
+
9
+ ## 0.5.63
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f5bab28`](https://github.com/pumped-fn/pumped-fn/commit/f5bab28ba2b1e7fdb42f5f3eef55f39666c7f557) Thanks [@lagz0ne](https://github.com/lagz0ne)! - improved execute api of flow
14
+
3
15
  ## 0.5.62
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1195,6 +1195,9 @@ var Pod = class extends BaseScope {
1195
1195
  */
1196
1196
  async resolve(executor, force) {
1197
1197
  if (this.cache.has(executor)) return super.resolve(executor, force);
1198
+ const replacer = this.initialValues.find((item) => item.executor === executor);
1199
+ if (replacer) return await super.resolve(executor, force);
1200
+ if (this["~hasDependencyWithPreset"](executor)) return await super.resolve(executor, force);
1198
1201
  if (this.parentScope["cache"].has(executor)) {
1199
1202
  const { value } = this.parentScope["cache"].get(executor);
1200
1203
  const accessor$1 = super["~makeAccessor"](executor);
@@ -1208,13 +1211,28 @@ var Pod = class extends BaseScope {
1208
1211
  }
1209
1212
  return await super.resolve(executor, force);
1210
1213
  }
1214
+ "~hasDependencyWithPreset"(executor) {
1215
+ if (!executor.dependencies) return false;
1216
+ const checkDependency = (dep) => {
1217
+ const actualExecutor = getExecutor(dep);
1218
+ const hasPreset = this.initialValues.some((item) => item.executor === actualExecutor);
1219
+ if (hasPreset) return true;
1220
+ if (actualExecutor.dependencies) return this["~hasDependencyWithPreset"](actualExecutor);
1221
+ return false;
1222
+ };
1223
+ const deps = executor.dependencies;
1224
+ if (Array.isArray(deps)) return deps.some(checkDependency);
1225
+ else if (typeof deps === "object" && deps !== null) return Object.values(deps).some(checkDependency);
1226
+ else return checkDependency(deps);
1227
+ }
1211
1228
  async "~resolveExecutor"(ie, ref) {
1212
1229
  if (isReactiveExecutor(ie)) throw new Error("Reactive executors cannot be used in pod");
1213
1230
  const t = getExecutor(ie);
1214
1231
  this["~checkCircularDependency"](t, ref);
1215
1232
  this["~propagateResolutionChain"](ref, t);
1216
1233
  const a = this["~makeAccessor"](t);
1217
- if (this.parentScope["cache"].has(t)) {
1234
+ const replacer = this.initialValues.find((item) => item.executor === t);
1235
+ if (!replacer && this.parentScope["cache"].has(t)) {
1218
1236
  const { value } = this.parentScope["cache"].get(t);
1219
1237
  this["cache"].set(t, {
1220
1238
  accessor: a,
@@ -1227,7 +1245,7 @@ var Pod = class extends BaseScope {
1227
1245
 
1228
1246
  //#endregion
1229
1247
  //#region src/flow.ts
1230
- const ok = (data) => ({
1248
+ const ok$1 = (data) => ({
1231
1249
  type: "ok",
1232
1250
  data,
1233
1251
  isOk() {
@@ -1237,7 +1255,7 @@ const ok = (data) => ({
1237
1255
  return false;
1238
1256
  }
1239
1257
  });
1240
- const ko = (data) => ({
1258
+ const ko$1 = (data) => ({
1241
1259
  type: "ko",
1242
1260
  data,
1243
1261
  isOk() {
@@ -1255,13 +1273,13 @@ const FlowExecutionContext = {
1255
1273
  isParallel: accessor("flow.isParallel", custom(), false)
1256
1274
  };
1257
1275
  var FlowDefinition = class {
1258
- constructor(name$1, version, input, success, error, meta$1 = []) {
1276
+ constructor(name$1, version, input, success, error, metas = []) {
1259
1277
  this.name = name$1;
1260
1278
  this.version = version;
1261
1279
  this.input = input;
1262
1280
  this.success = success;
1263
1281
  this.error = error;
1264
- this.meta = meta$1;
1282
+ this.metas = metas;
1265
1283
  }
1266
1284
  handler(dependenciesOrHandler, handlerFn) {
1267
1285
  if (typeof dependenciesOrHandler === "function") {
@@ -1271,7 +1289,7 @@ var FlowDefinition = class {
1271
1289
  return noDepsHandler(ctx, ctx.input);
1272
1290
  };
1273
1291
  return flowHandler;
1274
- }, void 0, [...this.meta, flowDefinitionMeta(this)]);
1292
+ }, void 0, [...this.metas, flowDefinitionMeta(this)]);
1275
1293
  }
1276
1294
  const dependencies = dependenciesOrHandler;
1277
1295
  const dependentHandler = handlerFn;
@@ -1280,7 +1298,7 @@ var FlowDefinition = class {
1280
1298
  return dependentHandler(deps, ctx, ctx.input);
1281
1299
  };
1282
1300
  return flowHandler;
1283
- }, dependencies, [...this.meta, flowDefinitionMeta(this)]);
1301
+ }, dependencies, [...this.metas, flowDefinitionMeta(this)]);
1284
1302
  }
1285
1303
  };
1286
1304
  function define(config) {
@@ -1302,8 +1320,8 @@ var FlowContext = class FlowContext {
1302
1320
  FlowExecutionContext.parentFlowName.set(this, parentFlowName);
1303
1321
  FlowExecutionContext.isParallel.set(this, isParallel);
1304
1322
  }
1305
- ok = (data) => ok(data);
1306
- ko = (data) => ko(data);
1323
+ ok = (data) => ok$1(data);
1324
+ ko = (data) => ko$1(data);
1307
1325
  get(key) {
1308
1326
  if (this.contextData.has(key)) return this.contextData.get(key);
1309
1327
  return this.parent?.get(key);
@@ -1315,7 +1333,23 @@ var FlowContext = class FlowContext {
1315
1333
  output = (success, value) => {
1316
1334
  return success ? this.ok(value) : this.ko(value);
1317
1335
  };
1318
- async execute(flow$1, input) {
1336
+ async execute(flowOrFn, input, errorMapperOrOpt, opt) {
1337
+ let errorMapper;
1338
+ let actualOpt;
1339
+ if (typeof errorMapperOrOpt === "function") {
1340
+ errorMapper = errorMapperOrOpt;
1341
+ actualOpt = opt;
1342
+ } else actualOpt = errorMapperOrOpt;
1343
+ if (typeof flowOrFn === "function" && !flowDefinitionMeta.find(flowOrFn)) try {
1344
+ let result;
1345
+ if (Array.isArray(input)) result = await flowOrFn(...input);
1346
+ else result = await flowOrFn(input);
1347
+ return this.ok(result);
1348
+ } catch (error) {
1349
+ const mappedError = errorMapper ? errorMapper(error) : error;
1350
+ return this.ko(mappedError);
1351
+ }
1352
+ const flow$1 = flowOrFn;
1319
1353
  const handler = await this.pod.resolve(flow$1);
1320
1354
  const definition = flowDefinitionMeta.find(flow$1);
1321
1355
  if (!definition) throw new Error("Flow definition not found in executor metadata");
@@ -1323,8 +1357,17 @@ var FlowContext = class FlowContext {
1323
1357
  childContext.initializeExecutionContext(definition.name, false);
1324
1358
  return await this.executeWithPlugins(handler, childContext);
1325
1359
  }
1326
- async executeParallel(flows) {
1327
- const results = await Promise.all(flows.map(async ([flow$1, input]) => {
1360
+ async executeParallel(items) {
1361
+ const results = await Promise.all(items.map(async ([flowOrFn, input]) => {
1362
+ if (typeof flowOrFn === "function" && !flowDefinitionMeta.find(flowOrFn)) try {
1363
+ let result;
1364
+ if (Array.isArray(input)) result = await flowOrFn(...input);
1365
+ else result = await flowOrFn(input);
1366
+ return this.ok(result);
1367
+ } catch (error) {
1368
+ return this.ko(error);
1369
+ }
1370
+ const flow$1 = flowOrFn;
1328
1371
  const childContext = new FlowContext(input, this.pod, this.plugins, this);
1329
1372
  const handler = await this.pod.resolve(flow$1);
1330
1373
  const definition = flowDefinitionMeta.find(flow$1);
@@ -1424,6 +1467,150 @@ const eager = {
1424
1467
  } })
1425
1468
  };
1426
1469
 
1470
+ //#endregion
1471
+ //#region src/executes.ts
1472
+ var executes_exports = {};
1473
+ __export(executes_exports, {
1474
+ Service: () => Service,
1475
+ chain: () => chain,
1476
+ chainAsync: () => chainAsync,
1477
+ combine: () => combine,
1478
+ ko: () => ko,
1479
+ map: () => map,
1480
+ mapAsync: () => mapAsync,
1481
+ ok: () => ok,
1482
+ unwrap: () => unwrap,
1483
+ unwrapOrThrow: () => unwrapOrThrow
1484
+ });
1485
+ /**
1486
+ * Helper functions to create Result types
1487
+ */
1488
+ const ok = (data) => ({
1489
+ type: "ok",
1490
+ data,
1491
+ isOk() {
1492
+ return true;
1493
+ },
1494
+ isKo() {
1495
+ return false;
1496
+ }
1497
+ });
1498
+ const ko = (data) => ({
1499
+ type: "ko",
1500
+ data,
1501
+ isOk() {
1502
+ return false;
1503
+ },
1504
+ isKo() {
1505
+ return true;
1506
+ }
1507
+ });
1508
+ /**
1509
+ * Chains Result-returning functions, stopping on first error
1510
+ */
1511
+ function chain(result, fn) {
1512
+ if (result.type === "ko") return result;
1513
+ return fn(result.data);
1514
+ }
1515
+ /**
1516
+ * Async version of chain
1517
+ */
1518
+ async function chainAsync(result, fn) {
1519
+ if (result.type === "ko") return result;
1520
+ return await fn(result.data);
1521
+ }
1522
+ /**
1523
+ * Maps over a successful Result, leaving errors unchanged
1524
+ */
1525
+ function map(result, fn) {
1526
+ if (result.type === "ko") return result;
1527
+ try {
1528
+ return ok(fn(result.data));
1529
+ } catch (error) {
1530
+ return ko(error);
1531
+ }
1532
+ }
1533
+ /**
1534
+ * Async version of map
1535
+ */
1536
+ async function mapAsync(result, fn) {
1537
+ if (result.type === "ko") return result;
1538
+ try {
1539
+ const mapped = await fn(result.data);
1540
+ return ok(mapped);
1541
+ } catch (error) {
1542
+ return ko(error);
1543
+ }
1544
+ }
1545
+ /**
1546
+ * Extracts value from Result or returns default
1547
+ */
1548
+ function unwrap(result, defaultValue) {
1549
+ return result.type === "ok" ? result.data : defaultValue;
1550
+ }
1551
+ /**
1552
+ * Extracts value from Result or throws
1553
+ */
1554
+ function unwrapOrThrow(result) {
1555
+ if (result.type === "ko") throw result.data;
1556
+ return result.data;
1557
+ }
1558
+ /**
1559
+ * Combines multiple Results into one, failing if any fail
1560
+ */
1561
+ function combine(results) {
1562
+ const values = [];
1563
+ for (const result of results) {
1564
+ if (result.type === "ko") return result;
1565
+ values.push(result.data);
1566
+ }
1567
+ return ok(values);
1568
+ }
1569
+ let Service;
1570
+ (function(_Service) {
1571
+ function wrap(service) {
1572
+ const wrapped = {};
1573
+ for (const [key, method] of Object.entries(service)) if (typeof method === "function") wrapped[key] = (...args) => {
1574
+ try {
1575
+ const result = method.call(service, ...args);
1576
+ return ok(result);
1577
+ } catch (error) {
1578
+ return ko(error);
1579
+ }
1580
+ };
1581
+ return wrapped;
1582
+ }
1583
+ _Service.wrap = wrap;
1584
+ function wrapAsync(service) {
1585
+ const wrapped = {};
1586
+ for (const [key, method] of Object.entries(service)) if (typeof method === "function") wrapped[key] = async (...args) => {
1587
+ try {
1588
+ const result = await method.call(service, ...args);
1589
+ return ok(result);
1590
+ } catch (error) {
1591
+ return ko(error);
1592
+ }
1593
+ };
1594
+ return wrapped;
1595
+ }
1596
+ _Service.wrapAsync = wrapAsync;
1597
+ function withRetry(service, maxRetries = 3, delayMs = 1e3) {
1598
+ const retryService = {};
1599
+ for (const [key, method] of Object.entries(service)) if (typeof method === "function") retryService[key] = async (...args) => {
1600
+ let lastError;
1601
+ for (let i = 0; i <= maxRetries; i++) {
1602
+ const result = await method(...args);
1603
+ if (result.type === "ok") return result;
1604
+ lastError = result;
1605
+ if (i < maxRetries) await new Promise((resolve) => setTimeout(resolve, delayMs * (i + 1)));
1606
+ }
1607
+ return lastError;
1608
+ };
1609
+ return retryService;
1610
+ }
1611
+ _Service.withRetry = withRetry;
1612
+ })(Service || (Service = {}));
1613
+
1427
1614
  //#endregion
1428
1615
  //#region src/index.ts
1429
1616
  const name = meta("pumped-fn/name", custom());
@@ -1446,6 +1633,12 @@ exports.createScope = createScope;
1446
1633
  exports.createSystemError = createSystemError;
1447
1634
  exports.custom = custom;
1448
1635
  exports.derive = derive;
1636
+ Object.defineProperty(exports, 'executes', {
1637
+ enumerable: true,
1638
+ get: function () {
1639
+ return executes_exports;
1640
+ }
1641
+ });
1449
1642
  exports.executorSymbol = executorSymbol;
1450
1643
  exports.findValue = findValue;
1451
1644
  exports.findValues = findValues;
package/dist/index.d.cts CHANGED
@@ -254,65 +254,6 @@ declare namespace Core {
254
254
  disposePod(scope: Pod): Promise<void>;
255
255
  }
256
256
  }
257
- declare namespace Flow {
258
- type ContextData = Map<unknown, unknown>;
259
- type ExecuteOpt = {
260
- scope?: Core.Scope;
261
- name?: string;
262
- description?: string;
263
- plugins?: FlowPlugin[];
264
- presets?: Core.Preset<unknown>[];
265
- initialContext?: ContextData;
266
- };
267
- type Controller = {
268
- execute: <Input, Output>(input: Flow<Input, Output>, param: Input, opt?: ExecuteOpt) => Promise<Output>;
269
- safeExecute: <Input, Output>(input: Flow<Input, Output>, param: Input, opt?: ExecuteOpt) => Promise<Result<Output>>;
270
- };
271
- type NoDependencyFlowFn<Input, Output> = (input: Input, context: Controller & {
272
- context: ExecutionContext;
273
- }) => Output | Promise<Output>;
274
- type DependentFlowFn<D, Input, Output> = (dependency: D, input: Input, context: Controller & {
275
- context: ExecutionContext;
276
- }) => Output | Promise<Output>;
277
- type FlowPlugin = {
278
- name: string;
279
- wrap<T>(context: ExecutionContext, execute: () => Promise<T>): Promise<T>;
280
- };
281
- type Flow<Input, Output> = {
282
- execution: NoDependencyFlowFn<Input, Output>;
283
- } & Config & Schema<Input, Output>;
284
- type Schema<Input, Output> = {
285
- input: StandardSchemaV1<Input>;
286
- output: StandardSchemaV1<Output>;
287
- };
288
- type Config = {
289
- name?: string;
290
- description?: string;
291
- plugins?: FlowPlugin[];
292
- metas?: Meta.Meta[];
293
- };
294
- type Executor<Input, Output> = Core.Executor<Flow<Input, Output>> & Config & Schema<Input, Output>;
295
- interface ExecutionContext<Input = any, Output = any> extends DataStore {
296
- data: Map<unknown, unknown>;
297
- parent?: ExecutionContext;
298
- scope: Core.Scope;
299
- plugins: FlowPlugin[];
300
- flow: Flow<Input, Output>;
301
- }
302
- type Success<T> = {
303
- kind: "success";
304
- value: T;
305
- };
306
- type Error = {
307
- kind: "error";
308
- error: unknown;
309
- };
310
- type Result<T> = Success<T> | Error;
311
- type ExecutionResult<Output> = {
312
- context: ExecutionContext;
313
- result: Result<Output>;
314
- };
315
- }
316
257
  declare namespace Flow {
317
258
  type OK<S> = {
318
259
  type: "ok";
@@ -333,7 +274,7 @@ declare namespace Flow {
333
274
  success: StandardSchemaV1<S>;
334
275
  error: StandardSchemaV1<E>;
335
276
  version?: string;
336
- };
277
+ } & Meta.MetaContainer;
337
278
  interface NoDependencyHandler<I, S, E> {
338
279
  (ctx: Context<I, S, E>): OutputLike<S, E> | Promise<OutputLike<S, E>>;
339
280
  def: Definition<I, S, E>;
@@ -349,6 +290,9 @@ declare namespace Flow {
349
290
  type InferSuccess<F> = F extends NoDependencyFlow<any, infer S, any> ? S : F extends DependentFlow<any, any, infer S, any> ? S : never;
350
291
  type InferError<F> = F extends NoDependencyFlow<any, any, infer E> ? E : F extends DependentFlow<any, any, any, infer E> ? E : never;
351
292
  type InferOutput<F> = F extends NoDependencyFlow<any, infer S, infer E> ? OK<S> | KO<E> : F extends DependentFlow<any, any, infer S, infer E> ? OK<S> | KO<E> : never;
293
+ type FnExecutor<I, O> = (input: I) => O | Promise<O>;
294
+ type MultiFnExecutor<Args extends readonly unknown[], O> = (...args: Args) => O | Promise<O>;
295
+ type AnyFnExecutor<O = unknown> = FnExecutor<any, O> | MultiFnExecutor<any[], O>;
352
296
  type R<S, E> = {
353
297
  ok: (value: S) => OK<S>;
354
298
  ko: (value: E) => KO<E>;
@@ -356,8 +300,16 @@ declare namespace Flow {
356
300
  };
357
301
  type Opt = {};
358
302
  type C = {
359
- execute: <F extends UFlow>(flow: F, param: InferInput<F>, opt?: Opt) => Promise<InferOutput<F>>;
360
- executeParallel: <T extends ReadonlyArray<[UFlow, any]>>(flows: T) => Promise<{ [K in keyof T]: T[K] extends [infer F, any] ? F extends UFlow ? Awaited<InferOutput<F>> : never : never }>;
303
+ execute: {
304
+ <F extends UFlow>(flow: F, input: InferInput<F>, opt?: Opt): Promise<InferOutput<F>>;
305
+ <I, O, E = unknown>(fn: FnExecutor<I, O>, input: I, errorMapper?: (error: unknown) => E, opt?: Opt): Promise<OK<O> | KO<E>>;
306
+ <Args extends readonly unknown[], O, E = unknown>(fn: MultiFnExecutor<Args, O>, args: Args, errorMapper?: (error: unknown) => E, opt?: Opt): Promise<OK<O> | KO<E>>;
307
+ };
308
+ executeParallel: {
309
+ <T extends ReadonlyArray<[UFlow, any]>>(flows: T): Promise<{ [K in keyof T]: T[K] extends [infer F, any] ? F extends UFlow ? Awaited<InferOutput<F>> : never : never }>;
310
+ <T extends ReadonlyArray<[FnExecutor<any, any> | MultiFnExecutor<any[], any>, any]>>(items: T): Promise<{ [K in keyof T]: T[K] extends [infer F, any] ? F extends FnExecutor<any, infer O> ? OK<O> | KO<unknown> : F extends MultiFnExecutor<any[], infer O> ? OK<O> | KO<unknown> : never : never }>;
311
+ <T extends ReadonlyArray<[UFlow | FnExecutor<any, any> | MultiFnExecutor<any[], any>, any]>>(mixed: T): Promise<{ [K in keyof T]: T[K] extends [infer F, any] ? F extends UFlow ? Awaited<InferOutput<F>> : F extends FnExecutor<any, infer O> ? OK<O> | KO<unknown> : F extends MultiFnExecutor<any[], infer O> ? OK<O> | KO<unknown> : never : never }>;
312
+ };
361
313
  };
362
314
  type Context<I, S, E> = DataStore & R<S, E> & C & {
363
315
  input: I;
@@ -537,8 +489,8 @@ declare class FlowDefinition<I, S, E> {
537
489
  readonly input: StandardSchemaV1<I>;
538
490
  readonly success: StandardSchemaV1<S>;
539
491
  readonly error: StandardSchemaV1<E>;
540
- readonly meta: Meta.Meta[];
541
- constructor(name: string, version: string, input: StandardSchemaV1<I>, success: StandardSchemaV1<S>, error: StandardSchemaV1<E>, meta?: Meta.Meta[]);
492
+ readonly metas: Meta.Meta[];
493
+ constructor(name: string, version: string, input: StandardSchemaV1<I>, success: StandardSchemaV1<S>, error: StandardSchemaV1<E>, metas?: Meta.Meta[]);
542
494
  handler(handlerFn: (ctx: Flow.Context<I, S, E>, input: I) => Promise<Flow.OutputLike<S, E>> | Flow.OutputLike<S, E>): Core.Executor<Flow.NoDependencyHandler<I, S, E>>;
543
495
  handler<D extends Core.DependencyLike>(dependencies: D, handlerFn: (deps: Core.InferOutput<D>, ctx: Flow.Context<I, S, E>, input: I) => Promise<Flow.OutputLike<S, E>> | Flow.OutputLike<S, E>): Core.Executor<Flow.DependentHandler<D, I, S, E>>;
544
496
  }
@@ -574,9 +526,57 @@ declare const eager: {
574
526
  meta: Meta.MetaFn<boolean>;
575
527
  plugin: () => Core.Plugin;
576
528
  };
529
+ declare namespace executes_d_exports {
530
+ export { Result$1 as Result, Service, chain, chainAsync, combine, ko, map, mapAsync, ok$1 as ok, unwrap, unwrapOrThrow };
531
+ }
532
+ /**
533
+ * Result type aliases for cleaner usage
534
+ */
535
+ type Result$1<T, E = unknown> = Flow.OK<T> | Flow.KO<E>;
536
+ /**
537
+ * Helper functions to create Result types
538
+ */
539
+ declare const ok$1: <T>(data: T) => Flow.OK<T>;
540
+ declare const ko: <E>(data: E) => Flow.KO<E>;
541
+ /**
542
+ * Chains Result-returning functions, stopping on first error
543
+ */
544
+ declare function chain<T, U>(result: Result$1<T>, fn: (value: T) => Result$1<U>): Result$1<U>;
545
+ /**
546
+ * Async version of chain
547
+ */
548
+ declare function chainAsync<T, U>(result: Result$1<T>, fn: (value: T) => Promise<Result$1<U>>): Promise<Result$1<U>>;
549
+ /**
550
+ * Maps over a successful Result, leaving errors unchanged
551
+ */
552
+ declare function map<T, U>(result: Result$1<T>, fn: (value: T) => U): Result$1<U>;
553
+ /**
554
+ * Async version of map
555
+ */
556
+ declare function mapAsync<T, U>(result: Result$1<T>, fn: (value: T) => Promise<U>): Promise<Result$1<U>>;
557
+ /**
558
+ * Extracts value from Result or returns default
559
+ */
560
+ declare function unwrap<T>(result: Result$1<T>, defaultValue: T): T;
561
+ /**
562
+ * Extracts value from Result or throws
563
+ */
564
+ declare function unwrapOrThrow<T>(result: Result$1<T>): T;
565
+ /**
566
+ * Combines multiple Results into one, failing if any fail
567
+ */
568
+ declare function combine<T extends readonly Result$1<any>[]>(results: T): Result$1<{ [K in keyof T]: T[K] extends Result$1<infer U> ? U : never }>;
569
+ /**
570
+ * Service composition helpers
571
+ */
572
+ declare namespace Service {
573
+ function wrap<T extends Record<string, (...args: any[]) => any>>(service: T): { [K in keyof T]: T[K] extends ((...args: infer Args) => infer R) ? (...args: Args) => Result$1<R> : never };
574
+ function wrapAsync<T extends Record<string, (...args: any[]) => Promise<any>>>(service: T): { [K in keyof T]: T[K] extends ((...args: infer Args) => Promise<infer R>) ? (...args: Args) => Promise<Result$1<R>> : never };
575
+ function withRetry<T extends Record<string, (...args: any[]) => Promise<Result$1<any>>>>(service: T, maxRetries?: number, delayMs?: number): T;
576
+ }
577
577
  //#endregion
578
578
  //#region src/index.d.ts
579
579
  declare const name: Meta.MetaFn<string>;
580
580
  //#endregion
581
- export { type Accessor$1 as Accessor, type AccessorSource, type AccessorWithDefault, AdaptedExecutor, Core, type DataStore, DependencyResolutionError, ErrorCode, ErrorCodes, ErrorContext, ErrorMessages, Escapable, ExecutorResolutionError, FactoryExecutionError, type Flow, FlowExecutionContext, GeneratorHandler, Meta, Multi, PreparedExecutor, SchemaError, ScopeOption, StandardSchemaV1, accessor, adapt, buildDependencyChain, collectFromGenerator, createDependencyError, createFactoryError, createScope, createSystemError, custom, derive, executorSymbol, findValue, findValues, flow, formatErrorMessage, getExecutorName, getValue, isAsyncGenerator, isAsyncGeneratorFunction, isExecutor, isGenerator, isGeneratorFunction, isIterableOrAsyncIterable, isLazyExecutor, isMainExecutor, isPreset, isReactiveExecutor, isStaticExecutor, meta, metaSymbol, multi_d_exports as multi, name, plugin, plugins_d_exports as plugins, prepare, preset, processGenerator, provide, resolves, validate };
581
+ export { type Accessor$1 as Accessor, type AccessorSource, type AccessorWithDefault, AdaptedExecutor, Core, type DataStore, DependencyResolutionError, ErrorCode, ErrorCodes, ErrorContext, ErrorMessages, Escapable, ExecutorResolutionError, FactoryExecutionError, type Flow, FlowExecutionContext, GeneratorHandler, Meta, Multi, PreparedExecutor, SchemaError, ScopeOption, StandardSchemaV1, accessor, adapt, buildDependencyChain, collectFromGenerator, createDependencyError, createFactoryError, createScope, createSystemError, custom, derive, executes_d_exports as executes, executorSymbol, findValue, findValues, flow, formatErrorMessage, getExecutorName, getValue, isAsyncGenerator, isAsyncGeneratorFunction, isExecutor, isGenerator, isGeneratorFunction, isIterableOrAsyncIterable, isLazyExecutor, isMainExecutor, isPreset, isReactiveExecutor, isStaticExecutor, meta, metaSymbol, multi_d_exports as multi, name, plugin, plugins_d_exports as plugins, prepare, preset, processGenerator, provide, resolves, validate };
582
582
  //# sourceMappingURL=index.d.cts.map