MCPcopy Create free account
hub / github.com/firebase/firebase-tools / verbFactory

Method verbFactory

src/localFunction.ts:68–88  ·  view source on GitHub ↗
(
      hasRequestBody: boolean,
      method: (
        path: string,
        bodyOrOpts?: any,
        opts?: ClientVerbOptions,
      ) => Promise<ClientResponse<any>>,
    )

Source from the content-addressed store, hash-verified

66 const callClient = new Client({ urlPrefix: this.url, auth: false });
67 type verbFn = (...args: any) => Promise<string>;
68 const verbFactory = (
69 hasRequestBody: boolean,
70 method: (
71 path: string,
72 bodyOrOpts?: any,
73 opts?: ClientVerbOptions,
74 ) => Promise<ClientResponse<any>>,
75 ): verbFn => {
76 return async (pathOrOptions?: string | HttpsOptions, options?: HttpsOptions) => {
77 const { path, opts } = this.extractArgs(pathOrOptions, options);
78 try {
79 const res = hasRequestBody
80 ? await method(path, opts.body, toClientVerbOptions(opts))
81 : await method(path, toClientVerbOptions(opts));
82 this.requestCallBack(undefined, res, res.body);
83 } catch (err) {
84 this.requestCallBack(err);
85 }
86 return HTTPS_SENTINEL;
87 };
88 };
89
90 const shim = verbFactory(true, (path: string, json?: any, opts?: ClientVerbOptions) => {
91 const req = Object.assign(opts || {}, {

Callers

nothing calls this directly

Calls 3

extractArgsMethod · 0.95
requestCallBackMethod · 0.95
toClientVerbOptionsFunction · 0.85

Tested by

no test coverage detected