@aloma.io/integration-sdk 3.7.33 → 3.7.35
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.
| 
         @@ -10,6 +10,7 @@ declare class OAuthFetcher extends Fetcher { 
     | 
|
| 
       10 
10 
     | 
    
         
             
                    onResponse: any;
         
     | 
| 
       11 
11 
     | 
    
         
             
                    customize: any;
         
     | 
| 
       12 
12 
     | 
    
         
             
                });
         
     | 
| 
      
 13 
     | 
    
         
            +
                __healthCheck(): Promise<void>;
         
     | 
| 
       13 
14 
     | 
    
         
             
                getToken(force: any): Promise<any>;
         
     | 
| 
       14 
15 
     | 
    
         
             
                onError(e: any, url: any, options: any, retries: any, args: any, rateLimit: any): Promise<unknown>;
         
     | 
| 
       15 
16 
     | 
    
         
             
                periodicRefresh(): Promise<void>;
         
     | 
| 
         @@ -7,6 +7,10 @@ class OAuthFetcher extends Fetcher { 
     | 
|
| 
       7 
7 
     | 
    
         
             
                    this.oauth = oauth;
         
     | 
| 
       8 
8 
     | 
    
         
             
                    this._getToken = getToken;
         
     | 
| 
       9 
9 
     | 
    
         
             
                }
         
     | 
| 
      
 10 
     | 
    
         
            +
                async __healthCheck() {
         
     | 
| 
      
 11 
     | 
    
         
            +
                    if (!this.oauth.accessToken())
         
     | 
| 
      
 12 
     | 
    
         
            +
                        throw new Error('no access token');
         
     | 
| 
      
 13 
     | 
    
         
            +
                }
         
     | 
| 
       10 
14 
     | 
    
         
             
                async getToken(force) {
         
     | 
| 
       11 
15 
     | 
    
         
             
                    var local = this, oauth = local.oauth;
         
     | 
| 
       12 
16 
     | 
    
         
             
                    if (local._getToken)
         
     | 
    
        package/build/internal/index.mjs
    CHANGED
    
    | 
         @@ -336,6 +336,7 @@ ${text} 
     | 
|
| 
       336 
336 
     | 
    
         
             
                                        transport.send(packet);
         
     | 
| 
       337 
337 
     | 
    
         
             
                                    });
         
     | 
| 
       338 
338 
     | 
    
         
             
                                };
         
     | 
| 
      
 339 
     | 
    
         
            +
                                let oauthClient;
         
     | 
| 
       339 
340 
     | 
    
         
             
                                start({
         
     | 
| 
       340 
341 
     | 
    
         
             
                                    config: decrypted,
         
     | 
| 
       341 
342 
     | 
    
         
             
                                    oauth: theOAuth,
         
     | 
| 
         @@ -345,6 +346,9 @@ ${text} 
     | 
|
| 
       345 
346 
     | 
    
         
             
                                    healthCheck: async (controller) => {
         
     | 
| 
       346 
347 
     | 
    
         
             
                                        let result = { ok: true, error: null };
         
     | 
| 
       347 
348 
     | 
    
         
             
                                        try {
         
     | 
| 
      
 349 
     | 
    
         
            +
                                            if (oauthClient) {
         
     | 
| 
      
 350 
     | 
    
         
            +
                                                await oauthClient.__healthCheck();
         
     | 
| 
      
 351 
     | 
    
         
            +
                                            }
         
     | 
| 
       348 
352 
     | 
    
         
             
                                            await controller.__healthCheck();
         
     | 
| 
       349 
353 
     | 
    
         
             
                                        }
         
     | 
| 
       350 
354 
     | 
    
         
             
                                        catch (e) {
         
     | 
| 
         @@ -356,7 +360,7 @@ ${text} 
     | 
|
| 
       356 
360 
     | 
    
         
             
                                        packet.args(result);
         
     | 
| 
       357 
361 
     | 
    
         
             
                                        transport.send(packet);
         
     | 
| 
       358 
362 
     | 
    
         
             
                                    },
         
     | 
| 
       359 
     | 
    
         
            -
                                    getClient: (arg) => theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
         
     | 
| 
      
 363 
     | 
    
         
            +
                                    getClient: (arg) => theOAuth ? (oauthClient = theOAuth.getClient(arg)) : new Fetcher(arg),
         
     | 
| 
       360 
364 
     | 
    
         
             
                                    newTask: (name, data) => {
         
     | 
| 
       361 
365 
     | 
    
         
             
                                        return new Promise((resolve, reject) => {
         
     | 
| 
       362 
366 
     | 
    
         
             
                                            const packet = transport.newPacket({}, (ret) => (ret?.error ? reject(ret.error) : resolve(ret)), `_req-${cuid()}`);
         
     | 
    
        package/package.json
    CHANGED
    
    
    
        package/src/internal/index.mts
    CHANGED
    
    | 
         @@ -426,6 +426,8 @@ ${text} 
     | 
|
| 
       426 
426 
     | 
    
         
             
                        });
         
     | 
| 
       427 
427 
     | 
    
         
             
                      };
         
     | 
| 
       428 
428 
     | 
    
         | 
| 
      
 429 
     | 
    
         
            +
                      let oauthClient;
         
     | 
| 
      
 430 
     | 
    
         
            +
             
     | 
| 
       429 
431 
     | 
    
         
             
                      start({
         
     | 
| 
       430 
432 
     | 
    
         
             
                        config: decrypted,
         
     | 
| 
       431 
433 
     | 
    
         
             
                        oauth: theOAuth,
         
     | 
| 
         @@ -436,6 +438,10 @@ ${text} 
     | 
|
| 
       436 
438 
     | 
    
         
             
                          let result: any = { ok: true, error: null };
         
     | 
| 
       437 
439 
     | 
    
         | 
| 
       438 
440 
     | 
    
         
             
                          try {
         
     | 
| 
      
 441 
     | 
    
         
            +
                            if (oauthClient) {
         
     | 
| 
      
 442 
     | 
    
         
            +
                              await oauthClient.__healthCheck();
         
     | 
| 
      
 443 
     | 
    
         
            +
                            }
         
     | 
| 
      
 444 
     | 
    
         
            +
                            
         
     | 
| 
       439 
445 
     | 
    
         
             
                            await controller.__healthCheck();
         
     | 
| 
       440 
446 
     | 
    
         
             
                          } catch (e: any) {
         
     | 
| 
       441 
447 
     | 
    
         
             
                            result.ok = false;
         
     | 
| 
         @@ -450,7 +456,7 @@ ${text} 
     | 
|
| 
       450 
456 
     | 
    
         
             
                          transport.send(packet);
         
     | 
| 
       451 
457 
     | 
    
         
             
                        },
         
     | 
| 
       452 
458 
     | 
    
         
             
                        getClient: (arg) =>
         
     | 
| 
       453 
     | 
    
         
            -
                          theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
         
     | 
| 
      
 459 
     | 
    
         
            +
                          theOAuth ? (oauthClient = theOAuth.getClient(arg)) : new Fetcher(arg),
         
     | 
| 
       454 
460 
     | 
    
         
             
                        newTask: (name, data) => {
         
     | 
| 
       455 
461 
     | 
    
         
             
                          return new Promise((resolve, reject) => {
         
     | 
| 
       456 
462 
     | 
    
         
             
                            const packet = transport.newPacket(
         
     |