@trpc/server 10.0.0-alpha.36 → 10.0.0-alpha.39

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 (64) hide show
  1. package/README.md +79 -1
  2. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.dev.js +20 -0
  3. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.cjs.prod.js +20 -0
  4. package/adapters/aws-lambda/dist/trpc-server-adapters-aws-lambda.esm.js +20 -0
  5. package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
  6. package/dist/adapters/aws-lambda/utils.d.ts +4 -3
  7. package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
  8. package/dist/adapters/fastify/index.js +1 -1
  9. package/dist/adapters/fastify/index.mjs +1 -1
  10. package/dist/adapters/ws.js +1 -1
  11. package/dist/adapters/ws.mjs +1 -1
  12. package/dist/core/index.d.ts +2 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/initTRPC.d.ts +1 -1
  15. package/dist/core/internals/procedureBuilder.d.ts +37 -13
  16. package/dist/core/internals/procedureBuilder.d.ts.map +1 -1
  17. package/dist/core/middleware.d.ts +1 -1
  18. package/dist/core/procedure.d.ts +12 -8
  19. package/dist/core/procedure.d.ts.map +1 -1
  20. package/dist/core/router.d.ts +17 -3
  21. package/dist/core/router.d.ts.map +1 -1
  22. package/dist/core/types.d.ts +3 -1
  23. package/dist/core/types.d.ts.map +1 -1
  24. package/dist/deprecated/router.d.ts.map +1 -1
  25. package/dist/index-1a25ccbd.js +33 -0
  26. package/dist/index-a3bd54c7.mjs +31 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +189 -194
  30. package/dist/index.mjs +188 -195
  31. package/dist/internals.d.ts +11 -0
  32. package/dist/internals.d.ts.map +1 -0
  33. package/dist/observable/index.js +1 -1
  34. package/dist/observable/index.mjs +1 -1
  35. package/dist/observable/internals/pipe.d.ts.map +1 -1
  36. package/dist/{observable-3aa4d911.js → observable-341a0506.js} +1 -0
  37. package/dist/{observable-137ea1bd.mjs → observable-cfedfa30.mjs} +1 -0
  38. package/dist/shared/index.js +2 -28
  39. package/dist/shared/index.mjs +1 -31
  40. package/dist/subscription.js +1 -1
  41. package/dist/subscription.mjs +1 -1
  42. package/dist/types.d.ts +10 -0
  43. package/dist/types.d.ts.map +1 -1
  44. package/package.json +3 -3
  45. package/src/adapters/aws-lambda/index.ts +17 -0
  46. package/src/adapters/aws-lambda/utils.ts +2 -1
  47. package/src/core/index.ts +2 -1
  48. package/src/core/internals/procedureBuilder.ts +264 -28
  49. package/src/core/procedure.ts +17 -10
  50. package/src/core/router.ts +79 -78
  51. package/src/core/types.ts +5 -1
  52. package/src/deprecated/internals/procedure.ts +1 -1
  53. package/src/deprecated/interop.ts +4 -4
  54. package/src/deprecated/router.ts +3 -4
  55. package/src/http/resolveHTTPResponse.ts +1 -1
  56. package/src/index.ts +1 -0
  57. package/src/internals.ts +14 -0
  58. package/src/observable/internals/pipe.ts +2 -1
  59. package/src/observable/observable.test.ts +3 -3
  60. package/src/observable/operators/share.test.ts +2 -2
  61. package/src/types.ts +12 -0
  62. package/dist/core/internals/internalProcedure.d.ts +0 -78
  63. package/dist/core/internals/internalProcedure.d.ts.map +0 -1
  64. package/src/core/internals/internalProcedure.ts +0 -296
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ export { a as assertNotBrowser, r as resolveHTTPResponse } from './resolveHTTPRe
3
3
  import { T as TRPC_ERROR_CODES_BY_KEY } from './envelopes-af8c2959.mjs';
4
4
  import { T as TRPCError, g as getCauseFromUnknown, a as getErrorFromUnknown } from './TRPCError-b7fa0c31.mjs';
5
5
  export { T as TRPCError } from './TRPCError-b7fa0c31.mjs';
6
+ import { c as createProxy } from './index-a3bd54c7.mjs';
6
7
  import './transformTRPCResponse-747b9a68.mjs';
7
8
 
8
9
  assertNotBrowser();
@@ -361,96 +362,82 @@ const middlewareMarker = 'middlewareMarker';
361
362
  * @internal
362
363
  */
363
364
 
364
- /**
365
- * This is the actual internal representation of a builder
366
- * FIXME - I want to get rid of this and use the public API instead
367
- */
368
-
369
- function createNewInternalBuilder(def1, def2) {
365
+ function createNewBuilder(def1, def2) {
370
366
  const {
371
367
  middlewares = [],
372
368
  ...rest
373
369
  } = def2; // TODO: maybe have a fn here to warn about calls
374
370
 
375
- return createInternalBuilder({ ...mergeWithoutOverrides(def1, rest),
371
+ return createBuilder({ ...mergeWithoutOverrides(def1, rest),
376
372
  middlewares: [...def1.middlewares, ...middlewares]
377
373
  });
378
374
  }
379
375
 
380
- const codeblock = /*#__PURE__*/`
381
- If you want to call this function on the server, you do the following:
382
- This is a client-only function.
383
-
384
- const caller = appRouter.createCaller({
385
- /* ... your context */
386
- });
376
+ function createBuilder(initDef) {
377
+ const _def = initDef || {
378
+ middlewares: []
379
+ };
387
380
 
388
- const result = await caller.call('myProcedure', input);
389
- `.trim();
381
+ return {
382
+ _def,
390
383
 
391
- function createProcedureCaller(_def) {
392
- const procedure = async function resolve(opts) {
393
- if (!opts || !('rawInput' in opts)) {
394
- throw new Error(codeblock);
395
- } // run the middlewares recursively with the resolver as the last one
384
+ input(input) {
385
+ const parser = getParseFn(input);
386
+ return createNewBuilder(_def, {
387
+ input,
388
+ middlewares: [createInputMiddleware(parser)]
389
+ });
390
+ },
396
391
 
392
+ output(output) {
393
+ const parseOutput = getParseFn(output);
394
+ return createNewBuilder(_def, {
395
+ output,
396
+ middlewares: [createOutputMiddleware(parseOutput)]
397
+ });
398
+ },
397
399
 
398
- const callRecursive = async (callOpts = {
399
- index: 0,
400
- ctx: opts.ctx
401
- }) => {
402
- try {
403
- const middleware = _def.middlewares[callOpts.index];
404
- const result = await middleware({
405
- ctx: callOpts.ctx,
406
- type: opts.type,
407
- path: opts.path,
408
- rawInput: opts.rawInput,
409
- meta: _def.meta,
410
- input: callOpts.input,
411
- next: async nextOpts => {
412
- return await callRecursive({
413
- index: callOpts.index + 1,
414
- ctx: nextOpts && 'ctx' in nextOpts ? { ...callOpts.ctx,
415
- ...nextOpts.ctx
416
- } : callOpts.ctx,
417
- input: nextOpts && 'input' in nextOpts ? nextOpts.input : callOpts.input
418
- });
419
- }
420
- });
421
- return result;
422
- } catch (cause) {
423
- return {
424
- ok: false,
425
- error: getErrorFromUnknown(cause),
426
- marker: middlewareMarker
427
- };
428
- }
429
- }; // there's always at least one "next" since we wrap this.resolver in a middleware
400
+ meta(meta) {
401
+ return createNewBuilder(_def, {
402
+ meta: meta
403
+ });
404
+ },
430
405
 
406
+ /** @deprecated **/
407
+ resolve(resolver) {
408
+ return createResolver(_def, resolver);
409
+ },
431
410
 
432
- const result = await callRecursive();
411
+ unstable_concat(builder) {
412
+ return createNewBuilder(_def, builder._def);
413
+ },
433
414
 
434
- if (!result) {
435
- throw new TRPCError({
436
- code: 'INTERNAL_SERVER_ERROR',
437
- message: 'No result from middlewares - did you forget to `return next()`?'
415
+ use(middleware) {
416
+ return createNewBuilder(_def, {
417
+ middlewares: [middleware]
438
418
  });
439
- }
419
+ },
440
420
 
441
- if (!result.ok) {
442
- // re-throw original error
443
- throw result.error;
421
+ query(resolver) {
422
+ return createResolver({ ..._def,
423
+ query: true
424
+ }, resolver);
425
+ },
426
+
427
+ mutation(resolver) {
428
+ return createResolver({ ..._def,
429
+ mutation: true
430
+ }, resolver);
431
+ },
432
+
433
+ subscription(resolver) {
434
+ return createResolver({ ..._def,
435
+ subscription: true
436
+ }, resolver);
444
437
  }
445
438
 
446
- return result.data;
447
439
  };
448
-
449
- procedure._def = _def;
450
- procedure.meta = _def.meta;
451
- return procedure;
452
440
  }
453
-
454
441
  function createInputMiddleware(parse) {
455
442
  return async function inputMiddleware({
456
443
  next,
@@ -500,7 +487,7 @@ function createOutputMiddleware(parse) {
500
487
  }
501
488
 
502
489
  function createResolver(_def, resolver) {
503
- const finalBuilder = createNewInternalBuilder(_def, {
490
+ const finalBuilder = createNewBuilder(_def, {
504
491
  resolver,
505
492
  middlewares: [async function resolveMiddleware(opts) {
506
493
  const data = await resolver(opts);
@@ -514,72 +501,85 @@ function createResolver(_def, resolver) {
514
501
  });
515
502
  return createProcedureCaller(finalBuilder._def);
516
503
  }
504
+ /**
505
+ * @internal
506
+ */
517
507
 
518
- function createInternalBuilder(initDef) {
519
- const _def = initDef || {
520
- middlewares: []
521
- };
522
508
 
523
- return {
524
- _def,
509
+ const codeblock = /*#__PURE__*/`
510
+ If you want to call this function on the server, you do the following:
511
+ This is a client-only function.
525
512
 
526
- // _call: createProcedureCaller(_def),
527
- input(input) {
528
- const parser = getParseFn(input);
529
- return createNewInternalBuilder(_def, {
530
- input,
531
- middlewares: [createInputMiddleware(parser)]
532
- });
533
- },
513
+ const caller = appRouter.createCaller({
514
+ /* ... your context */
515
+ });
534
516
 
535
- output(output) {
536
- const parseOutput = getParseFn(output);
537
- return createNewInternalBuilder(_def, {
538
- output,
539
- middlewares: [createOutputMiddleware(parseOutput)]
540
- });
541
- },
517
+ const result = await caller.call('myProcedure', input);
518
+ `.trim();
542
519
 
543
- meta(meta) {
544
- return createNewInternalBuilder(_def, {
545
- meta
546
- });
547
- },
520
+ function createProcedureCaller(_def) {
521
+ const procedure = async function resolve(opts) {
522
+ // is direct server-side call
523
+ if (!opts || !('rawInput' in opts)) {
524
+ throw new Error(codeblock);
525
+ } // run the middlewares recursively with the resolver as the last one
548
526
 
549
- /** @deprecated **/
550
- resolve(resolver) {
551
- return createResolver(_def, resolver);
552
- },
553
527
 
554
- unstable_concat(builder) {
555
- return createNewInternalBuilder(_def, builder._def);
556
- },
528
+ const callRecursive = async (callOpts = {
529
+ index: 0,
530
+ ctx: opts.ctx
531
+ }) => {
532
+ try {
533
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
534
+ const middleware = _def.middlewares[callOpts.index];
535
+ const result = await middleware({
536
+ ctx: callOpts.ctx,
537
+ type: opts.type,
538
+ path: opts.path,
539
+ rawInput: opts.rawInput,
540
+ meta: _def.meta,
541
+ input: callOpts.input,
542
+ next: async nextOpts => {
543
+ return await callRecursive({
544
+ index: callOpts.index + 1,
545
+ ctx: nextOpts && 'ctx' in nextOpts ? { ...callOpts.ctx,
546
+ ...nextOpts.ctx
547
+ } : callOpts.ctx,
548
+ input: nextOpts && 'input' in nextOpts ? nextOpts.input : callOpts.input
549
+ });
550
+ }
551
+ });
552
+ return result;
553
+ } catch (cause) {
554
+ return {
555
+ ok: false,
556
+ error: getErrorFromUnknown(cause),
557
+ marker: middlewareMarker
558
+ };
559
+ }
560
+ }; // there's always at least one "next" since we wrap this.resolver in a middleware
557
561
 
558
- use(middleware) {
559
- return createNewInternalBuilder(_def, {
560
- middlewares: [middleware]
561
- });
562
- },
563
562
 
564
- query(resolver) {
565
- return createResolver({ ..._def,
566
- query: true
567
- }, resolver);
568
- },
563
+ const result = await callRecursive();
569
564
 
570
- mutation(resolver) {
571
- return createResolver({ ..._def,
572
- mutation: true
573
- }, resolver);
574
- },
565
+ if (!result) {
566
+ throw new TRPCError({
567
+ code: 'INTERNAL_SERVER_ERROR',
568
+ message: 'No result from middlewares - did you forget to `return next()`?'
569
+ });
570
+ }
575
571
 
576
- subscription(resolver) {
577
- return createResolver({ ..._def,
578
- subscription: true
579
- }, resolver);
572
+ if (!result.ok) {
573
+ // re-throw original error
574
+ throw result.error;
580
575
  }
581
576
 
577
+ return result.data;
582
578
  };
579
+
580
+ procedure._def = _def;
581
+ procedure.meta = _def.meta;
582
+ return procedure;
583
583
  }
584
584
 
585
585
  /**
@@ -590,15 +590,15 @@ function omitPrototype(obj1) {
590
590
  return Object.assign(Object.create(null), obj1);
591
591
  }
592
592
 
593
- /* eslint-disable @typescript-eslint/ban-types */
593
+ const procedureTypes = ['query', 'mutation', 'subscription'];
594
+ /**
595
+ * @public
596
+ */
594
597
 
595
- function createRouterProxy(callback) {
596
- return new Proxy({}, {
597
- get(_, path) {
598
- return (...args) => callback(path, ...args);
599
- }
598
+ /* eslint-disable @typescript-eslint/ban-types */
600
599
 
601
- });
600
+ function isRouter(procedureOrRouter) {
601
+ return 'router' in procedureOrRouter._def;
602
602
  }
603
603
 
604
604
  const emptyRouter = {
@@ -626,9 +626,8 @@ function createRouterFactory(defaults) {
626
626
  for (const [key, procedureOrRouter] of Object.entries(procedures !== null && procedures !== void 0 ? procedures : {})) {
627
627
  const newPath = `${path}${key}`;
628
628
 
629
- if (typeof procedureOrRouter === 'object') {
630
- const router = procedureOrRouter;
631
- recursiveGetPaths(router._def.procedures, `${newPath}.`);
629
+ if (isRouter(procedureOrRouter)) {
630
+ recursiveGetPaths(procedureOrRouter._def.procedures, `${newPath}.`);
632
631
  continue;
633
632
  }
634
633
 
@@ -662,68 +661,45 @@ function createRouterFactory(defaults) {
662
661
  [key]: val
663
662
  }), {})
664
663
  };
665
-
666
- function callProcedure(opts) {
667
- const {
668
- type,
669
- path
670
- } = opts;
671
-
672
- if (!(path in _def.procedures) || !_def.procedures[path]['_def'][type]) {
673
- throw new TRPCError({
674
- code: 'NOT_FOUND',
675
- message: `No "${type}"-procedure on path "${path}"`
676
- });
677
- }
678
-
679
- const procedure = _def.procedures[path];
680
- return procedure(opts);
681
- }
682
-
683
664
  const router = { ...opts,
684
665
  _def,
685
666
  transformer: _def.transformer,
686
667
  errorFormatter: _def.errorFormatter,
687
668
 
688
669
  createCaller(ctx) {
689
- return {
690
- query: (path, ...args) => callProcedure({
691
- path,
692
- rawInput: args[0],
693
- ctx,
694
- type: 'query'
695
- }),
696
- mutation: (path, ...args) => callProcedure({
697
- path,
698
- rawInput: args[0],
699
- ctx,
700
- type: 'mutation'
701
- }),
702
- subscription: (path, ...args) => callProcedure({
703
- path,
670
+ const proxy = createProxy(({
671
+ path,
672
+ args
673
+ }) => {
674
+ // interop mode
675
+ if (path.length === 1 && procedureTypes.includes(path[0])) {
676
+ return callProcedure({
677
+ procedures: _def.procedures,
678
+ path: args[0],
679
+ rawInput: args[1],
680
+ ctx,
681
+ type: path[0]
682
+ });
683
+ }
684
+
685
+ const fullPath = path.join('.');
686
+ const procedure = _def.procedures[fullPath];
687
+ let type = 'query';
688
+
689
+ if (procedure._def.mutation) {
690
+ type = 'mutation';
691
+ } else if (procedure._def.subscription) {
692
+ type = 'subscription';
693
+ }
694
+
695
+ return procedure({
696
+ path: fullPath,
704
697
  rawInput: args[0],
705
698
  ctx,
706
- type: 'subscription'
707
- }),
708
- queries: createRouterProxy((path, rawInput) => callProcedure({
709
- path,
710
- rawInput,
711
- ctx,
712
- type: 'query'
713
- })),
714
- mutations: createRouterProxy((path, rawInput) => callProcedure({
715
- path,
716
- rawInput,
717
- ctx,
718
- type: 'mutation'
719
- })),
720
- subscriptions: createRouterProxy((path, rawInput) => callProcedure({
721
- path,
722
- rawInput,
723
- ctx,
724
- type: 'subscription'
725
- }))
726
- };
699
+ type
700
+ });
701
+ });
702
+ return proxy;
727
703
  },
728
704
 
729
705
  getErrorShape(opts) {
@@ -760,6 +736,28 @@ function createRouterFactory(defaults) {
760
736
  return router;
761
737
  };
762
738
  }
739
+ /**
740
+ * @internal
741
+ */
742
+
743
+ function callProcedure(opts) {
744
+ var _opts$procedures$path;
745
+
746
+ const {
747
+ type,
748
+ path
749
+ } = opts;
750
+
751
+ if (!(path in opts.procedures) || !((_opts$procedures$path = opts.procedures[path]) !== null && _opts$procedures$path !== void 0 && _opts$procedures$path._def[type])) {
752
+ throw new TRPCError({
753
+ code: 'NOT_FOUND',
754
+ message: `No "${type}"-procedure on path "${path}"`
755
+ });
756
+ }
757
+
758
+ const procedure = opts.procedures[path];
759
+ return procedure(opts);
760
+ }
763
761
 
764
762
  function migrateProcedure(oldProc, type) {
765
763
  const def = oldProc._def();
@@ -767,7 +765,7 @@ function migrateProcedure(oldProc, type) {
767
765
  const inputParser = getParseFnOrPassThrough(def.inputParser);
768
766
  const outputParser = getParseFnOrPassThrough(def.outputParser);
769
767
  const inputMiddleware = createInputMiddleware(inputParser);
770
- const builder = createInternalBuilder({
768
+ const builder = createBuilder({
771
769
  input: def.inputParser,
772
770
  middlewares: [...def.middlewares, inputMiddleware, createOutputMiddleware(outputParser)],
773
771
  meta: def.meta,
@@ -862,8 +860,8 @@ class Router {
862
860
  static prefixProcedures(procedures, prefix) {
863
861
  const eps = safeObject();
864
862
 
865
- for (const key in procedures) {
866
- eps[prefix + key] = procedures[key];
863
+ for (const [key, procedure] of Object.entries(procedures)) {
864
+ eps[prefix + key] = procedure;
867
865
  }
868
866
 
869
867
  return eps;
@@ -932,8 +930,7 @@ class Router {
932
930
  const mergeProcedures = defs => {
933
931
  const newDefs = safeObject();
934
932
 
935
- for (const key in defs) {
936
- const procedure = defs[key];
933
+ for (const [key, procedure] of Object.entries(defs)) {
937
934
  const newProcedure = procedure.inheritMiddlewares(this._def.middlewares);
938
935
  newDefs[key] = newProcedure;
939
936
  }
@@ -1136,10 +1133,6 @@ function mergeRoutersGeneric(...args) {
1136
1133
  return mergeRouters(...args);
1137
1134
  }
1138
1135
 
1139
- function createBuilder() {
1140
- return createInternalBuilder();
1141
- }
1142
-
1143
1136
  /**
1144
1137
  * @internal
1145
1138
  */
@@ -1216,4 +1209,4 @@ function initTRPC() {
1216
1209
  };
1217
1210
  }
1218
1211
 
1219
- export { defaultTransformer, getDataTransformer$1 as getDataTransformer, initTRPC, router };
1212
+ export { callProcedure, defaultTransformer, getDataTransformer$1 as getDataTransformer, initTRPC, procedureTypes, router };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * These types have to be exported so users can generate their own types definitions files
3
+ */
4
+ export type { DefaultErrorShape } from './error/formatter';
5
+ export type { mergeRoutersGeneric } from './core/internals/__generated__/mergeRoutersGeneric';
6
+ export type { ProcedureBuilder } from './core/internals/procedureBuilder';
7
+ export type { Overwrite, unsetMarker } from './core/internals/utils';
8
+ export type { MiddlewareFunction } from './core/middleware';
9
+ export type { Router, RouterDef } from './core/router';
10
+ export type { MutationProcedure, QueryProcedure, SubscriptionProcedure, } from './core/procedure';
11
+ //# sourceMappingURL=internals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,YAAY,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,qBAAqB,GACtB,MAAM,kBAAkB,CAAC"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var observable = require('../observable-3aa4d911.js');
5
+ var observable = require('../observable-341a0506.js');
6
6
 
7
7
  /* eslint-disable @typescript-eslint/no-empty-interface */
8
8
  function share( // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1,4 +1,4 @@
1
- export { i as isObservable, o as observable } from '../observable-137ea1bd.mjs';
1
+ export { i as isObservable, o as observable } from '../observable-cfedfa30.mjs';
2
2
 
3
3
  /* eslint-disable @typescript-eslint/no-empty-interface */
4
4
  function share( // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../../src/observable/internals/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAC9B,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAerB"}
1
+ {"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../../src/observable/internals/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAC9B,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAgBrB"}
@@ -12,6 +12,7 @@ function pipeFromArray(fns) {
12
12
  }
13
13
 
14
14
  if (fns.length === 1) {
15
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15
16
  return fns[0];
16
17
  }
17
18
 
@@ -10,6 +10,7 @@ function pipeFromArray(fns) {
10
10
  }
11
11
 
12
12
  if (fns.length === 1) {
13
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13
14
  return fns[0];
14
15
  }
15
16
 
@@ -2,34 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function createProxyInner(callback, ...path) {
6
- const proxy = new Proxy(() => {// noop
7
- }, {
8
- get(_obj, name) {
9
- if (typeof name === 'string') {
10
- return createProxyInner(callback, ...path, name);
11
- }
5
+ var index = require('../index-1a25ccbd.js');
12
6
 
13
- throw new Error('Not supported');
14
- },
15
7
 
16
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
- apply(_1, _2, args) {
18
- return callback({
19
- args,
20
- path
21
- });
22
- }
23
8
 
24
- });
25
- return proxy;
26
- }
27
- /**
28
- * Creates a proxy that calls the callback with the path and arguments
29
- * @internal
30
- */
31
-
32
-
33
- const createProxy = callback => createProxyInner(callback);
34
-
35
- exports.createProxy = createProxy;
9
+ exports.createProxy = index.createProxy;
@@ -1,31 +1 @@
1
- function createProxyInner(callback, ...path) {
2
- const proxy = new Proxy(() => {// noop
3
- }, {
4
- get(_obj, name) {
5
- if (typeof name === 'string') {
6
- return createProxyInner(callback, ...path, name);
7
- }
8
-
9
- throw new Error('Not supported');
10
- },
11
-
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- apply(_1, _2, args) {
14
- return callback({
15
- args,
16
- path
17
- });
18
- }
19
-
20
- });
21
- return proxy;
22
- }
23
- /**
24
- * Creates a proxy that calls the callback with the path and arguments
25
- * @internal
26
- */
27
-
28
-
29
- const createProxy = callback => createProxyInner(callback);
30
-
31
- export { createProxy };
1
+ export { c as createProxy } from '../index-a3bd54c7.mjs';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var TRPCError = require('./TRPCError-9050a68d.js');
6
- var observable = require('./observable-3aa4d911.js');
6
+ var observable = require('./observable-341a0506.js');
7
7
 
8
8
  function subscriptionPullFactory(opts) {
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1,5 +1,5 @@
1
1
  import { a as getErrorFromUnknown } from './TRPCError-b7fa0c31.mjs';
2
- import { o as observable } from './observable-137ea1bd.mjs';
2
+ import { o as observable } from './observable-cfedfa30.mjs';
3
3
 
4
4
  function subscriptionPullFactory(opts) {
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/dist/types.d.ts CHANGED
@@ -54,5 +54,15 @@ declare type FilterKeys<T extends object, K> = {
54
54
  * @internal
55
55
  */
56
56
  export declare type Filter<T extends object, K> = Pick<T, FilterKeys<T, K>>;
57
+ /**
58
+ * @internal
59
+ */
60
+ export declare type NeverKeys<T> = {
61
+ [TKey in keyof T]: T[TKey] extends never ? TKey : never;
62
+ }[keyof T];
63
+ /**
64
+ * @internal
65
+ */
66
+ export declare type OmitNeverKeys<T> = Omit<T, NeverKeys<T>>;
57
67
  export {};
58
68
  //# sourceMappingURL=types.d.ts.map