npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alipay-inc/mpaas-ide-openapi

v1.0.44-alpha.0

Published

### 接口说明

Downloads

558

Readme

mPaaS IDE openAPI

接口说明

阿里云

  • https://help.aliyun.com/document_detail/178983.html

私有云

  • 请联系PDSA

接口返回数据标准

{
  data:      '<any>',     // 返回数据
  errorCode: '<string>',  // 错误代码,非必选
  requestId: '<string>',  // 请求ID,非必选
  resultMsg: '<string>',  // 当success !== true,必选
  success:   '<boolean>', // 是否正确返回
  ...                     // 各环境自定义字段
}

配置文件

  • 从控制台下载配置文件 config

    • 阿里云openapi,需要开通ak. https://help.aliyun.com/document_detail/175967.htm?spm=a2c4g.11186623.0.0.2bf41dcfwOHEGC

      • 并自行完善配置文件

      • {
          ...配置文件内容,
          "openapi": {
            "type":            'aliyun',                             // 必填、固定值
            "userId":          '<string>',                           // 必填、字母数字下划线
            "accessKeyId":     '<阿里云 AccessKey ID>',               // 必填
            "accessKeySecret": '<阿里云 AccessKey Secret>',           // 必填
            "endpoint":        'mpaas.cn-hangzhou.aliyuncs.com',     // 必填、固定值
          }
        }
    • 私有化openapi,需要配置rsa

      • {
          ...配置文件内容,
          "openapi": {
            "type":            'antfin',                             // 必填、固定值
            "userId":          '<string>',                           // 必填、字母数字下划线
            "privateKey":      '<私钥 string format>',                // 必填 https://www.samltool.com/format_privatekey.php
            "api_url":         '<私有云api地址>'                       // 必填
          }
        }
    • 如果需要详细日志,可以在配置文件中加一个字段

      • {
          ...配置文件内容,
          // 产生一个 ./.mpaas-ide-openapi.${yyyy-MM-dd}.log 文件
          // "log": true,
          // 或者指定文件目录
          "log": {
            root: path.resolve(os.homedir(), '.mpaas_ide_openapi_log')
          }
        }

使用方法

  • // 引入依赖
    const Client = require('@alipay-inc/mpaas-ide-openapi').default;
    // 引入配置文件
    const config = '<上文中的配置文件>';
    // 创建实例
    const {
      client
    } = new Client(config);
    // 发起请求
    (async () => {
      const result = await client.getAppListByApi();
      console.log(result);
    }());

API

getAppListByApi 拉取小程序列表

  • 入参

    • {
        miniType: 'plugin'    // 选填,是否为小程序插件
      }
  • 返回

    • {
        data: [
         {
            appCode:     '<string>',
            gmtCreate:   '<string>',
            gmtModified: '<string>',
            h5Id:        '<string>',
            h5Name:      '<string>',
           ...
          },
          ...
        ],
        errorCode: 'OK',
        requestId: '<string>',
        resultMsg: '',
        success:   true
      }

getPackageInfoByApi 拉取小程序配置

  • 若此小程序从未发布过,则读取默认配置

  • 入参

    • {
        h5Id:         '<string>',  // 必填,小程序ID
        h5Name:       '<string>',  // 必填,小程序名称
        packageTypes: '<string>',  // 可选,默认 '1,2,3,4',
        miniType:     'plugin'     // 选填,是否为小程序插件
      }
  • 返回

    • {
        data:      '<object>',
        errorCode: 'OK',
        requestId: '<string>',
        resultMsg: '',
        success:   true
      }

uploadPackageByApi 上传小程序并发布

  • 上传小程序包之前,需要检测是否配置虚拟域名,若未配置,则报错

  • 预览调试包上传并发布,正式包只上传

  • 调试包上传之前需要检测是否有白名单,若无白名单,则直接报错返回

  • 入参

    • {
        appInfo:            '<object>',  // 必填,小程序配置
        packageType:        '<string>',  // 必填,包类型(1,2 为正式包。3,4 为测试包)
        resourceFile:       '<string>',  // 必填,小程序包的本地绝对路径
        iconFile:           '<string>',  // 选填,小程序图标的本地绝对路径
        h5Version:          '<string>',  // 选填,版本号(若传入,则使用此版本号。若未传入,则使用appInfo.h5Version + packageType生成新的版本号)
        whiteListValue:     '<string>',  // 选填,白名单(若packageType === '3' || '4',则为测试包,需要白名单)
        uuid:               '<string>',  // 选填,真机调试的UUID(若packageType === '3',则为调试包,需要UUID,未必填项)
        sourceCodeFile:     '<string>',  // 选填,源码包本地的压缩包地址,
        appxVersion:        '<string>',  // 选填,'1.0' || '2.0',appx的版本。默认 '1.0',
        buildTarget:        '<string>',  // 选填,远程调试类型,'RemoteBoatman' 为新版,需要匹配新容器
        miniType:           'plugin',    // 选填,是否为小程序插件
        pluginFile:         '<string>',  // 选填,小程序插件的本地绝对路径(无需转换zip格式)
        bindMiniPluginIds:  '<string>',  // 选填,小程序需要使用的插件资源id,多个使用逗号分隔
      }
  • 返回

    • {
        data:      '<object>',
        /**
        * packageType === 3 || 4
        * {
        *   debugUrl:   '....', // 二维码地址
        *   userId:     'xxx',  // 
        *   h5Version:  'xxx',  // 本次上传的版本号
        *   gmtCreate:  'xxx',  // 本次上传的时间戳
        * }
        *
        *
        * packageType === 1 || 2
        * {
        *   packageId:   '....',// 本次上传的ID
        *   h5Version:  'xxx',  // 本次上传的版本号
        *   gmtCreate:  'xxx',  // 本次上传的时间戳
        * }
        */ 
        errorCode: 'OK',
        requestId: '<string>',
        resultMsg: '',
        success:   true
      }

checkPluginByApi 查询小程序插件权限

  • 入参

    • {
        miniPluginId:  '<string>',  // 必填,小程序插件ID
        miniProgramId: '<string>',  // 必填,小程序ID
      }
  • 返回

    • {
        data: '<string>',           // 小程序插件包地址
        success: true               // false
      }

公共API

cloudBuild 云构建小程序

  • 入参

    • {
        file:         '<string>', // 必填,本地amr文件路径、或者本地项目的根目录
        config:       '<object>', // 必填,配置文件
        h5Id:         '<string>', // 必填,mPaaS小程序ID
      }
  • 返回

    • {
        data: {
          file:         '<string>',  // 本地根据h5Id生成的mPaaS zip文件,可以直接从控制台上传。小程序则为小程序的构建产物,插件则为插件的构建产物不包含壳文件
          originFile:   '<string>',  // 云构建原始文件,
          appxVersion:  '<string>',  // appx的版本。'1.0' || '2.0',
          originData:   '<object>'   // 云构建返回的原始数据
        },
        success:      true
      }

getZipFromTar 将本地IDE/mpaasu构建后的小程序tar文件转为mPaaS格式的zip文件

  • 入参

    • {
        tarFilePath:  '<string>', // 必填,本地tar文件
        h5Id:         '<string>'  // 必填,mPaaS小程序ID
      }
  • 返回

    • {
        data:         '<string>',  // 转换后的zip文件本地路径
        success:      true
      }

cleanCache 清除openapi的缓存文件

  • 入参 -

  • 返回

    • {
        data:    'ok',
        success: true
      }

getUUID 获取uuid

  • 入参

    • {
        config:       '<object>', // 必填,配置文件
      }
  • 返回

    • {
        data:         '<string>',  // 生成的uuid
        success:      true
      }