gcf-utils 14.1.0 → 14.1.1
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/build/src/bin/genkey.js +45 -43
 - package/build/src/bin/genkey.js.map +1 -1
 - package/package.json +3 -3
 
    
        package/build/src/bin/genkey.js
    CHANGED
    
    | 
         @@ -40,48 +40,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); 
     | 
|
| 
       40 
40 
     | 
    
         
             
            const yargs = __importStar(require("yargs"));
         
     | 
| 
       41 
41 
     | 
    
         
             
            const secret_manager_1 = require("@google-cloud/secret-manager");
         
     | 
| 
       42 
42 
     | 
    
         
             
            const genkey_util_1 = require("./genkey-util");
         
     | 
| 
       43 
     | 
    
         
            -
            const argv = yargs.command('gen', 'Create and upload a client key.', (yargs) => {
         
     | 
| 
       44 
     | 
    
         
            -
                return yargs
         
     | 
| 
       45 
     | 
    
         
            -
                    .option('keyfile', {
         
     | 
| 
       46 
     | 
    
         
            -
                    describe: 'The path to the .pem keyfile',
         
     | 
| 
       47 
     | 
    
         
            -
                    type: 'string',
         
     | 
| 
       48 
     | 
    
         
            -
                    default: 'key.pem',
         
     | 
| 
       49 
     | 
    
         
            -
                })
         
     | 
| 
       50 
     | 
    
         
            -
                    .option('verbose', {
         
     | 
| 
       51 
     | 
    
         
            -
                    alias: 'v',
         
     | 
| 
       52 
     | 
    
         
            -
                    default: false,
         
     | 
| 
       53 
     | 
    
         
            -
                    type: 'boolean',
         
     | 
| 
       54 
     | 
    
         
            -
                })
         
     | 
| 
       55 
     | 
    
         
            -
                    .option('project', {
         
     | 
| 
       56 
     | 
    
         
            -
                    describe: 'Name of GCP project',
         
     | 
| 
       57 
     | 
    
         
            -
                    alias: 'p',
         
     | 
| 
       58 
     | 
    
         
            -
                    type: 'string',
         
     | 
| 
       59 
     | 
    
         
            -
                    demand: true,
         
     | 
| 
       60 
     | 
    
         
            -
                })
         
     | 
| 
       61 
     | 
    
         
            -
                    .option('bot', {
         
     | 
| 
       62 
     | 
    
         
            -
                    alias: 'b',
         
     | 
| 
       63 
     | 
    
         
            -
                    type: 'string',
         
     | 
| 
       64 
     | 
    
         
            -
                    demand: true,
         
     | 
| 
       65 
     | 
    
         
            -
                    description: 'Name of the bot',
         
     | 
| 
       66 
     | 
    
         
            -
                })
         
     | 
| 
       67 
     | 
    
         
            -
                    .option('id', {
         
     | 
| 
       68 
     | 
    
         
            -
                    alias: 'i',
         
     | 
| 
       69 
     | 
    
         
            -
                    type: 'string',
         
     | 
| 
       70 
     | 
    
         
            -
                    demand: true,
         
     | 
| 
       71 
     | 
    
         
            -
                    description: 'ID of the GitHub Application',
         
     | 
| 
       72 
     | 
    
         
            -
                })
         
     | 
| 
       73 
     | 
    
         
            -
                    .option('secret', {
         
     | 
| 
       74 
     | 
    
         
            -
                    alias: 's',
         
     | 
| 
       75 
     | 
    
         
            -
                    type: 'string',
         
     | 
| 
       76 
     | 
    
         
            -
                    demand: true,
         
     | 
| 
       77 
     | 
    
         
            -
                    description: 'Webhook Secret of the GitHub Application',
         
     | 
| 
       78 
     | 
    
         
            -
                });
         
     | 
| 
       79 
     | 
    
         
            -
            }).argv;
         
     | 
| 
       80 
     | 
    
         
            -
            const keyfile = argv.keyfile || 'key.pem';
         
     | 
| 
       81 
     | 
    
         
            -
            const project = argv.project;
         
     | 
| 
       82 
     | 
    
         
            -
            const botname = argv.bot;
         
     | 
| 
       83 
     | 
    
         
            -
            const webhookSecret = argv.secret;
         
     | 
| 
       84 
     | 
    
         
            -
            const id = Number(argv.id);
         
     | 
| 
       85 
43 
     | 
    
         
             
            async function run(keyfile, webhookSecret, id, project, botname) {
         
     | 
| 
       86 
44 
     | 
    
         
             
                const blob = await (0, genkey_util_1.gather)(keyfile, id, webhookSecret);
         
     | 
| 
       87 
45 
     | 
    
         
             
                const opts = project
         
     | 
| 
         @@ -92,5 +50,49 @@ async function run(keyfile, webhookSecret, id, project, botname) { 
     | 
|
| 
       92 
50 
     | 
    
         
             
                const smclient = new secret_manager_1.v1.SecretManagerServiceClient(opts);
         
     | 
| 
       93 
51 
     | 
    
         
             
                await (0, genkey_util_1.create)(smclient, project, botname, blob);
         
     | 
| 
       94 
52 
     | 
    
         
             
            }
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
      
 53 
     | 
    
         
            +
            (async () => {
         
     | 
| 
      
 54 
     | 
    
         
            +
                const argv = await yargs.command('gen', 'Create and upload a client key.', (yargs) => {
         
     | 
| 
      
 55 
     | 
    
         
            +
                    return yargs
         
     | 
| 
      
 56 
     | 
    
         
            +
                        .option('keyfile', {
         
     | 
| 
      
 57 
     | 
    
         
            +
                        describe: 'The path to the .pem keyfile',
         
     | 
| 
      
 58 
     | 
    
         
            +
                        type: 'string',
         
     | 
| 
      
 59 
     | 
    
         
            +
                        default: 'key.pem',
         
     | 
| 
      
 60 
     | 
    
         
            +
                    })
         
     | 
| 
      
 61 
     | 
    
         
            +
                        .option('verbose', {
         
     | 
| 
      
 62 
     | 
    
         
            +
                        alias: 'v',
         
     | 
| 
      
 63 
     | 
    
         
            +
                        default: false,
         
     | 
| 
      
 64 
     | 
    
         
            +
                        type: 'boolean',
         
     | 
| 
      
 65 
     | 
    
         
            +
                    })
         
     | 
| 
      
 66 
     | 
    
         
            +
                        .option('project', {
         
     | 
| 
      
 67 
     | 
    
         
            +
                        describe: 'Name of GCP project',
         
     | 
| 
      
 68 
     | 
    
         
            +
                        alias: 'p',
         
     | 
| 
      
 69 
     | 
    
         
            +
                        type: 'string',
         
     | 
| 
      
 70 
     | 
    
         
            +
                        demand: true,
         
     | 
| 
      
 71 
     | 
    
         
            +
                    })
         
     | 
| 
      
 72 
     | 
    
         
            +
                        .option('bot', {
         
     | 
| 
      
 73 
     | 
    
         
            +
                        alias: 'b',
         
     | 
| 
      
 74 
     | 
    
         
            +
                        type: 'string',
         
     | 
| 
      
 75 
     | 
    
         
            +
                        demand: true,
         
     | 
| 
      
 76 
     | 
    
         
            +
                        description: 'Name of the bot',
         
     | 
| 
      
 77 
     | 
    
         
            +
                    })
         
     | 
| 
      
 78 
     | 
    
         
            +
                        .option('id', {
         
     | 
| 
      
 79 
     | 
    
         
            +
                        alias: 'i',
         
     | 
| 
      
 80 
     | 
    
         
            +
                        type: 'string',
         
     | 
| 
      
 81 
     | 
    
         
            +
                        demand: true,
         
     | 
| 
      
 82 
     | 
    
         
            +
                        description: 'ID of the GitHub Application',
         
     | 
| 
      
 83 
     | 
    
         
            +
                    })
         
     | 
| 
      
 84 
     | 
    
         
            +
                        .option('secret', {
         
     | 
| 
      
 85 
     | 
    
         
            +
                        alias: 's',
         
     | 
| 
      
 86 
     | 
    
         
            +
                        type: 'string',
         
     | 
| 
      
 87 
     | 
    
         
            +
                        demand: true,
         
     | 
| 
      
 88 
     | 
    
         
            +
                        description: 'Webhook Secret of the GitHub Application',
         
     | 
| 
      
 89 
     | 
    
         
            +
                    });
         
     | 
| 
      
 90 
     | 
    
         
            +
                }).argv;
         
     | 
| 
      
 91 
     | 
    
         
            +
                const keyfile = argv.keyfile || 'key.pem';
         
     | 
| 
      
 92 
     | 
    
         
            +
                const project = argv.project;
         
     | 
| 
      
 93 
     | 
    
         
            +
                const botname = argv.bot;
         
     | 
| 
      
 94 
     | 
    
         
            +
                const webhookSecret = argv.secret;
         
     | 
| 
      
 95 
     | 
    
         
            +
                const id = Number(argv.id);
         
     | 
| 
      
 96 
     | 
    
         
            +
                await run(keyfile, webhookSecret, id, project, botname);
         
     | 
| 
      
 97 
     | 
    
         
            +
            })();
         
     | 
| 
       96 
98 
     | 
    
         
             
            //# sourceMappingURL=genkey.js.map
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"genkey.js","sourceRoot":"","sources":["../../../src/bin/genkey.ts"],"names":[],"mappings":";;AACA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,6CAA+B;AAE/B,iEAAgD;AAChD,+CAA6C;AAE7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO, 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"genkey.js","sourceRoot":"","sources":["../../../src/bin/genkey.ts"],"names":[],"mappings":";;AACA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,6CAA+B;AAE/B,iEAAgD;AAChD,+CAA6C;AAE7C,KAAK,UAAU,GAAG,CAChB,OAAe,EACf,aAAqB,EACrB,EAAU,EACV,OAAe,EACf,OAAe;IAEf,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAM,EAAC,OAAO,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO;QAClB,CAAC,CAAC;YACE,SAAS,EAAE,OAAO;SACnB;QACH,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,QAAQ,GAAG,IAAI,mBAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,IAAA,oBAAM,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAC9B,KAAK,EACL,iCAAiC,EACjC,CAAC,KAAW,EAAE,EAAE;QACd,OAAO,KAAK;aACT,MAAM,CAAC,SAAS,EAAE;YACjB,QAAQ,EAAE,8BAA8B;YACxC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;SACnB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,SAAS;SAChB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,QAAQ,EAAE,qBAAqB;YAC/B,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,iBAAiB;SAC/B,CAAC;aACD,MAAM,CAAC,IAAI,EAAE;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,8BAA8B;SAC5C,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,0CAA0C;SACxD,CAAC,CAAC;IACP,CAAC,CACF,CAAC,IAAI,CAAC;IAEP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiB,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAI,CAAC;IAC1B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE3B,MAAM,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC,CAAC,EAAE,CAAC"}
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "gcf-utils",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "14.1. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "14.1.1",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "description": "An extension for running Probot in Google Cloud Functions",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "scripts": {
         
     | 
| 
       6 
6 
     | 
    
         
             
                "compile": "tsc -p .",
         
     | 
| 
         @@ -48,7 +48,7 @@ 
     | 
|
| 
       48 
48 
     | 
    
         
             
                "probot": "^12.2.7",
         
     | 
| 
       49 
49 
     | 
    
         
             
                "tmp": "^0.2.1",
         
     | 
| 
       50 
50 
     | 
    
         
             
                "uuid": "^9.0.0",
         
     | 
| 
       51 
     | 
    
         
            -
                "yargs": "^ 
     | 
| 
      
 51 
     | 
    
         
            +
                "yargs": "^17.0.0"
         
     | 
| 
       52 
52 
     | 
    
         
             
              },
         
     | 
| 
       53 
53 
     | 
    
         
             
              "devDependencies": {
         
     | 
| 
       54 
54 
     | 
    
         
             
                "@types/get-stream": "^3.0.2",
         
     | 
| 
         @@ -57,7 +57,7 @@ 
     | 
|
| 
       57 
57 
     | 
    
         
             
                "@types/pino": "^7.0.4",
         
     | 
| 
       58 
58 
     | 
    
         
             
                "@types/sinon": "^10.0.13",
         
     | 
| 
       59 
59 
     | 
    
         
             
                "@types/tmp": "^0.2.3",
         
     | 
| 
       60 
     | 
    
         
            -
                "@types/yargs": "^ 
     | 
| 
      
 60 
     | 
    
         
            +
                "@types/yargs": "^17.0.0",
         
     | 
| 
       61 
61 
     | 
    
         
             
                "c8": "^7.12.0",
         
     | 
| 
       62 
62 
     | 
    
         
             
                "cross-env": "^7.0.3",
         
     | 
| 
       63 
63 
     | 
    
         
             
                "dotenv": "^16.0.2",
         
     |