@junobuild/functions-tools 0.5.1 → 0.5.2

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.
@@ -1,4 +1,4 @@
1
- export declare const jsTemplateImports = "import {idlFactory} from './satellite.factory.did.js';\nimport {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';\nimport {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';\nimport {j} from '@junobuild/schema';";
1
+ export declare const jsTemplateImports = "// @ts-expect-error - generated JS file without type declarations\nimport {idlFactory} from './satellite.factory.did.js';\nimport {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';\nimport {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';\nimport {j} from '@junobuild/schema';";
2
2
  export declare const jsTemplateWithArgsWithResult = "\n%ARGS_ZOD%\n%RESULT_ZOD%\n\nconst %JS_FUNCTION% = async (args) => {\n\tconst parsedArgs = %ARGS_SCHEMA%.parse(args);\n\tconst idlArgs = schemaToIdl({schema: %ARGS_SCHEMA%, value: parsedArgs});\n\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor({idlFactory});\n\tconst idlResult = await %RS_FUNCTION%(idlArgs);\n\n\tconst result = schemaFromIdl({schema: %RESULT_SCHEMA%, value: idlResult});\n\treturn %RESULT_SCHEMA%.parse(result);\n};";
3
3
  export declare const jsTemplateWithArgsNoResult = "\n%ARGS_ZOD%\n\nconst %JS_FUNCTION% = async (args) => {\n\tconst parsedArgs = %ARGS_SCHEMA%.parse(args);\n\tconst idlArgs = schemaToIdl({schema: %ARGS_SCHEMA%, value: parsedArgs});\n\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor({idlFactory});\n\tawait %RS_FUNCTION%(idlArgs);\n};";
4
4
  export declare const jsTemplateNoArgsWithResult = "\n%RESULT_ZOD%\n\nconst %JS_FUNCTION% = async () => {\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor({idlFactory});\n\tconst idlResult = await %RS_FUNCTION%();\n\n\tconst result = schemaFromIdl({schema: %RESULT_SCHEMA%, value: idlResult});\n\treturn %RESULT_SCHEMA%.parse(result);\n};";
@@ -1,4 +1,4 @@
1
- export declare const tsTemplateImports = "import type {_SERVICE as SatelliteActor} from './satellite.did';\nimport {idlFactory} from './satellite.factory.did.js';\nimport {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';\nimport {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';\nimport {j} from '@junobuild/schema';";
1
+ export declare const tsTemplateImports = "import type {_SERVICE as SatelliteActor} from './satellite.did';\n// @ts-expect-error - generated JS file without type declarations\nimport {idlFactory} from './satellite.factory.did.js';\nimport {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';\nimport {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';\nimport {j} from '@junobuild/schema';";
2
2
  export declare const tsTemplateWithArgsWithResult = "\n%ARGS_ZOD%\n%RESULT_ZOD%\n\nconst %JS_FUNCTION% = async (args: j.infer<typeof %ARGS_SCHEMA%>): Promise<j.infer<typeof %RESULT_SCHEMA%>> => {\n\tconst parsedArgs = %ARGS_SCHEMA%.parse(args);\n\tconst idlArgs = schemaToIdl({schema: %ARGS_SCHEMA%, value: parsedArgs}) as Parameters<SatelliteActor['%RS_FUNCTION%']>[0];\n\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor<SatelliteActor>({idlFactory});\n\tconst idlResult = await %RS_FUNCTION%(idlArgs);\n\n\tconst result = schemaFromIdl({schema: %RESULT_SCHEMA%, value: idlResult});\n\treturn %RESULT_SCHEMA%.parse(result);\n};";
3
3
  export declare const tsTemplateWithArgsNoResult = "\n%ARGS_ZOD%\n\nconst %JS_FUNCTION% = async (args: j.infer<typeof %ARGS_SCHEMA%>): Promise<void> => {\n\tconst parsedArgs = %ARGS_SCHEMA%.parse(args);\n\tconst idlArgs = schemaToIdl({schema: %ARGS_SCHEMA%, value: parsedArgs}) as Parameters<SatelliteActor['%RS_FUNCTION%']>[0];\n\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor<SatelliteActor>({idlFactory});\n\tawait %RS_FUNCTION%(idlArgs);\n};";
4
4
  export declare const tsTemplateNoArgsWithResult = "\n%RESULT_ZOD%\n\nconst %JS_FUNCTION% = async (): Promise<j.infer<typeof %RESULT_SCHEMA%>> => {\n\tconst {%RS_FUNCTION%} = await getSatelliteExtendedActor<SatelliteActor>({idlFactory});\n\tconst idlResult = await %RS_FUNCTION%();\n\n\tconst result = schemaFromIdl({schema: %RESULT_SCHEMA%, value: idlResult});\n\treturn %RESULT_SCHEMA%.parse(result);\n};";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/functions-tools",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Tools for generating Juno serverless functions code.",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",