You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

alipay-dev

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alipay-dev - npm Package Compare versions

Comparing version

to
0.4.3

__mocks__/superagent.d.ts

3

index.d.ts

@@ -91,3 +91,3 @@ import { MiniPreviewOptions } from './service/mini/preview';

*/
export declare function createKey(options: CreateKeyOptions): Promise<CreateKeyResult>;
export declare function createKey(options?: CreateKeyOptions): Promise<CreateKeyResult>;
/**

@@ -101,1 +101,2 @@ * 密钥匹配检测

export declare function convertKey(options: ConvertKeyOptions): Promise<void>;
export declare function getAuthCode(options: any): Promise<import("./service/mini/workbench/auth").AuthResult>;

@@ -52,33 +52,33 @@ !function(e, t) {

"use strict";
n.r(t), n.d(t, "miniAppList", (function() {
return m;
n.r(t), n.d(t, "setConfig", (function() {
return d.d;
})), n.d(t, "miniAppList", (function() {
return b;
})), n.d(t, "miniPreview", (function() {
return g;
})), n.d(t, "miniUpload", (function() {
return b;
return O;
})), n.d(t, "cloudSpaceList", (function() {
return h;
return j;
})), n.d(t, "cloudFunctionList", (function() {
return O;
return y;
})), n.d(t, "downloadCloudFunction", (function() {
return j;
return w;
})), n.d(t, "deployCloudFunction", (function() {
return y;
return v;
})), n.d(t, "invokeLocalFunction", (function() {
return w;
return S;
})), n.d(t, "invokeCloudFunction", (function() {
return v;
return I;
})), n.d(t, "createKey", (function() {
return S;
return E;
})), n.d(t, "matchKey", (function() {
return I;
return P;
})), n.d(t, "convertKey", (function() {
return E;
return k;
})), n.d(t, "getAuthCode", (function() {
return x;
}));
var r = n("Wuws"), o = n("Cc6s"), a = n("YVNA"), i = n("JxAU"), c = n("KPUX"), s = n("QWwU"), u = n("p77J"), p = n("uwbq"), l = n("/puO"), d = n("oM9G");
n.d(t, "setConfig", (function() {
return d.d;
}));
var f = n("DKWp");
function m() {
var r = n("Wuws"), o = n("Cc6s"), i = n("YVNA"), a = n("JxAU"), c = n("KPUX"), s = n("QWwU"), u = n("p77J"), p = n("uwbq"), l = n("/puO"), d = n("oM9G"), f = n("DKWp"), m = n("YLtl"), h = n("yf2u");
function b() {
return Object(o.a)();

@@ -89,9 +89,9 @@ }

action: "MINI_PREVIEW"
}), Object(a.a)(e);
}), Object(i.a)(e);
}
async function b(e) {
async function O(e) {
Object(f.a)({
action: "MINI_UPLOAD"
});
const t = await Object(i.a)(e);
const t = await Object(a.a)(e);
return t.qrCodeUrl && Object(f.a)({

@@ -101,3 +101,3 @@ action: "MINI_EXPERIENCE"

}
function h(e) {
function j(e) {
return Object(f.a)({

@@ -107,3 +107,3 @@ action: "CLOUD_SPACE_LIST"

}
function O(e) {
function y(e) {
return Object(f.a)({

@@ -113,3 +113,3 @@ action: "CLOUD_FUNCTION_LIST"

}
function j(e) {
function w(e) {
return Object(f.a)({

@@ -119,3 +119,3 @@ action: "CLOUD_FUNCTION_DOWNLOAD"

}
function y(e) {
function v(e) {
return Object(f.a)({

@@ -125,3 +125,3 @@ action: "CLOUD_FUNCTION_DEPLOY"

}
function w(e) {
function S(e) {
return Object(f.a)({

@@ -131,3 +131,3 @@ action: "CLOUD_FUNCTION_LOCAL"

}
function v(e) {
function I(e) {
return Object(f.a)({

@@ -137,3 +137,3 @@ action: "CLOUD_FUNCTION_SECRET"

}
function S(e) {
function E(e) {
return Object(f.a)({

@@ -143,3 +143,3 @@ action: "KEY_CREATE"

}
function I(e) {
function P(e) {
return Object(f.a)({

@@ -149,3 +149,3 @@ action: "KEY_MATCH"

}
function E(e) {
function k(e) {
return Object(f.a)({

@@ -155,2 +155,16 @@ action: "KEY_CONVERT"

}
function x(e) {
return Object(f.a)({
action: "MINI_GET_AUTH_CODE"
}), async function(e) {
const t = await Object(h.a)({
method: "GET",
host: "ide",
path: "/cli/sim/auth.json",
needSign: !0,
data: e
});
return Object(m.pick)(t, [ "authCode", "authDestUrl" ]);
}(e);
}
},

@@ -166,5 +180,5 @@ "/puO": function(e, t, n) {

}));
var r = n("YC6a"), o = n.n(r), a = n("5ruT"), i = n("YLtl");
var r = n("YC6a"), o = n.n(r), i = n("5ruT"), a = n("YLtl");
async function c(e) {
const t = Object(i.defaults)(e, {
const t = Object(a.defaults)(e, {
type: "rsa2",

@@ -180,3 +194,3 @@ scheme: "pkcs8"

const l = new o.a(u), d = r + "-private-pem", f = p(l.exportKey(d)), m = p(l.exportKey("pkcs8-public-pem"));
return s && c && await Promise.all([ Object(a.c)(c, m), Object(a.c)(s, f) ]), {
return s && c && await Promise.all([ Object(i.c)(c, m), Object(i.c)(s, f) ]), {
privatePem: f,

@@ -187,16 +201,16 @@ publicPem: m

function s(e) {
const {publicPem: t, privatePem: n} = e, r = l(t), a = l(n);
let i, c;
const {publicPem: t, privatePem: n} = e, r = l(t), i = l(n);
let a, c;
try {
i = new o.a(t, r), c = new o.a(n, a);
a = new o.a(t, r), c = new o.a(n, i);
} catch (e) {
return !1;
}
return !(!i.isPublic(!0) || c.isPublic(!0)) && i.exportKey("pkcs8-public-pem") == c.exportKey("pkcs8-public-pem");
return !(!a.isPublic(!0) || c.isPublic(!0)) && a.exportKey("pkcs8-public-pem") == c.exportKey("pkcs8-public-pem");
}
async function u(e) {
const {scheme: t = "pkcs8", priPath: n} = e, r = await Object(a.a)(n);
const {scheme: t = "pkcs8", priPath: n} = e, r = await Object(i.a)(n);
try {
const e = new o.a(r, l(r)), n = t + "-public-pem", a = t + "-private-pem", i = p(e.exportKey(a)), c = p(e.exportKey(n));
console.log("已转换 " + t + " 应用私钥:"), console.log(i), console.log("已转换 " + t + " 应用公钥:"),
const e = new o.a(r, l(r)), n = t + "-public-pem", i = t + "-private-pem", a = p(e.exportKey(i)), c = p(e.exportKey(n));
console.log("已转换 " + t + " 应用私钥:"), console.log(a), console.log("已转换 " + t + " 应用公钥:"),
console.log(c);

@@ -219,3 +233,3 @@ } catch (e) {

}));
var r = n("Qc0G"), o = n.n(r), a = n("QQ+o"), i = n.n(a), c = n("oyvS"), s = n.n(c), u = n("jK02"), p = n("YLtl"), l = n("NldC");
var r = n("Qc0G"), o = n.n(r), i = n("QQ+o"), a = n.n(i), c = n("oyvS"), s = n.n(c), u = n("jK02"), p = n("YLtl"), l = n("NldC");
function d(e, t) {

@@ -246,3 +260,3 @@ var n = Object.keys(e);

}
const g = Object(a.format)(e => {
const h = Object(i.format)(e => {
const t = e.prefix;

@@ -255,17 +269,17 @@ t && (e.level = t, Reflect.deleteProperty(e, "prefix"));

var r;
return t && n.push(new a.transports.Console({
format: a.format.combine(g(), a.format.colorize({
return t && n.push(new i.transports.Console({
format: i.format.combine(h(), i.format.colorize({
all: !0
}), a.format.errors({
}), i.format.errors({
stack: !0
}), a.format.simple())
})), n.push(new a.transports.File({
}), i.format.simple())
})), n.push(new i.transports.File({
filename: (r = e, s.a.join(m(), r + ".log")),
maxsize: 1048576,
format: a.format.combine(a.format.timestamp({
format: i.format.combine(i.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss"
}), a.format.errors({
}), i.format.errors({
stack: !0
}), a.format.json())
})), i.a.createLogger({
}), i.format.json())
})), a.a.createLogger({
level: "silly",

@@ -275,3 +289,3 @@ transports: n

}
const h = b("info"), O = b("error"), j = b("warn");
const g = b("info"), O = b("error"), j = b("warn");
function y(e) {

@@ -294,3 +308,3 @@ let t = 0;

info(e, t) {
h.info(f({
g.info(f({
message: e

@@ -317,4 +331,4 @@ }, t));

type: "asterisk"
}), a = [ "", ...e, "" ];
for (const e of a) {
}), i = [ "", ...e, "" ];
for (const e of i) {
const t = y(e);

@@ -324,11 +338,11 @@ r.push(t), n = Math.max(t, n);

n += 7;
const i = Object(p.padStart)("", 4), c = Object(p.pad)("", n, "-");
console.log(i + c), a.forEach((e, t) => {
const a = Object(p.padStart)("", 4), c = Object(p.pad)("", n, "-");
console.log(a + c), i.forEach((e, t) => {
const c = n + e.length - r[t] - 2;
if (0 === t || t === a.length - 1) console.log(i + `|${Object(p.padEnd)(e, c, " ")}|`); else {
if (0 === t || t === i.length - 1) console.log(a + `|${Object(p.padEnd)(e, c, " ")}|`); else {
const n = (s = o.type, u = t, "asterisk" === s ? " * " : ` ${u}. `);
console.log(i + `|${n}${Object(p.padEnd)(e, c - n.length, " ")}|`);
console.log(a + `|${n}${Object(p.padEnd)(e, c - n.length, " ")}|`);
}
var s, u;
}), console.log(i + c);
}), console.log(a + c);
},

@@ -350,3 +364,3 @@ orderListLog(e) {

n.d(t, "c", (function() {
return i;
return a;
})), n.d(t, "a", (function() {

@@ -357,4 +371,4 @@ return c;

}));
var r = n("mw/K"), o = n.n(r), a = n("jK02");
const i = Object(a.promisify)(o.a.writeFile), c = Object(a.promisify)(o.a.readFile);
var r = n("mw/K"), o = n.n(r), i = n("jK02");
const a = Object(i.promisify)(o.a.writeFile), c = Object(i.promisify)(o.a.readFile);
async function s(e) {

@@ -379,8 +393,8 @@ const t = await c(e, {

n.d(t, "b", (function() {
return i;
})), n.d(t, "a", (function() {
return a;
})), n.d(t, "a", (function() {
return i;
}));
var r = n("YLtl"), o = n("yf2u");
function a() {
function i() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(e) {

@@ -391,3 +405,3 @@ const t = 16 * Math.random() | 0;

}
const i = Object(r.memoize)((async function(e, t) {
const a = Object(r.memoize)((async function(e, t) {
const {privateKey: n} = await Object(o.a)({

@@ -402,3 +416,3 @@ method: "GET",

}
}).catch(n => (i.cache.delete(e + t), Promise.reject(n))), r = n.split("\\n");
}).catch(n => (a.cache.delete(e + t), Promise.reject(n))), r = n.split("\\n");
return `${r[0]}\n${r[1]}\n${r[2]}`;

@@ -412,6 +426,6 @@ }), (function(...e) {

n.d(t, "a", (function() {
return a;
return i;
}));
var r = n("YLtl"), o = n("yf2u");
async function a() {
async function i() {
let e = await Object(o.a)({

@@ -431,3 +445,3 @@ method: "GET",

}));
var r = n("Qc0G"), o = n.n(r), a = n("NldC"), i = n("rSy1"), c = n("oM9G");
var r = n("Qc0G"), o = n.n(r), i = n("NldC"), a = n("rSy1"), c = n("oM9G");
function s(e, t) {

@@ -457,9 +471,9 @@ var n = Object.keys(e);

}({
ideVersion: "0.4.2",
ideVersion: "0.4.3",
ideType: Object(c.b)(),
macAddress: Object(a.g)(),
macAddress: Object(i.g)(),
os: "darwin" === process.platform ? "Mac" : "Windows",
toolId: t.toolId
}, e);
Object(i.a)({
Object(a.a)({
method: "POST",

@@ -474,6 +488,6 @@ host: "ide",

"use strict";
var r = n("oyvS"), o = n.n(r), a = n("Na7r"), i = n.n(a), c = n("YLtl"), s = n("yf2u"), u = n("NldC"), p = n("mw/K"), l = n.n(p), d = n("Va/A"), f = n.n(d), m = n("ly8A");
var g = n("5ruT"), b = n("VUW3"), h = n("vedK");
var r = n("oyvS"), o = n.n(r), i = n("Na7r"), a = n.n(i), c = n("YLtl"), s = n("yf2u"), u = n("NldC"), p = n("mw/K"), l = n.n(p), d = n("Va/A"), f = n.n(d), m = n("ly8A");
var h = n("5ruT"), b = n("VUW3"), g = n("vedK");
var O = async function(e) {
const {appId: t, packageVersion: n, clientType: r = "alipay", oldVersion: o} = e, a = {
const {appId: t, packageVersion: n, clientType: r = "alipay", oldVersion: o} = e, i = {
appId: t,

@@ -483,3 +497,3 @@ version: n,

};
o && Object.assign(a, {
o && Object.assign(i, {
oldVersion: o

@@ -491,9 +505,9 @@ }), await Object(s.a)({

needSign: !0,
data: a
data: i
});
let i = {
let a = {
packageStatus: "",
qrCodeUrl: ""
}, c = 0;
for (;c < 10 && (await Object(u.i)(2e3), c += 1, i = await Object(s.a)({
for (;c < 10 && (await Object(u.i)(2e3), c += 1, a = await Object(s.a)({
method: "GET",

@@ -508,5 +522,5 @@ host: "ide",

}
}), "alipay" !== r || i.packageStatus || (i.packageStatus = "packaging"), "packaging" === i.packageStatus); ) ;
if ("success" === i.packageStatus) return {
qrCodeUrl: i.qrCodeUrl
}), "alipay" !== r || a.packageStatus || (a.packageStatus = "packaging"), "packaging" === a.packageStatus); ) ;
if ("success" === a.packageStatus) return {
qrCodeUrl: a.qrCodeUrl
};

@@ -531,7 +545,7 @@ throw new Error("小程序体验版本设置失败");

"dist.tar" === o ? e = "FULL" : "dist-sub-main.tar" === o ? e = "MAIN" : Object(c.includes)(o, "-map") && (e = "SOURCE_MAP");
const a = parseInt(r[1], 10) / 1024;
const i = parseInt(r[1], 10) / 1024;
n.push({
name: o,
type: e,
size: a + "KB"
size: i + "KB"
});

@@ -550,12 +564,12 @@ }

async function I(e) {
const {appId: t, project: n, clientType: r, onProgressUpdate: a, packageVersion: c} = e, p = await Object(h.a)(n), d = await Object(u.j)(), b = await async function(e, t) {
const {appId: t, project: n, clientType: r, onProgressUpdate: i, packageVersion: c} = e, p = await Object(g.a)(n), d = await Object(u.j)(), b = await async function(e, t) {
const n = await Object(m.a)(e, t, "", !0);
return new Promise(e => {
const r = new f.a.ZipFile, a = o.a.join(t, "dist.amr");
r.addFile(n, "dist.tar"), r.outputStream.pipe(l.a.createWriteStream(a)).on("close", (function() {
e(a);
const r = new f.a.ZipFile, i = o.a.join(t, "dist.amr");
r.addFile(n, "dist.tar"), r.outputStream.pipe(l.a.createWriteStream(i)).on("close", (function() {
e(i);
})), r.end();
});
}(p.clientPath, d), O = await Object(g.a)(b), w = i()(O);
p.moveMiniProject && h.a.removeMiniProject(p.clientPath), a({
}(p.clientPath, d), O = await Object(h.a)(b), w = a()(O);
p.moveMiniProject && g.a.removeMiniProject(p.clientPath), i({
status: "LOCAL_PACKAGE",

@@ -598,3 +612,3 @@ data: b

})).nebulaInfo);
return a({
return i({
status: "UPLOAD_SUCCESS",

@@ -611,3 +625,3 @@ data: I

if (!E.includes(r)) throw new Error("现在支持的端有: " + E.join(","));
const a = await async function(e, t) {
const i = await async function(e, t) {
let {lastVersion: n} = await Object(s.a)({

@@ -625,13 +639,10 @@ method: "GET",

}(n, r);
let i = t.packageVersion;
if (i) {
if (!/^\d+\.\d+\.\d+$/.test(i)) throw new Error("版本号必须满足 x.y.z 格式, 且均为数字");
if (Object(u.e)(i, "<=", a)) throw new Error("本次上传版本必须大于当前开发最新版本" + a);
} else i = a.replace(/\.(\d+)$/, (function(e, t) {
let a = t.packageVersion;
if (a) {
if (!/^\d+\.\d+\.\d+$/.test(a)) throw new Error("版本号必须满足 x.y.z 格式, 且均为数字");
if (Object(u.e)(a, "<=", i)) throw new Error("本次上传版本必须大于当前开发最新版本" + i);
} else a = i.replace(/\.(\d+)$/, (function(e, t) {
return "." + (parseInt(t, 10) + 1);
})), t.packageVersion = i;
const p = `upload_${n}_${i}`;
let l = b.a.getItem(p);
l || (l = await I(t), b.a.setItem(p, l));
const d = await async function(e, t) {
})), t.packageVersion = a;
const p = await I(t), l = await async function(e, t) {
let n, r = 1;

@@ -648,7 +659,8 @@ for (;r < 100; ) {

n = j(o.nebulaInfo);
const a = Object(c.get)(n, "detail.log");
if (a && t({
data: a,
const i = Object(c.get)(n, "detail.log");
if (i && t({
data: i,
status: "BUILDING"
}), "true" === o.versionCreated) break;
if ("false" === o.needRotation) throw new Error("小程序上传失败,请查看日志排查");
}

@@ -658,12 +670,12 @@ return n;

appId: n,
packageId: l.packageId,
packageVersion: l.version,
packageId: p.packageId,
packageVersion: p.version,
clientType: t.clientType
}, o);
b.a.removeItem(p), o({
o({
status: "BUILD_SUCCESS"
});
const f = {
packages: w(d.detail.log),
packageVersion: d.version,
const d = {
packages: w(l.detail.log),
packageVersion: l.version,
qrCodeUrl: "",

@@ -675,7 +687,7 @@ devManageUrl: S(n, r)

appId: n,
packageVersion: f.packageVersion,
packageVersion: d.packageVersion,
clientType: r,
oldVersion: v(n, r)
});
f.qrCodeUrl = e.qrCodeUrl;
d.qrCodeUrl = e.qrCodeUrl;
} catch (e) {

@@ -690,3 +702,3 @@ o({

b.a.setItem(r, n);
}(n, r, d.version), f;
}(n, r, l.version), d;
};

@@ -718,7 +730,7 @@ },

})), n.d(t, "c", (function() {
return g;
return h;
})), n.d(t, "a", (function() {
return b;
})), n.d(t, "g", (function() {
return h;
return g;
})), n.d(t, "d", (function() {

@@ -737,6 +749,6 @@ return O;

}));
var r = n("jle/"), o = n.n(r), a = n("c2xf"), i = n.n(a), c = n("Y9mP"), s = n.n(c), u = n("oyvS"), p = n.n(u), l = n("jK02"), d = n("5tke"), f = n.n(d);
var r = n("jle/"), o = n.n(r), i = n("c2xf"), a = n.n(i), c = n("Y9mP"), s = n.n(c), u = n("oyvS"), p = n.n(u), l = n("jK02"), d = n("5tke"), f = n.n(d);
function m(e) {
return new Promise((t, n) => {
i.a.toString(e, {
a.a.toString(e, {
type: "terminal",

@@ -750,5 +762,5 @@ version: 10,

}
function g(e) {
function h(e) {
return new Promise((t, n) => {
i.a.toDataURL(e, {
a.a.toDataURL(e, {
errorCorrectionLevel: "Q",

@@ -765,3 +777,3 @@ quality: .8

n.root !== n.dir && await f()(n.dir), await new Promise((n, r) => {
i.a.toFile(e, t, {
a.a.toFile(e, t, {
type: "png"

@@ -773,3 +785,3 @@ }, (function(e) {

}
function h() {
function g() {
try {

@@ -790,6 +802,6 @@ return s()();

function w(e, t, n) {
const r = e.split("."), o = n.split("."), a = Math.max(r.length, o.length);
let i, c, s = 0;
for (let e = 0; e < a && !s; e++) i = parseInt(r[e], 10) || 0, c = parseInt(o[e], 10) || 0,
i < c ? s = 1 : i > c && (s = -1);
const r = e.split("."), o = n.split("."), i = Math.max(r.length, o.length);
let a, c, s = 0;
for (let e = 0; e < i && !s; e++) a = parseInt(r[e], 10) || 0, c = parseInt(o[e], 10) || 0,
a < c ? s = 1 : a > c && (s = -1);
switch (t) {

@@ -857,11 +869,11 @@ case ">":

}));
var r = n("iHmL"), o = n.n(r), a = n("5tke"), i = n.n(a), c = n("oyvS"), s = n.n(c), u = n("mw/K"), p = n.n(u);
var r = n("iHmL"), o = n.n(r), i = n("5tke"), a = n.n(i), c = n("oyvS"), s = n.n(c), u = n("mw/K"), p = n.n(u);
async function l(e) {
const {dist: t, link: n} = e, r = s.a.dirname(e.dist);
return await i()(r), new Promise((e, r) => {
const a = p.a.createWriteStream(t), i = o.a.get(n).timeout({
return await a()(r), new Promise((e, r) => {
const i = p.a.createWriteStream(t), a = o.a.get(n).timeout({
response: 7e3,
deadline: 6e4
});
i.on("error", (function() {
a.on("error", (function() {
r({

@@ -872,4 +884,4 @@ stat: "fail",

});
})), i.on("end", (function() {
a.on("close", () => {
})), a.on("end", (function() {
i.on("close", () => {
e({

@@ -881,3 +893,3 @@ stat: "ok",

});
})), i.pipe(a);
})), a.pipe(i);
});

@@ -888,13 +900,13 @@ }

"use strict";
var r = n("5M6s"), o = n.n(r), a = n("NldC");
const i = o.a.load("local", Object(a.d)());
var r = n("5M6s"), o = n.n(r), i = n("NldC");
const a = o.a.load("local", Object(i.d)());
t.a = {
getItem: function(e) {
return i.getKey(e);
return a.getKey(e);
},
setItem: function(e, t) {
i.setKey(e, t), i.save(!0);
a.setKey(e, t), a.save(!0);
},
removeItem: function(e) {
i.removeKey(e), i.save(!0);
a.removeKey(e), a.save(!0);
}

@@ -908,4 +920,4 @@ };

"use strict";
var r = n("Qc0G"), o = n.n(r), a = n("oyvS"), i = n.n(a), c = n("mw/K"), s = n.n(c), u = n("YLtl"), p = n("fYkh"), l = n.n(p), d = n("+vY8"), f = n.n(d), m = n("6hfb");
var g = n("8Hvz");
var r = n("Qc0G"), o = n.n(r), i = n("oyvS"), a = n.n(i), c = n("mw/K"), s = n.n(c), u = n("YLtl"), p = n("fYkh"), l = n.n(p), d = n("+vY8"), f = n.n(d), m = n("6hfb");
var h = n("8Hvz");
function b(e, t) {

@@ -921,3 +933,3 @@ var n = Object.keys(e);

}
function h(e) {
function g(e) {
for (var t = 1; t < arguments.length; t++) {

@@ -934,3 +946,3 @@ var n = null != arguments[t] ? arguments[t] : {};

async function O(e, t) {
const n = i.a.join(e, t, "index.js"), r = require(n);
const n = a.a.join(e, t, "index.js"), r = require(n);
if (!r || "function" != typeof r && "function" != typeof r.default) throw new Error("入口函数必须为 module.exports");

@@ -940,3 +952,3 @@ return "function" == typeof r ? r : r.default;

async function j(e) {
const {appId: t, spaceId: n, project: r, name: o, functionArgs: a, serverSecret: c} = e, [p, b] = await Promise.all([ c || Object(g.a)(t, n), O(r, o) ]), y = Object(g.b)(), w = function() {
const {appId: t, spaceId: n, project: r, name: o, functionArgs: i, serverSecret: c} = e, [p, b] = await Promise.all([ c || Object(h.a)(t, n), O(r, o) ]), y = Object(h.b)(), w = function() {
const e = new m.HttpClient2({

@@ -971,5 +983,5 @@ defaultArgs: {

return async function(n, r) {
const o = i.a.join(t.project, n, "index.js");
const o = a.a.join(t.project, n, "index.js");
if (s.a.existsSync(o)) {
const e = await j(h(h({}, t), {}, {
const e = await j(g(g({}, t), {}, {
name: n,

@@ -986,3 +998,3 @@ functionArgs: r,

};
}(v.function.invoke.bind(v.function), h({
}(v.function.invoke.bind(v.function), g({
requestId: y

@@ -998,3 +1010,3 @@ }, e));

requestId: y,
args: Object(u.isPlainObject)(a) ? a : {},
args: Object(u.isPlainObject)(i) ? i : {},
httpclient: w,

@@ -1012,6 +1024,6 @@ env: S,

n.d(t, "a", (function() {
return a;
return i;
}));
var r = n("ly8A"), o = n("NldC");
async function a(e) {
async function i(e) {
const t = await Object(o.j)();

@@ -1035,10 +1047,10 @@ return await Object(r.a)(e, t);

}));
var r = n("oyvS"), o = n.n(r), a = n("YLtl"), i = n("Xh6U"), c = n("yf2u"), s = n("NldC"), u = n("vedK");
var r = n("oyvS"), o = n.n(r), i = n("YLtl"), a = n("Xh6U"), c = n("yf2u"), s = n("NldC"), u = n("vedK");
async function p(e) {
const t = await Object(u.a)(e.project), n = Object(a.defaults)(e, {
onProgressUpdate: a.noop,
const t = await Object(u.a)(e.project), n = Object(i.defaults)(e, {
onProgressUpdate: i.noop,
page: t.mainUrl,
ignoreWebviewCheck: !1
}), r = function(e) {
const {appId: t, page: n, launch: r, ignoreWebviewCheck: o} = e, a = {
const {appId: t, page: n, launch: r, ignoreWebviewCheck: o} = e, i = {
appId: t,

@@ -1052,3 +1064,3 @@ bundleId: "com.alipay.alipaywallet",

unfoldToCDN: !1
}, i = {
}, a = {
launchParams: {

@@ -1060,6 +1072,6 @@ ignoreHttpReqPermission: !0,

};
n && (i.launchParams.page = n), r && (i.launchParams.query = r);
n && (a.launchParams.page = n), r && (a.launchParams.query = r);
const c = {
mainUrl: "/index.html",
extendInfo: JSON.stringify(i)
extendInfo: JSON.stringify(a)
};

@@ -1069,3 +1081,3 @@ return n && (c.mainUrl += "#" + n.replace(/\?.*/, "")), {

params: [ "--scriptName", "buildpack", "--ADAPTOR_NAME", "alipay", "--limitation", "--preview" ],
extraInfo: a,
extraInfo: i,
env: {

@@ -1079,3 +1091,3 @@ ADAPTOR_NAME: "alipay",

};
}(n), {appId: p, onProgressUpdate: l} = n, d = await Object(i.a)(t.clientPath);
}(n), {appId: p, onProgressUpdate: l} = n, d = await Object(a.a)(t.clientPath);
t.moveMiniProject && u.a.removeMiniProject(t.clientPath), l({

@@ -1106,3 +1118,3 @@ status: "LOCAL_PACKAGE",

await Object(s.i)(3e3);
const {data: o, success: a, message: i} = await Object(c.a)({
const {data: o, success: i, message: a} = await Object(c.a)({
method: "POST",

@@ -1120,7 +1132,7 @@ host: "ide",

if (r > 100) throw new Error("查询构建状态超时,请重试");
if (!a) throw new Error(i);
if (!i) throw new Error(a);
const {status: u} = o;
return "BUILDING" === u || "PUSHING" === u ? e(t, n, r += 1) : o.packageSchema.replace(/&amp;/g, "&");
}(p, f.data.taskId, 1);
let g;
let h;
l({

@@ -1130,9 +1142,9 @@ status: "BUILD_SUCCESS"

const {qrcodeFormat: b} = n;
if ("base64" === b) g = await Object(s.c)(m); else if ("terminal" === b) g = await Object(s.b)(m); else {
const e = Object(a.defaultTo)(n.qrcodeOutput, o.a.resolve("mini.preview.png"));
await Object(s.a)(e, m), g = e;
if ("base64" === b) h = await Object(s.c)(m); else if ("terminal" === b) h = await Object(s.b)(m); else {
const e = Object(i.defaultTo)(n.qrcodeOutput, o.a.resolve("mini.preview.png"));
await Object(s.a)(e, m), h = e;
}
return {
schema: m,
qrcode: g
qrcode: h
};

@@ -1167,3 +1179,3 @@ }

}));
var r = n("oyvS"), o = n.n(r), a = n("mw/K"), i = n.n(a), c = n("6ndv"), s = n.n(c), u = n("TyI0"), p = n.n(u);
var r = n("oyvS"), o = n.n(r), i = n("mw/K"), a = n.n(i), c = n("6ndv"), s = n.n(c), u = n("TyI0"), p = n.n(u);
const l = console;

@@ -1184,3 +1196,3 @@ function d(e) {

}
static walk(e, t, n, r, a) {
static walk(e, t, n, r, i) {
this.doing += 1, s.a.readdir(o.a.join(t, n), (c, u) => {

@@ -1192,7 +1204,7 @@ if (this.doing -= 1, c) throw l.info("walk fs.readdir error: " + c.toString()),

const u = o.a.join(n, c), p = o.a.join(t, u);
this.doing += 1, i.a.lstat(p, (n, o) => {
this.doing += 1, a.a.lstat(p, (n, o) => {
if (this.doing -= 1, n) throw l.error("walk fs.stat error: " + n.toString()), 0 === this.doing && (this.taskLock = !1),
n;
if (o.isSymbolicLink()) 0 === this.doing && (this.taskLock = !1), this.isError = !0,
a(new Error(`目录存在软链接 ${p},打包失败,请使用 yarn install或者npm install --no-bin-links 安装依赖`)); else if (o.isDirectory()) this.walk(e, t, u, r, a); else if (o.isFile()) {
i(new Error(`目录存在软链接 ${p},打包失败,请使用 yarn install或者npm install --no-bin-links 安装依赖`)); else if (o.isDirectory()) this.walk(e, t, u, r, i); else if (o.isFile()) {
const e = Number(o.mtime), t = this.files[u], n = o.size;

@@ -1204,5 +1216,5 @@ this.fileNumber += 1, this.fileTotalSize += n, this.fileTotalSize >= this.MEMORY_LIMIT && (console.warn(`预热文件总大小${d(this.fileTotalSize)}MB, 超过限制${d(this.MEMORY_LIMIT)}MB, 请减少项目尺寸`),

0 === this.doing && (this.taskLock = !1), t;
const a = n > 0 ? o : Buffer.alloc(0);
const i = n > 0 ? o : Buffer.alloc(0);
this.files[u] = {
buffer: a,
buffer: i,
mtime: e,

@@ -1219,3 +1231,3 @@ version: this.version

static pack(e, t, n) {
const r = i.a.createWriteStream(e), a = ".zip" === o.a.extname(e) ? "zip" : "tar", c = p()(a, {
const r = a.a.createWriteStream(e), i = ".zip" === o.a.extname(e) ? "zip" : "tar", c = p()(i, {
gzip: !t,

@@ -1243,9 +1255,9 @@ gzipOptions: {}

function m(e, t, n, r) {
return new Promise((a, i) => {
return new Promise((i, a) => {
const c = o.a.join(t, n || (r ? "dist.tar" : "dist.tar.gz"));
const s = r || !1;
f.packProject(e, c, s, (function() {
a(c);
i(c);
}), (function(e) {
i(e);
a(e);
}));

@@ -1266,3 +1278,3 @@ });

n.d(t, "c", (function() {
return h;
return g;
})), n.d(t, "e", (function() {

@@ -1277,3 +1289,3 @@ return O;

}));
var r = n("Qc0G"), o = n.n(r), a = n("5tke"), i = n.n(a), c = n("mw/K"), s = n.n(c), u = n("oyvS"), p = n.n(u), l = n("NldC"), d = n("5ruT");
var r = n("Qc0G"), o = n.n(r), i = n("5tke"), a = n.n(i), c = n("mw/K"), s = n.n(c), u = n("oyvS"), p = n.n(u), l = n("NldC"), d = n("5ruT");
function f(e, t) {

@@ -1300,10 +1312,10 @@ var n = Object.keys(e);

}
function g() {
function h() {
return p.a.join(Object(l.d)(), "config.json");
}
let b = "SDK";
function h(e) {
function g(e) {
const t = Object(l.d)();
i.a.sync(t);
const n = g();
a.a.sync(t);
const n = h();
let r;

@@ -1340,3 +1352,3 @@ try {

return "CLI" === b ? await async function() {
const e = g();
const e = h();
try {

@@ -1355,5 +1367,5 @@ return await Object(d.b)(e);

"use strict";
var r = n("mw/K"), o = n.n(r), a = n("oyvS"), i = n.n(a), c = n("jK02"), s = n("YLtl"), u = n("yf2u"), p = n("VRxn"), l = n("eFfj"), d = n.n(l);
var r = n("mw/K"), o = n.n(r), i = n("oyvS"), a = n.n(i), c = n("jK02"), s = n("YLtl"), u = n("yf2u"), p = n("VRxn"), l = n("eFfj"), d = n.n(l);
var f = async function(e, t, n) {
const r = await d.a.Open.file(t), o = r.files.find(t => t.path === e + "/index.js") ? n : i.a.join(n, e);
const r = await d.a.Open.file(t), o = r.files.find(t => t.path === e + "/index.js") ? n : a.a.join(n, e);
return await r.extract({

@@ -1364,3 +1376,3 @@ path: o

t.a = async function(e) {
const {spaceId: t, name: n, path: r, appId: a, unzip: l = !1} = e, d = await Object(u.a)({
const {spaceId: t, name: n, path: r, appId: i, unzip: l = !1} = e, d = await Object(u.a)({
method: "GET",

@@ -1376,8 +1388,8 @@ host: "ide",

status: "",
appId: a
appId: i
}
});
if (Object(s.isEmpty)(d)) throw new Error(`云函数${n}没有部署记录`);
const m = i.a.join(r, n + ".zip"), g = Object(s.head)(d).downloadSignedUrl, b = await Object(p.a)({
link: g,
const m = a.a.join(r, n + ".zip"), h = Object(s.head)(d).downloadSignedUrl, b = await Object(p.a)({
link: h,
dist: m

@@ -1393,3 +1405,3 @@ });

}));
var r = n("YC6a"), o = n.n(r), a = n("kmL3"), i = n.n(a), c = n("iHmL"), s = n.n(c), u = n("YLtl"), p = n("1WQv"), l = n("oM9G");
var r = n("YC6a"), o = n.n(r), i = n("kmL3"), a = n.n(i), c = n("iHmL"), s = n.n(c), u = n("YLtl"), p = n("1WQv"), l = n("oM9G");
const d = Object(p.a)("http", !1);

@@ -1401,3 +1413,3 @@ function f(e, t) {

})), e.on("end", (function() {
const r = (e.headers["content-type"] || "").match(/charset=(.+)/), o = r ? r[1] : "utf8", a = Buffer.concat(n), c = i.a.decode(a, o);
const r = (e.headers["content-type"] || "").match(/charset=(.+)/), o = r ? r[1] : "utf8", i = Buffer.concat(n), c = a.a.decode(i, o);
try {

@@ -1411,40 +1423,42 @@ e.text = c, e.body = JSON.parse(c), t();

async function m(e) {
const {method: t, host: n, path: r, needSign: a, beforeSend: i} = e;
let c = "https://ideservice.alipay.com";
"openhome" === n && (c = "https://openhome.alipay.com");
const p = r.startsWith("http") ? r : c + r, m = s.a[t.toLowerCase()](p).set("referer", c).set("origin", c);
let g = e.data || {};
a && (g = await async function(e, t) {
const n = await Object(l.a)();
if (!n.privateKey || !n.toolId) return Promise.reject({
const t = await Object(l.a)(), {method: n, host: r, path: i, needSign: a, beforeSend: c} = e;
let p = t.endpoint || "https://ideservice.alipay.com";
"openhome" === r && (p = "https://openhome.alipay.com");
const m = i.startsWith("http") ? i : p + i, h = s.a[n.toLowerCase()](m).set("referer", p).set("origin", p);
let b = e.data || {};
if (a) {
if (!t.privateKey || !t.toolId) return Promise.reject({
code: "NOT_CONFIG_TOOL_KEY",
msg: "工具缺少初始化配置"
});
let r;
try {
r = new o.a(n.privateKey, "pkcs8-private-pem");
} catch (e) {
throw new Error("工具私钥配置错误,请重新运行alipaydev config set配置");
}
const a = new o.a(r.exportKey(), {
signingScheme: "pkcs1-sha256",
environment: "node"
}), i = {}, c = Object.keys(t).sort().map(e => {
let n = t[e];
return Object(u.isObject)(n) && (n = JSON.stringify(n)), i[e] = n, `${e}=${n}`;
}).join("&");
i.toolId = n.toolId, i.toolType = "CLI";
const s = a.sign(c).toString("base64");
return e.set("signType", "SHA256WithRSA"), e.set("sign", s), i;
}(m, g)), m.buffer(!0).parse(f), "GET" === t ? m.query(g) : "POST" === t && (m.type("form"),
Object(u.forOwn)(g, (function(e, t) {
m.field(t, e);
b = function(e, t, n, r) {
let i;
try {
i = new o.a(e, "pkcs8-private-pem");
} catch (e) {
throw new Error("工具私钥配置错误,请重新运行alipaydev config set配置");
}
const a = new o.a(i.exportKey(), {
signingScheme: "pkcs1-sha256",
environment: "node"
}), c = {}, s = Object.keys(r).sort().map(e => {
let t = r[e];
return Object(u.isObject)(t) && (t = JSON.stringify(t)), c[e] = t, `${e}=${t}`;
}).join("&");
c.toolId = t, c.toolType = "CLI";
const p = a.sign(s).toString("base64");
return n.set("signType", "SHA256WithRSA"), n.set("sign", p), c;
}(t.privateKey, t.toolId, h, b);
}
h.buffer(!0).parse(f), "GET" === n ? h.query(b) : "POST" === n && (h.type("form"),
Object(u.forOwn)(b, (function(e, t) {
h.field(t, e);
}))), d.info({
prefix: `${t} ${p} request`,
message: g
}), i && i(m);
prefix: `${n} ${m} request`,
message: b
}), c && c(h);
try {
const e = await m;
const e = await h;
if (d.verbose({
prefix: `${t} ${p} response`,
prefix: `${n} ${m} response`,
message: e.body

@@ -1455,6 +1469,6 @@ }), e.ok) return {

};
const n = Object(u.defaults)(e, {
const t = Object(u.defaults)(e, {
code: "SERVICE_RESPONSE_ERROR"
});
return Promise.reject(n);
return Promise.reject(t);
} catch (e) {

@@ -1471,3 +1485,3 @@ return Promise.reject({

"use strict";
var r = n("yf2u"), o = n("mw/K"), a = n.n(o), i = n("oyvS"), c = n.n(i), s = n("iHmL"), u = n.n(s), p = n("ly8A"), l = n("NldC");
var r = n("yf2u"), o = n("mw/K"), i = n.n(o), a = n("oyvS"), c = n.n(a), s = n("iHmL"), u = n.n(s), p = n("ly8A"), l = n("NldC");
async function d(e) {

@@ -1478,3 +1492,3 @@ const t = c.a.basename(e) + ".zip", n = await Object(l.j)();

t.a = async function(e) {
const {spaceId: t, name: n, project: o, desc: i = "", appId: s} = e, [p, l] = await Promise.all([ Object(r.a)({
const {spaceId: t, name: n, project: o, desc: a = "", appId: s} = e, [p, l] = await Promise.all([ Object(r.a)({
method: "GET",

@@ -1498,3 +1512,3 @@ host: "ide",

name: n,
desc: i,
desc: a,
appId: s

@@ -1517,4 +1531,4 @@ }

if (!f.success) throw new Error(f.message);
const {deploymentId: m, uploadSignedUrl: g} = f, b = g.replace(/&amp;/g, "&"), h = a.a.readFileSync(l);
await u.a.put(b).send(h).set("Content-Type", "application/octet-stream").set("Accept", "application/json").timeout({
const {deploymentId: m, uploadSignedUrl: h} = f, b = h.replace(/&amp;/g, "&"), g = i.a.readFileSync(l);
await u.a.put(b).send(g).set("Content-Type", "application/octet-stream").set("Accept", "application/json").timeout({
deadline: 6e4

@@ -1545,11 +1559,11 @@ }).catch(e => {

"use strict";
var r = n("oyvS"), o = n.n(r), a = n("6ndv"), i = n.n(a), c = n("YLtl"), s = n("5ruT");
var r = n("oyvS"), o = n.n(r), i = n("6ndv"), a = n.n(i), c = n("YLtl"), s = n("5ruT");
async function u(e) {
let t = e, n = !1;
const r = o.a.join(e, "mini.project.json"), a = await Object(s.b)(r).catch(() => "");
if (a && a.miniprogramRoot) t = o.a.join(e, a.miniprogramRoot), delete a.miniprogramRoot,
i.a.writeFileSync(o.a.join(t, "mini.project.json"), JSON.stringify(a), {
const r = o.a.join(e, "mini.project.json"), i = await Object(s.b)(r).catch(() => "");
if (i && i.miniprogramRoot) t = o.a.join(e, i.miniprogramRoot), delete i.miniprogramRoot,
a.a.writeFileSync(o.a.join(t, "mini.project.json"), JSON.stringify(i), {
encoding: "utf-8"
}), n = !0; else {
i.a.existsSync(o.a.join(e, "app.json")) || (t = o.a.join(e, "client"));
a.a.existsSync(o.a.join(e, "app.json")) || (t = o.a.join(e, "client"));
}

@@ -1566,3 +1580,3 @@ const c = o.a.join(t, "app.json"), u = await Object(s.b)(c);

const t = o.a.join(e, "mini.project.json");
i.a.unlink(t, c.noop);
a.a.unlink(t, c.noop);
}, t.a = u;

@@ -1569,0 +1583,0 @@ },

declare type BeforeSend = (req: any) => any;
export interface RequestOptions {
method: 'GET' | 'POST' | 'PUT';
url?: string;
host?: 'ide' | 'openhome';
path?: string;
path: string;
beforeSend?: BeforeSend;

@@ -8,0 +7,0 @@ data?: object;

{
"name": "alipay-dev",
"version": "0.4.2",
"version": "0.4.3",
"description": "支付宝开放平台命令工具箱,提供小程序开发过程中的各种便捷工具",

@@ -5,0 +5,0 @@ "bin": {

@@ -50,3 +50,3 @@ # 简介

```
alipaydev config set -i {工具id}
alipaydev config set -i 工具ID
```

@@ -53,0 +53,0 @@

@@ -11,2 +11,6 @@ interface Config {

/**
* 服务端地址
*/
endpoint?: string;
/**
* 当前小程序配置

@@ -41,2 +45,6 @@ */

privateKey: string;
/**
* 服务端地址
*/
endpoint?: string;
}

@@ -43,0 +51,0 @@ /**

Sorry, the diff of this file is too big to display