diff --git a/src/components/CodeEditor/rowy.d.ts b/src/components/CodeEditor/rowy.d.ts new file mode 100644 index 00000000..35511fb4 --- /dev/null +++ b/src/components/CodeEditor/rowy.d.ts @@ -0,0 +1,23 @@ +/** + * utility functions + */ +declare namespace rowy { + /** + * uploads a file to the cloud storage from a url + */ + function url2storage( + url: string, + storagePath: string, + fileName?: string + ): Promise<{ + downloadURL: string; + name: string; + type: string; + lastModifiedTS: Date; + }>; + + /** + * Gets the secret defined in Google Cloud Secret + */ + async function getSecret(name: string, v?: string): Promise; +} diff --git a/src/components/CodeEditor/useMonacoCustomizations.ts b/src/components/CodeEditor/useMonacoCustomizations.ts index 74931c6c..d33c7277 100644 --- a/src/components/CodeEditor/useMonacoCustomizations.ts +++ b/src/components/CodeEditor/useMonacoCustomizations.ts @@ -16,6 +16,7 @@ import firestoreDefs from "!!raw-loader!./firestore.d.ts"; import firebaseAuthDefs from "!!raw-loader!./firebaseAuth.d.ts"; import firebaseStorageDefs from "!!raw-loader!./firebaseStorage.d.ts"; import utilsDefs from "!!raw-loader!./utils.d.ts"; +import rowyUtilsDefs from "!!raw-loader!./rowy.d.ts"; import extensionsDefs from "!!raw-loader!./extensions.d.ts"; export interface IUseMonacoCustomizationsProps { @@ -96,6 +97,7 @@ export default function useMonacoCustomizations({ utilsDefs, "ts:filename/utils.d.ts" ); + monaco.languages.typescript.javascriptDefaults.addExtraLib(rowyUtilsDefs); } catch (error) { console.error( "An error occurred during initialization of Monaco: ",