@aloma.io/integration-sdk 3.8.10 → 3.8.12
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/.prettierrc.cjs +8 -0
 - package/build/builder/index.d.mts +7 -11
 - package/build/builder/index.mjs +14 -15
 - package/build/builder/runtime-context.d.mts +1 -1
 - package/build/builder/runtime-context.mjs +11 -16
 - package/build/cli.mjs +38 -38
 - package/build/controller/index.d.mts +58 -2
 - package/build/controller/index.mjs +68 -11
 - package/build/index.d.mts +2 -2
 - package/build/index.mjs +2 -2
 - package/build/internal/connector/config.d.mts +2 -2
 - package/build/internal/connector/config.mjs +10 -10
 - package/build/internal/connector/index.d.mts +2 -2
 - package/build/internal/connector/index.mjs +4 -4
 - package/build/internal/connector/metrics.mjs +6 -6
 - package/build/internal/connector/server/index.d.mts +3 -3
 - package/build/internal/connector/server/index.mjs +7 -7
 - package/build/internal/connector/server/on-connect/decrypt-config.mjs +3 -3
 - package/build/internal/connector/server/on-connect/finish-oauth.d.mts +3 -3
 - package/build/internal/connector/server/on-connect/finish-oauth.mjs +17 -23
 - package/build/internal/connector/server/on-connect/index.d.mts +2 -2
 - package/build/internal/connector/server/on-connect/index.mjs +13 -13
 - package/build/internal/connector/server/on-connect/make-oauth.d.mts +3 -3
 - package/build/internal/connector/server/on-connect/make-oauth.mjs +17 -25
 - package/build/internal/connector/server/on-connect/start-oauth.mjs +6 -13
 - package/build/internal/connector/server/on-message.mjs +1 -1
 - package/build/internal/dispatcher/index.mjs +34 -45
 - package/build/internal/fetcher/fetcher.d.mts +1 -1
 - package/build/internal/fetcher/fetcher.mjs +11 -15
 - package/build/internal/fetcher/oauth-fetcher.d.mts +1 -1
 - package/build/internal/fetcher/oauth-fetcher.mjs +7 -7
 - package/build/internal/index.d.mts +1 -1
 - package/build/internal/index.mjs +1 -1
 - package/build/internal/util/index.mjs +5 -5
 - package/build/internal/util/jwe/cli.mjs +3 -3
 - package/build/internal/util/jwe/index.d.mts +1 -1
 - package/build/internal/util/jwe/index.mjs +10 -10
 - package/build/internal/websocket/config.d.mts +1 -1
 - package/build/internal/websocket/config.mjs +7 -7
 - package/build/internal/websocket/connection/constants.mjs +3 -3
 - package/build/internal/websocket/connection/index.mjs +8 -8
 - package/build/internal/websocket/connection/registration.mjs +6 -6
 - package/build/internal/websocket/index.d.mts +2 -2
 - package/build/internal/websocket/index.mjs +3 -3
 - package/build/internal/websocket/transport/durable.mjs +6 -6
 - package/build/internal/websocket/transport/index.d.mts +2 -2
 - package/build/internal/websocket/transport/index.mjs +19 -19
 - package/build/internal/websocket/transport/packet.mjs +1 -1
 - package/build/internal/websocket/transport/processor.mjs +5 -5
 - package/build/transform/index.mjs +26 -26
 - package/package.json +1 -1
 - package/src/builder/index.mts +66 -66
 - package/src/builder/runtime-context.mts +17 -43
 - package/src/cli.mts +48 -53
 - package/src/controller/index.mts +72 -12
 - package/src/index.mts +2 -2
 - package/src/internal/connector/config.mts +11 -19
 - package/src/internal/connector/index.mts +8 -9
 - package/src/internal/connector/metrics.mts +7 -7
 - package/src/internal/connector/server/index.mts +10 -10
 - package/src/internal/connector/server/on-connect/decrypt-config.mts +4 -4
 - package/src/internal/connector/server/on-connect/finish-oauth.mts +22 -35
 - package/src/internal/connector/server/on-connect/index.mts +27 -27
 - package/src/internal/connector/server/on-connect/make-oauth.mts +22 -33
 - package/src/internal/connector/server/on-connect/start-oauth.mts +7 -16
 - package/src/internal/connector/server/on-message.mts +1 -1
 - package/src/internal/dispatcher/index.mts +49 -70
 - package/src/internal/fetcher/fetcher.mts +44 -49
 - package/src/internal/fetcher/oauth-fetcher.mts +12 -13
 - package/src/internal/index.mts +2 -2
 - package/src/internal/util/index.mts +8 -11
 - package/src/internal/util/jwe/cli.mts +3 -3
 - package/src/internal/util/jwe/index.mts +17 -21
 - package/src/internal/websocket/config.mjs +8 -12
 - package/src/internal/websocket/connection/constants.mjs +3 -3
 - package/src/internal/websocket/connection/index.mjs +14 -14
 - package/src/internal/websocket/connection/registration.mjs +10 -10
 - package/src/internal/websocket/index.mjs +6 -6
 - package/src/internal/websocket/transport/durable.mjs +9 -9
 - package/src/internal/websocket/transport/index.mjs +28 -32
 - package/src/internal/websocket/transport/packet.mjs +4 -4
 - package/src/internal/websocket/transport/processor.mjs +9 -12
 - package/src/transform/index.mts +28 -41
 
    
        package/src/transform/index.mts
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { 
     | 
| 
      
 1 
     | 
    
         
            +
            import {parseFromFiles} from '@ts-ast-parser/core';
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            const transform = (meta: any) => {
         
     | 
| 
       4 
     | 
    
         
            -
              if (!meta?.length) throw new Error( 
     | 
| 
      
 4 
     | 
    
         
            +
              if (!meta?.length) throw new Error('metadata is empty');
         
     | 
| 
       5 
5 
     | 
    
         
             
              meta = meta[0];
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              if (meta.getDeclarations()?.length !== 1) {
         
     | 
| 
       8 
     | 
    
         
            -
                throw new Error( 
     | 
| 
      
 8 
     | 
    
         
            +
                throw new Error('connector file needs to export default class');
         
     | 
| 
       9 
9 
     | 
    
         
             
              }
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              const methods = {};
         
     | 
| 
         @@ -15,9 +15,9 @@ const transform = (meta: any) => { 
     | 
|
| 
       15 
15 
     | 
    
         
             
                return !(
         
     | 
| 
       16 
16 
     | 
    
         
             
                  member.isStatic() ||
         
     | 
| 
       17 
17 
     | 
    
         
             
                  member.isInherited() ||
         
     | 
| 
       18 
     | 
    
         
            -
                  member.getKind() !==  
     | 
| 
       19 
     | 
    
         
            -
                  member.getModifier() !==  
     | 
| 
       20 
     | 
    
         
            -
                  member.getName().startsWith( 
     | 
| 
      
 18 
     | 
    
         
            +
                  member.getKind() !== 'Method' ||
         
     | 
| 
      
 19 
     | 
    
         
            +
                  member.getModifier() !== 'public' ||
         
     | 
| 
      
 20 
     | 
    
         
            +
                  member.getName().startsWith('_')
         
     | 
| 
       21 
21 
     | 
    
         
             
                );
         
     | 
| 
       22 
22 
     | 
    
         
             
              });
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
         @@ -29,27 +29,21 @@ const transform = (meta: any) => { 
     | 
|
| 
       29 
29 
     | 
    
         
             
                    .getSignatures()
         
     | 
| 
       30 
30 
     | 
    
         
             
                    .map((sig: any) => {
         
     | 
| 
       31 
31 
     | 
    
         
             
                      const docs = sig.getJSDoc().serialize() || [];
         
     | 
| 
       32 
     | 
    
         
            -
                      const desc = docs.find(
         
     | 
| 
       33 
     | 
    
         
            -
                        (what: any) => what.kind === "description",
         
     | 
| 
       34 
     | 
    
         
            -
                      )?.value;
         
     | 
| 
      
 32 
     | 
    
         
            +
                      const desc = docs.find((what: any) => what.kind === 'description')?.value;
         
     | 
| 
       35 
33 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                      const example = docs.find(
         
     | 
| 
       37 
     | 
    
         
            -
                        (what: any) => what.kind === "example",
         
     | 
| 
       38 
     | 
    
         
            -
                      )?.value;
         
     | 
| 
      
 34 
     | 
    
         
            +
                      const example = docs.find((what: any) => what.kind === 'example')?.value;
         
     | 
| 
       39 
35 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                      const ns = docs.find((what: any) => what.kind ===  
     | 
| 
       41 
     | 
    
         
            -
                      let space = ns ? `@namespace ${ns}` :  
     | 
| 
      
 36 
     | 
    
         
            +
                      const ns = docs.find((what: any) => what.kind === 'namespace')?.value;
         
     | 
| 
      
 37 
     | 
    
         
            +
                      let space = ns ? `@namespace ${ns}` : '';
         
     | 
| 
       42 
38 
     | 
    
         | 
| 
       43 
39 
     | 
    
         
             
                      let eg;
         
     | 
| 
       44 
40 
     | 
    
         
             
                      if (example) {
         
     | 
| 
       45 
41 
     | 
    
         
             
                        const parts = example.split(/```/);
         
     | 
| 
       46 
     | 
    
         
            -
                        const backticks =  
     | 
| 
       47 
     | 
    
         
            -
                        eg = `@example ${parts[0] ||  
     | 
| 
       48 
     | 
    
         
            -
                          parts[1]
         
     | 
| 
       49 
     | 
    
         
            -
                        }${backticks}`;
         
     | 
| 
      
 42 
     | 
    
         
            +
                        const backticks = '```';
         
     | 
| 
      
 43 
     | 
    
         
            +
                        eg = `@example ${parts[0] || 'usage'}\n${backticks}${parts[1]}${backticks}`;
         
     | 
| 
       50 
44 
     | 
    
         
             
                      }
         
     | 
| 
       51 
45 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                      const paramDocs = docs.filter((what: any) => what.kind ===  
     | 
| 
      
 46 
     | 
    
         
            +
                      const paramDocs = docs.filter((what: any) => what.kind === 'param');
         
     | 
| 
       53 
47 
     | 
    
         | 
| 
       54 
48 
     | 
    
         
             
                      const params = sig
         
     | 
| 
       55 
49 
     | 
    
         
             
                        .getParameters()
         
     | 
| 
         @@ -60,56 +54,49 @@ const transform = (meta: any) => { 
     | 
|
| 
       60 
54 
     | 
    
         
             
                          const prefix = param
         
     | 
| 
       61 
55 
     | 
    
         
             
                            .getNamedElements()
         
     | 
| 
       62 
56 
     | 
    
         
             
                            .map((p) => {
         
     | 
| 
       63 
     | 
    
         
            -
                              const defaultVal =
         
     | 
| 
       64 
     | 
    
         
            -
                                p.getDefault() != null ? " = " + p.getDefault() : "";
         
     | 
| 
      
 57 
     | 
    
         
            +
                              const defaultVal = p.getDefault() != null ? ' = ' + p.getDefault() : '';
         
     | 
| 
       65 
58 
     | 
    
         | 
| 
       66 
59 
     | 
    
         
             
                              return `${p.getName()}${defaultVal}`;
         
     | 
| 
       67 
60 
     | 
    
         
             
                            })
         
     | 
| 
       68 
     | 
    
         
            -
                            .join( 
     | 
| 
      
 61 
     | 
    
         
            +
                            .join('; ');
         
     | 
| 
       69 
62 
     | 
    
         | 
| 
       70 
63 
     | 
    
         
             
                          const suffix = serialized.type.properties
         
     | 
| 
       71 
64 
     | 
    
         
             
                            .map((p) => {
         
     | 
| 
       72 
     | 
    
         
            -
                              const comment = paramDocs.find(
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                              );
         
     | 
| 
       75 
     | 
    
         
            -
                              const desc = (comment?.value.description || "").replace(
         
     | 
| 
       76 
     | 
    
         
            -
                                /\\@/gi,
         
     | 
| 
       77 
     | 
    
         
            -
                                "@",
         
     | 
| 
       78 
     | 
    
         
            -
                              );
         
     | 
| 
      
 65 
     | 
    
         
            +
                              const comment = paramDocs.find((what) => what.value.name === p.name);
         
     | 
| 
      
 66 
     | 
    
         
            +
                              const desc = (comment?.value.description || '').replace(/\\@/gi, '@');
         
     | 
| 
       79 
67 
     | 
    
         | 
| 
       80 
68 
     | 
    
         
             
                              return `\n/**\n${desc}\n */\n ${p.name}: ${p.type.text}`;
         
     | 
| 
       81 
69 
     | 
    
         
             
                            })
         
     | 
| 
       82 
     | 
    
         
            -
                            .join( 
     | 
| 
      
 70 
     | 
    
         
            +
                            .join('; ');
         
     | 
| 
       83 
71 
     | 
    
         | 
| 
       84 
72 
     | 
    
         
             
                          return `{${prefix}}: {${suffix}}`;
         
     | 
| 
       85 
73 
     | 
    
         
             
                        })
         
     | 
| 
       86 
     | 
    
         
            -
                        .join( 
     | 
| 
      
 74 
     | 
    
         
            +
                        .join(', ');
         
     | 
| 
       87 
75 
     | 
    
         | 
| 
       88 
76 
     | 
    
         
             
                      const retVal = sig
         
     | 
| 
       89 
77 
     | 
    
         
             
                        .serialize()
         
     | 
| 
       90 
     | 
    
         
            -
                        .return.type.text.replace(/^Promise</,  
     | 
| 
       91 
     | 
    
         
            -
                        .replace(/>$/,  
     | 
| 
      
 78 
     | 
    
         
            +
                        .return.type.text.replace(/^Promise</, '')
         
     | 
| 
      
 79 
     | 
    
         
            +
                        .replace(/>$/, '');
         
     | 
| 
       92 
80 
     | 
    
         | 
| 
       93 
81 
     | 
    
         
             
                      return `
         
     | 
| 
       94 
82 
     | 
    
         
             
            /**
         
     | 
| 
       95 
     | 
    
         
            -
             * ${desc ||  
     | 
| 
      
 83 
     | 
    
         
            +
             * ${desc || ''}
         
     | 
| 
       96 
84 
     | 
    
         
             
             *
         
     | 
| 
       97 
     | 
    
         
            -
             * ${space ||  
     | 
| 
       98 
     | 
    
         
            -
             * ${eg ||  
     | 
| 
      
 85 
     | 
    
         
            +
             * ${space || ''}
         
     | 
| 
      
 86 
     | 
    
         
            +
             * ${eg || ''}
         
     | 
| 
       99 
87 
     | 
    
         
             
             **/    
         
     | 
| 
       100 
88 
     | 
    
         
             
            declare function ${member.getName()}(${params}): ${retVal};
         
     | 
| 
       101 
89 
     | 
    
         
             
                  `;
         
     | 
| 
       102 
90 
     | 
    
         
             
                    })
         
     | 
| 
       103 
     | 
    
         
            -
                    .join( 
     | 
| 
      
 91 
     | 
    
         
            +
                    .join('\n');
         
     | 
| 
       104 
92 
     | 
    
         
             
                })
         
     | 
| 
       105 
     | 
    
         
            -
                .join( 
     | 
| 
      
 93 
     | 
    
         
            +
                .join('');
         
     | 
| 
       106 
94 
     | 
    
         | 
| 
       107 
     | 
    
         
            -
              return { 
     | 
| 
      
 95 
     | 
    
         
            +
              return {text, methods: Object.keys(methods)};
         
     | 
| 
       108 
96 
     | 
    
         
             
            };
         
     | 
| 
       109 
97 
     | 
    
         | 
| 
       110 
98 
     | 
    
         
             
            export default async (path: string) => {
         
     | 
| 
       111 
99 
     | 
    
         
             
              const parsed = await parseFromFiles([path]);
         
     | 
| 
       112 
     | 
    
         
            -
              if (parsed.errors?.length)
         
     | 
| 
       113 
     | 
    
         
            -
                throw new Error(path + " " + JSON.stringify(parsed.errors));
         
     | 
| 
      
 100 
     | 
    
         
            +
              if (parsed.errors?.length) throw new Error(path + ' ' + JSON.stringify(parsed.errors));
         
     | 
| 
       114 
101 
     | 
    
         
             
              return transform(parsed.project?.getModules() || []);
         
     | 
| 
       115 
102 
     | 
    
         
             
            };
         
     |