@layerzerolabs/function-pointer 0.2.68 → 0.2.70

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/dist/index.cjs CHANGED
@@ -2,22 +2,43 @@
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- var curryFunctionPointer = /* @__PURE__ */ __name((pointer) => (args) => ({
5
+ var curryFunctionPointer = /* @__PURE__ */ __name((pointer) => (...args) => ({
6
6
  ...pointer,
7
7
  args: [
8
8
  ...pointer.args,
9
9
  ...args
10
10
  ]
11
11
  }), "curryFunctionPointer");
12
- var curryDimensionlessFunctionPointer = /* @__PURE__ */ __name((pointer) => (args) => ({
12
+ var curryDimensionlessFunctionPointer = /* @__PURE__ */ __name((pointer) => (...args) => ({
13
13
  ...pointer,
14
14
  args: [
15
15
  ...pointer.args,
16
16
  ...args
17
17
  ]
18
18
  }), "curryDimensionlessFunctionPointer");
19
+ var isFunctionPointer = /* @__PURE__ */ __name((o) => o.args && o.dimKey && o.factoryName && o.methodName, "isFunctionPointer");
20
+ var deeplyResolveDeepFunctionPointers = /* @__PURE__ */ __name(async (deepFunctionPointers, resolveFunctionPointer) => Object.fromEntries(await Promise.all(Object.entries(deepFunctionPointers).map(async ([k, v]) => {
21
+ if (v === null) {
22
+ return [
23
+ k,
24
+ v
25
+ ];
26
+ }
27
+ if (isFunctionPointer(v)) {
28
+ return [
29
+ k,
30
+ await resolveFunctionPointer(v)
31
+ ];
32
+ }
33
+ return [
34
+ k,
35
+ await deeplyResolveDeepFunctionPointers(v, resolveFunctionPointer)
36
+ ];
37
+ }))), "deeplyResolveDeepFunctionPointers");
19
38
 
20
39
  exports.curryDimensionlessFunctionPointer = curryDimensionlessFunctionPointer;
21
40
  exports.curryFunctionPointer = curryFunctionPointer;
41
+ exports.deeplyResolveDeepFunctionPointers = deeplyResolveDeepFunctionPointers;
42
+ exports.isFunctionPointer = isFunctionPointer;
22
43
  //# sourceMappingURL=index.cjs.map
23
44
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["curryFunctionPointer","pointer","args","curryDimensionlessFunctionPointer"],"mappings":";;;;AAkDO,IAAMA,oBAAAA,mBACT,MAAA,CAAA,CAAwCC,OAAAA,KACxC,CAAqEC,IAAAA,MAChE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,sBAAA;AAUG,IAAMC,iCAAAA,mBACT,MAAA,CAAA,CAAqDF,OAAAA,KACrD,CAAqEC,IAAAA,MAChE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,mCAAA","file":"index.cjs","sourcesContent":["import type { SubtractTuple } from '@layerzerolabs/typescript-utils';\nimport { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';\n\nconst fpSym = Symbol('_fp_tag');\nconst dimSym = Symbol('_dim_tag');\n\n/**\n * <!-- anchor:FunctionPointer -->\n */\nexport type FunctionPointer<\n Input extends any[] = any[],\n Output extends Promise<any> = Promise<any>,\n> = {\n factoryName: string;\n dimKey: string;\n methodName: string;\n // an improper subset of the arguments expected by the method this points to\n args: any[];\n} & {\n // we do it this way to preserve contravariance of the input type\n [fpSym]: (...args: Input) => Output;\n};\n\nexport type DimensionlessFunctionPointer<\n Input extends any[] = any[],\n Output extends Promise<any> = Promise<any>,\n Dim = any,\n> = {\n factoryName: string;\n methodName: string;\n args: any[];\n} & {\n [fpSym]: (...args: Input) => Output;\n [dimSym]: Dim;\n};\n\nexport type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Pointer extends FunctionPointer<infer M>\n ? M\n : Pointer extends DimensionlessFunctionPointer<infer M>\n ? M\n : never;\n\nexport type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Pointer extends FunctionPointer<any, infer A>\n ? A\n : Pointer extends DimensionlessFunctionPointer<any, infer A>\n ? A\n : never;\n\nexport const curryFunctionPointer =\n <const Pointer extends FunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as FunctionPointer<\n SubtractTuple<FunctionPointerInput<Pointer>, Args>,\n FunctionPointerOutput<Pointer>\n >;\n\nexport const curryDimensionlessFunctionPointer =\n <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as DimensionlessFunctionPointer<\n SubtractTuple<FunctionPointerInput<Pointer>, Args>,\n FunctionPointerOutput<Pointer>\n >;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["curryFunctionPointer","pointer","args","curryDimensionlessFunctionPointer","isFunctionPointer","o","dimKey","factoryName","methodName","deeplyResolveDeepFunctionPointers","deepFunctionPointers","resolveFunctionPointer","Object","fromEntries","Promise","all","entries","map","k","v"],"mappings":";;;;AAgDO,IAAMA,oBAAAA,mBACT,MAAA,CAAA,CAAwCC,OAAAA,KACxC,CAAA,GAAwEC,IAAAA,MACnE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,sBAAA;AAWG,IAAMC,iCAAAA,mBACT,MAAA,CAAA,CAAqDF,OAAAA,KACrD,CAAA,GAAwEC,IAAAA,MACnE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,mCAAA;AAWG,IAAME,iBAAAA,mBAAoB,MAAA,CAAA,CAACC,CAAAA,KAC9BA,CAAAA,CAAEH,IAAAA,IAAQG,EAAEC,MAAAA,IAAUD,CAAAA,CAAEE,WAAAA,IAAeF,CAAAA,CAAEG,UAAAA,EADZ,mBAAA;AAmB1B,IAAMC,oDAAoC,MAAA,CAAA,OAG7CC,oBAAAA,EACAC,2BAEAC,MAAAA,CAAOC,WAAAA,CACH,MAAMC,OAAAA,CAAQC,GAAAA,CACVH,MAAAA,CAAOI,OAAAA,CAAQN,oBAAAA,CAAAA,CAAsBO,GAAAA,CAAI,OAAO,CAACC,CAAAA,EAAGC,CAAAA,CAAAA,KAAE;AAClD,EAAA,IAAIA,MAAM,IAAA,EAAM;AACZ,IAAA,OAAO;AAACD,MAAAA,CAAAA;AAAGC,MAAAA;;AACf,EAAA;AAEA,EAAA,IAAIf,iBAAAA,CAAkBe,CAAAA,CAAAA,EAAI;AACtB,IAAA,OAAO;AAACD,MAAAA,CAAAA;AAAG,MAAA,MAAMP,uBAAuBQ,CAAAA;;AAC5C,EAAA;AAEA,EAAA,OAAO;AACHD,IAAAA,CAAAA;IACA,MAAMT,iCAAAA,CACFU,GACAR,sBAAAA;;AAGZ,CAAA,CAAA,CAAA,CAAA,EAxBqC,mCAAA","file":"index.cjs","sourcesContent":["import type { SubtractTuple } from '@layerzerolabs/typescript-utils';\nimport { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';\n\nconst fpSym = Symbol('_fp_tag');\nconst dimSym = Symbol('_dim_tag');\n\nexport type FunctionPointer<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n> = {\n factoryName: string;\n dimKey: string;\n methodName: string;\n // an improper subset of the arguments expected by the method this points to\n args: any[];\n} & {\n // we do it this way to preserve contravariance of the input type\n // AND to brand the pointer\n [fpSym]: Fn;\n};\n\nexport type DimensionlessFunctionPointer<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n Dim = any,\n> = {\n factoryName: string;\n methodName: string;\n args: any[];\n} & {\n [fpSym]: Fn;\n [dimSym]: Dim;\n};\n\nexport type FunctionPointerUnderlying<\n Pointer extends FunctionPointer | DimensionlessFunctionPointer,\n> =\n Pointer extends FunctionPointer<infer Fn>\n ? Fn\n : Pointer extends DimensionlessFunctionPointer<infer Fn>\n ? Fn\n : never;\n\nexport type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Parameters<FunctionPointerUnderlying<Pointer>>;\n\nexport type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n ReturnType<FunctionPointerUnderlying<Pointer>>;\n\n// Does not and cannot preserve generic functions\nexport const curryFunctionPointer =\n <const Pointer extends FunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as FunctionPointer<\n (\n ...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>\n ) => FunctionPointerOutput<Pointer>\n >;\n\nexport const curryDimensionlessFunctionPointer =\n <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as DimensionlessFunctionPointer<\n (\n ...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>\n ) => FunctionPointerOutput<Pointer>\n >;\n\nexport const isFunctionPointer = (o: any): o is FunctionPointer =>\n o.args && o.dimKey && o.factoryName && o.methodName;\n\nexport type DeepFunctionPointers<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n> = {\n [key: string]: DeepFunctionPointers<Fn> | FunctionPointer<Fn> | null;\n};\n\nexport type DeeplyResolvedDeepFunctionPointers<Pointers extends DeepFunctionPointers> = {\n [K in keyof Pointers]: Pointers[K] extends FunctionPointer\n ? Awaited<FunctionPointerOutput<Pointers[K]>>\n : Pointers[K] extends DeepFunctionPointers\n ? DeeplyResolvedDeepFunctionPointers<Pointers[K]>\n : Pointers[K] extends null\n ? null\n : never;\n};\n\nexport const deeplyResolveDeepFunctionPointers = async <\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n>(\n deepFunctionPointers: DeepFunctionPointers<Fn>,\n resolveFunctionPointer: (pointer: FunctionPointer<Fn>) => ReturnType<Fn>,\n) =>\n Object.fromEntries(\n await Promise.all(\n Object.entries(deepFunctionPointers).map(async ([k, v]): Promise<any> => {\n if (v === null) {\n return [k, v];\n }\n // this is kind of hacky but if this case occurs we have bigger problems\n if (isFunctionPointer(v)) {\n return [k, await resolveFunctionPointer(v as FunctionPointer<Fn>)];\n }\n\n return [\n k,\n await deeplyResolveDeepFunctionPointers(\n v as DeepFunctionPointers<Fn>,\n resolveFunctionPointer,\n ),\n ];\n }),\n ),\n ) as Promise<DeeplyResolvedDeepFunctionPointers<DeepFunctionPointers<Fn>>>;\n"]}
package/dist/index.d.ts CHANGED
@@ -2,28 +2,34 @@ import type { SubtractTuple } from '@layerzerolabs/typescript-utils';
2
2
  import { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';
3
3
  declare const fpSym: unique symbol;
4
4
  declare const dimSym: unique symbol;
5
- /**
6
- * <!-- anchor:FunctionPointer -->
7
- */
8
- export type FunctionPointer<Input extends any[] = any[], Output extends Promise<any> = Promise<any>> = {
5
+ export type FunctionPointer<Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>> = {
9
6
  factoryName: string;
10
7
  dimKey: string;
11
8
  methodName: string;
12
9
  args: any[];
13
10
  } & {
14
- [fpSym]: (...args: Input) => Output;
11
+ [fpSym]: Fn;
15
12
  };
16
- export type DimensionlessFunctionPointer<Input extends any[] = any[], Output extends Promise<any> = Promise<any>, Dim = any> = {
13
+ export type DimensionlessFunctionPointer<Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>, Dim = any> = {
17
14
  factoryName: string;
18
15
  methodName: string;
19
16
  args: any[];
20
17
  } & {
21
- [fpSym]: (...args: Input) => Output;
18
+ [fpSym]: Fn;
22
19
  [dimSym]: Dim;
23
20
  };
24
- export type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> = Pointer extends FunctionPointer<infer M> ? M : Pointer extends DimensionlessFunctionPointer<infer M> ? M : never;
25
- export type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> = Pointer extends FunctionPointer<any, infer A> ? A : Pointer extends DimensionlessFunctionPointer<any, infer A> ? A : never;
26
- export declare const curryFunctionPointer: <const Pointer extends FunctionPointer>(pointer: Pointer) => <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) => FunctionPointer<SubtractTuple<FunctionPointerInput<Pointer>, Args>, FunctionPointerOutput<Pointer>>;
27
- export declare const curryDimensionlessFunctionPointer: <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) => <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) => DimensionlessFunctionPointer<SubtractTuple<FunctionPointerInput<Pointer>, Args>, FunctionPointerOutput<Pointer>>;
21
+ export type FunctionPointerUnderlying<Pointer extends FunctionPointer | DimensionlessFunctionPointer> = Pointer extends FunctionPointer<infer Fn> ? Fn : Pointer extends DimensionlessFunctionPointer<infer Fn> ? Fn : never;
22
+ export type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> = Parameters<FunctionPointerUnderlying<Pointer>>;
23
+ export type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> = ReturnType<FunctionPointerUnderlying<Pointer>>;
24
+ export declare const curryFunctionPointer: <const Pointer extends FunctionPointer>(pointer: Pointer) => <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) => FunctionPointer<(...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>) => FunctionPointerOutput<Pointer>>;
25
+ export declare const curryDimensionlessFunctionPointer: <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) => <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) => DimensionlessFunctionPointer<(...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>) => FunctionPointerOutput<Pointer>>;
26
+ export declare const isFunctionPointer: (o: any) => o is FunctionPointer;
27
+ export type DeepFunctionPointers<Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>> = {
28
+ [key: string]: DeepFunctionPointers<Fn> | FunctionPointer<Fn> | null;
29
+ };
30
+ export type DeeplyResolvedDeepFunctionPointers<Pointers extends DeepFunctionPointers> = {
31
+ [K in keyof Pointers]: Pointers[K] extends FunctionPointer ? Awaited<FunctionPointerOutput<Pointers[K]>> : Pointers[K] extends DeepFunctionPointers ? DeeplyResolvedDeepFunctionPointers<Pointers[K]> : Pointers[K] extends null ? null : never;
32
+ };
33
+ export declare const deeplyResolveDeepFunctionPointers: <Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>>(deepFunctionPointers: DeepFunctionPointers<Fn>, resolveFunctionPointer: (pointer: FunctionPointer<Fn>) => ReturnType<Fn>) => Promise<DeeplyResolvedDeepFunctionPointers<DeepFunctionPointers<Fn>>>;
28
34
  export {};
29
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,QAAA,MAAM,KAAK,eAAoB,CAAC;AAChC,QAAA,MAAM,MAAM,eAAqB,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,eAAe,CACvB,KAAK,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,EAC3B,MAAM,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAC1C;IACA,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
package/dist/index.js CHANGED
@@ -1,20 +1,39 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- var curryFunctionPointer = /* @__PURE__ */ __name((pointer) => (args) => ({
3
+ var curryFunctionPointer = /* @__PURE__ */ __name((pointer) => (...args) => ({
4
4
  ...pointer,
5
5
  args: [
6
6
  ...pointer.args,
7
7
  ...args
8
8
  ]
9
9
  }), "curryFunctionPointer");
10
- var curryDimensionlessFunctionPointer = /* @__PURE__ */ __name((pointer) => (args) => ({
10
+ var curryDimensionlessFunctionPointer = /* @__PURE__ */ __name((pointer) => (...args) => ({
11
11
  ...pointer,
12
12
  args: [
13
13
  ...pointer.args,
14
14
  ...args
15
15
  ]
16
16
  }), "curryDimensionlessFunctionPointer");
17
+ var isFunctionPointer = /* @__PURE__ */ __name((o) => o.args && o.dimKey && o.factoryName && o.methodName, "isFunctionPointer");
18
+ var deeplyResolveDeepFunctionPointers = /* @__PURE__ */ __name(async (deepFunctionPointers, resolveFunctionPointer) => Object.fromEntries(await Promise.all(Object.entries(deepFunctionPointers).map(async ([k, v]) => {
19
+ if (v === null) {
20
+ return [
21
+ k,
22
+ v
23
+ ];
24
+ }
25
+ if (isFunctionPointer(v)) {
26
+ return [
27
+ k,
28
+ await resolveFunctionPointer(v)
29
+ ];
30
+ }
31
+ return [
32
+ k,
33
+ await deeplyResolveDeepFunctionPointers(v, resolveFunctionPointer)
34
+ ];
35
+ }))), "deeplyResolveDeepFunctionPointers");
17
36
 
18
- export { curryDimensionlessFunctionPointer, curryFunctionPointer };
37
+ export { curryDimensionlessFunctionPointer, curryFunctionPointer, deeplyResolveDeepFunctionPointers, isFunctionPointer };
19
38
  //# sourceMappingURL=index.js.map
20
39
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["curryFunctionPointer","pointer","args","curryDimensionlessFunctionPointer"],"mappings":";;AAkDO,IAAMA,oBAAAA,mBACT,MAAA,CAAA,CAAwCC,OAAAA,KACxC,CAAqEC,IAAAA,MAChE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,sBAAA;AAUG,IAAMC,iCAAAA,mBACT,MAAA,CAAA,CAAqDF,OAAAA,KACrD,CAAqEC,IAAAA,MAChE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,mCAAA","file":"index.js","sourcesContent":["import type { SubtractTuple } from '@layerzerolabs/typescript-utils';\nimport { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';\n\nconst fpSym = Symbol('_fp_tag');\nconst dimSym = Symbol('_dim_tag');\n\n/**\n * <!-- anchor:FunctionPointer -->\n */\nexport type FunctionPointer<\n Input extends any[] = any[],\n Output extends Promise<any> = Promise<any>,\n> = {\n factoryName: string;\n dimKey: string;\n methodName: string;\n // an improper subset of the arguments expected by the method this points to\n args: any[];\n} & {\n // we do it this way to preserve contravariance of the input type\n [fpSym]: (...args: Input) => Output;\n};\n\nexport type DimensionlessFunctionPointer<\n Input extends any[] = any[],\n Output extends Promise<any> = Promise<any>,\n Dim = any,\n> = {\n factoryName: string;\n methodName: string;\n args: any[];\n} & {\n [fpSym]: (...args: Input) => Output;\n [dimSym]: Dim;\n};\n\nexport type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Pointer extends FunctionPointer<infer M>\n ? M\n : Pointer extends DimensionlessFunctionPointer<infer M>\n ? M\n : never;\n\nexport type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Pointer extends FunctionPointer<any, infer A>\n ? A\n : Pointer extends DimensionlessFunctionPointer<any, infer A>\n ? A\n : never;\n\nexport const curryFunctionPointer =\n <const Pointer extends FunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as FunctionPointer<\n SubtractTuple<FunctionPointerInput<Pointer>, Args>,\n FunctionPointerOutput<Pointer>\n >;\n\nexport const curryDimensionlessFunctionPointer =\n <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as DimensionlessFunctionPointer<\n SubtractTuple<FunctionPointerInput<Pointer>, Args>,\n FunctionPointerOutput<Pointer>\n >;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["curryFunctionPointer","pointer","args","curryDimensionlessFunctionPointer","isFunctionPointer","o","dimKey","factoryName","methodName","deeplyResolveDeepFunctionPointers","deepFunctionPointers","resolveFunctionPointer","Object","fromEntries","Promise","all","entries","map","k","v"],"mappings":";;AAgDO,IAAMA,oBAAAA,mBACT,MAAA,CAAA,CAAwCC,OAAAA,KACxC,CAAA,GAAwEC,IAAAA,MACnE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,sBAAA;AAWG,IAAMC,iCAAAA,mBACT,MAAA,CAAA,CAAqDF,OAAAA,KACrD,CAAA,GAAwEC,IAAAA,MACnE;EACG,GAAGD,OAAAA;EACHC,IAAAA,EAAM;OAAID,OAAAA,CAAQC,IAAAA;AAASA,IAAAA,GAAAA;;AAC/B,CAAA,CAAA,EALJ,mCAAA;AAWG,IAAME,iBAAAA,mBAAoB,MAAA,CAAA,CAACC,CAAAA,KAC9BA,CAAAA,CAAEH,IAAAA,IAAQG,EAAEC,MAAAA,IAAUD,CAAAA,CAAEE,WAAAA,IAAeF,CAAAA,CAAEG,UAAAA,EADZ,mBAAA;AAmB1B,IAAMC,oDAAoC,MAAA,CAAA,OAG7CC,oBAAAA,EACAC,2BAEAC,MAAAA,CAAOC,WAAAA,CACH,MAAMC,OAAAA,CAAQC,GAAAA,CACVH,MAAAA,CAAOI,OAAAA,CAAQN,oBAAAA,CAAAA,CAAsBO,GAAAA,CAAI,OAAO,CAACC,CAAAA,EAAGC,CAAAA,CAAAA,KAAE;AAClD,EAAA,IAAIA,MAAM,IAAA,EAAM;AACZ,IAAA,OAAO;AAACD,MAAAA,CAAAA;AAAGC,MAAAA;;AACf,EAAA;AAEA,EAAA,IAAIf,iBAAAA,CAAkBe,CAAAA,CAAAA,EAAI;AACtB,IAAA,OAAO;AAACD,MAAAA,CAAAA;AAAG,MAAA,MAAMP,uBAAuBQ,CAAAA;;AAC5C,EAAA;AAEA,EAAA,OAAO;AACHD,IAAAA,CAAAA;IACA,MAAMT,iCAAAA,CACFU,GACAR,sBAAAA;;AAGZ,CAAA,CAAA,CAAA,CAAA,EAxBqC,mCAAA","file":"index.js","sourcesContent":["import type { SubtractTuple } from '@layerzerolabs/typescript-utils';\nimport { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';\n\nconst fpSym = Symbol('_fp_tag');\nconst dimSym = Symbol('_dim_tag');\n\nexport type FunctionPointer<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n> = {\n factoryName: string;\n dimKey: string;\n methodName: string;\n // an improper subset of the arguments expected by the method this points to\n args: any[];\n} & {\n // we do it this way to preserve contravariance of the input type\n // AND to brand the pointer\n [fpSym]: Fn;\n};\n\nexport type DimensionlessFunctionPointer<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n Dim = any,\n> = {\n factoryName: string;\n methodName: string;\n args: any[];\n} & {\n [fpSym]: Fn;\n [dimSym]: Dim;\n};\n\nexport type FunctionPointerUnderlying<\n Pointer extends FunctionPointer | DimensionlessFunctionPointer,\n> =\n Pointer extends FunctionPointer<infer Fn>\n ? Fn\n : Pointer extends DimensionlessFunctionPointer<infer Fn>\n ? Fn\n : never;\n\nexport type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n Parameters<FunctionPointerUnderlying<Pointer>>;\n\nexport type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =\n ReturnType<FunctionPointerUnderlying<Pointer>>;\n\n// Does not and cannot preserve generic functions\nexport const curryFunctionPointer =\n <const Pointer extends FunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as FunctionPointer<\n (\n ...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>\n ) => FunctionPointerOutput<Pointer>\n >;\n\nexport const curryDimensionlessFunctionPointer =\n <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) =>\n <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(...args: Args) =>\n ({\n ...pointer,\n args: [...pointer.args, ...args],\n }) as unknown as DimensionlessFunctionPointer<\n (\n ...args: SubtractTuple<FunctionPointerInput<Pointer>, Args>\n ) => FunctionPointerOutput<Pointer>\n >;\n\nexport const isFunctionPointer = (o: any): o is FunctionPointer =>\n o.args && o.dimKey && o.factoryName && o.methodName;\n\nexport type DeepFunctionPointers<\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n> = {\n [key: string]: DeepFunctionPointers<Fn> | FunctionPointer<Fn> | null;\n};\n\nexport type DeeplyResolvedDeepFunctionPointers<Pointers extends DeepFunctionPointers> = {\n [K in keyof Pointers]: Pointers[K] extends FunctionPointer\n ? Awaited<FunctionPointerOutput<Pointers[K]>>\n : Pointers[K] extends DeepFunctionPointers\n ? DeeplyResolvedDeepFunctionPointers<Pointers[K]>\n : Pointers[K] extends null\n ? null\n : never;\n};\n\nexport const deeplyResolveDeepFunctionPointers = async <\n Fn extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<any>,\n>(\n deepFunctionPointers: DeepFunctionPointers<Fn>,\n resolveFunctionPointer: (pointer: FunctionPointer<Fn>) => ReturnType<Fn>,\n) =>\n Object.fromEntries(\n await Promise.all(\n Object.entries(deepFunctionPointers).map(async ([k, v]): Promise<any> => {\n if (v === null) {\n return [k, v];\n }\n // this is kind of hacky but if this case occurs we have bigger problems\n if (isFunctionPointer(v)) {\n return [k, await resolveFunctionPointer(v as FunctionPointer<Fn>)];\n }\n\n return [\n k,\n await deeplyResolveDeepFunctionPointers(\n v as DeepFunctionPointers<Fn>,\n resolveFunctionPointer,\n ),\n ];\n }),\n ),\n ) as Promise<DeeplyResolvedDeepFunctionPointers<DeepFunctionPointers<Fn>>>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/function-pointer",
3
- "version": "0.2.68",
3
+ "version": "0.2.70",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,14 +13,17 @@
13
13
  "main": "./dist/index.cjs",
14
14
  "module": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist/**/*"
18
+ ],
16
19
  "dependencies": {
17
- "@layerzerolabs/typescript-utils": "0.2.68"
20
+ "@layerzerolabs/typescript-utils": "0.2.70"
18
21
  },
19
22
  "devDependencies": {
20
23
  "tsup": "^8.4.0",
21
24
  "vitest": "^3.2.3",
22
- "@layerzerolabs/tsup-configuration": "0.2.68",
23
- "@layerzerolabs/typescript-configuration": "0.2.68"
25
+ "@layerzerolabs/tsup-configuration": "0.2.70",
26
+ "@layerzerolabs/typescript-configuration": "0.2.70"
24
27
  },
25
28
  "publishConfig": {
26
29
  "access": "public",
@@ -1,19 +0,0 @@
1
-  WARN  Issue while reading "/home/runner/work/monorepo-internal/monorepo-internal/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
2
-
3
- > @layerzerolabs/function-pointer@0.0.0 build /home/runner/work/monorepo-internal/monorepo-internal/packages/framework/definitions/function-pointer
4
- > tsup
5
-
6
- CLI Building entry: src/index.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.1
9
- CLI Using tsup config: /home/runner/work/monorepo-internal/monorepo-internal/packages/framework/definitions/function-pointer/tsup.config.ts
10
- CLI Target: ES2023
11
- CLI Cleaning output folder
12
- CJS Build start
13
- ESM Build start
14
- CJS dist/index.cjs 704.00 B
15
- CJS dist/index.cjs.map 2.90 KB
16
- CJS ⚡️ Build success in 101ms
17
- ESM dist/index.js 623.00 B
18
- ESM dist/index.js.map 2.90 KB
19
- ESM ⚡️ Build success in 100ms
@@ -1,8 +0,0 @@
1
-
2
- > @layerzerolabs/function-pointer@0.0.0 lint /home/runner/work/monorepo-internal/monorepo-internal/packages/framework/definitions/function-pointer
3
- > eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)
4
-
5
- (node:72533) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/monorepo-internal/monorepo-internal/eslint.config.js?mtime=1775694520701 is not specified and it doesn't parse as CommonJS.
6
- Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
7
- To eliminate this warning, add "type": "module" to /home/runner/work/monorepo-internal/monorepo-internal/package.json.
8
- (Use `node --trace-warnings ...` to show where the warning was created)
@@ -1,16 +0,0 @@
1
-
2
- > @layerzerolabs/function-pointer@0.0.0 test /home/runner/work/monorepo-internal/monorepo-internal/packages/framework/definitions/function-pointer
3
- > vitest --run --pass-with-no-tests --typecheck
4
-
5
- Testing types with tsc and vue-tsc is an experimental feature.
6
- Breaking changes might not follow SemVer, please pin Vitest's version when using it.
7
-
8
-  RUN  v3.2.4 /home/runner/work/monorepo-internal/monorepo-internal/packages/framework/definitions/function-pointer
9
-
10
- No test files found, exiting with code 0
11
-
12
- include: **/*.{test,spec}.?(c|m)[jt]s?(x)
13
- exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
14
- typecheck include: **/*.{test,spec}-d.?(c|m)[jt]s?(x)
15
- typecheck exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
16
-
package/src/index.ts DELETED
@@ -1,71 +0,0 @@
1
- import type { SubtractTuple } from '@layerzerolabs/typescript-utils';
2
- import { type TuplePrefixUnion } from '@layerzerolabs/typescript-utils';
3
-
4
- const fpSym = Symbol('_fp_tag');
5
- const dimSym = Symbol('_dim_tag');
6
-
7
- /**
8
- * <!-- anchor:FunctionPointer -->
9
- */
10
- export type FunctionPointer<
11
- Input extends any[] = any[],
12
- Output extends Promise<any> = Promise<any>,
13
- > = {
14
- factoryName: string;
15
- dimKey: string;
16
- methodName: string;
17
- // an improper subset of the arguments expected by the method this points to
18
- args: any[];
19
- } & {
20
- // we do it this way to preserve contravariance of the input type
21
- [fpSym]: (...args: Input) => Output;
22
- };
23
-
24
- export type DimensionlessFunctionPointer<
25
- Input extends any[] = any[],
26
- Output extends Promise<any> = Promise<any>,
27
- Dim = any,
28
- > = {
29
- factoryName: string;
30
- methodName: string;
31
- args: any[];
32
- } & {
33
- [fpSym]: (...args: Input) => Output;
34
- [dimSym]: Dim;
35
- };
36
-
37
- export type FunctionPointerInput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =
38
- Pointer extends FunctionPointer<infer M>
39
- ? M
40
- : Pointer extends DimensionlessFunctionPointer<infer M>
41
- ? M
42
- : never;
43
-
44
- export type FunctionPointerOutput<Pointer extends FunctionPointer | DimensionlessFunctionPointer> =
45
- Pointer extends FunctionPointer<any, infer A>
46
- ? A
47
- : Pointer extends DimensionlessFunctionPointer<any, infer A>
48
- ? A
49
- : never;
50
-
51
- export const curryFunctionPointer =
52
- <const Pointer extends FunctionPointer>(pointer: Pointer) =>
53
- <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>
54
- ({
55
- ...pointer,
56
- args: [...pointer.args, ...args],
57
- }) as unknown as FunctionPointer<
58
- SubtractTuple<FunctionPointerInput<Pointer>, Args>,
59
- FunctionPointerOutput<Pointer>
60
- >;
61
-
62
- export const curryDimensionlessFunctionPointer =
63
- <const Pointer extends DimensionlessFunctionPointer>(pointer: Pointer) =>
64
- <const Args extends TuplePrefixUnion<FunctionPointerInput<Pointer>>>(args: Args) =>
65
- ({
66
- ...pointer,
67
- args: [...pointer.args, ...args],
68
- }) as unknown as DimensionlessFunctionPointer<
69
- SubtractTuple<FunctionPointerInput<Pointer>, Args>,
70
- FunctionPointerOutput<Pointer>
71
- >;
package/tsconfig.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "@layerzerolabs/typescript-configuration/tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "./dist",
6
- "strictPropertyInitialization": false,
7
- "noUnusedLocals": false,
8
- "noUnusedParameters": false,
9
- "jsx": "react-jsx"
10
- },
11
- "exclude": [
12
- "node_modules",
13
- "**/__mocks__/*",
14
- "**/__tests__/*",
15
- "**/*.spec.ts",
16
- "**/*.test.ts",
17
- "dist"
18
- ],
19
- "include": ["src/**/*"]
20
- }
package/tsup.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- import { createPackageTsupConfig } from '@layerzerolabs/tsup-configuration';
4
-
5
- export default defineConfig(({ watch }) => ({
6
- ...createPackageTsupConfig(),
7
- clean: !watch,
8
- }));