run402 1.48.0 → 1.49.0
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/core-dist/wallet-auth.js +62 -0
- package/core-dist/wallet.js +25 -0
- package/lib/functions.mjs +16 -1
- package/package.json +1 -1
- package/sdk/core-dist/wallet-auth.js +62 -0
- package/sdk/core-dist/wallet.js +25 -0
- package/sdk/dist/namespaces/functions.d.ts +11 -3
- package/sdk/dist/namespaces/functions.d.ts.map +1 -1
- package/sdk/dist/namespaces/functions.js +11 -3
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/functions.types.d.ts +21 -4
- package/sdk/dist/namespaces/functions.types.d.ts.map +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — generates EIP-191 signature headers for Run402 API.
|
|
3
|
+
* Uses @noble/curves (lighter than viem) for signing.
|
|
4
|
+
*/
|
|
5
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
6
|
+
import { keccak_256 } from "@noble/hashes/sha3.js";
|
|
7
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
|
+
import { readWallet } from "./wallet.js";
|
|
9
|
+
/**
|
|
10
|
+
* EIP-191 personal_sign: sign a message with the wallet's private key.
|
|
11
|
+
*/
|
|
12
|
+
function personalSign(privateKeyHex, address, message) {
|
|
13
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
14
|
+
const prefix = new TextEncoder().encode(`\x19Ethereum Signed Message:\n${msgBytes.length}`);
|
|
15
|
+
const prefixed = new Uint8Array(prefix.length + msgBytes.length);
|
|
16
|
+
prefixed.set(prefix);
|
|
17
|
+
prefixed.set(msgBytes, prefix.length);
|
|
18
|
+
const hash = keccak_256(prefixed);
|
|
19
|
+
const pkHex = privateKeyHex.startsWith("0x")
|
|
20
|
+
? privateKeyHex.slice(2)
|
|
21
|
+
: privateKeyHex;
|
|
22
|
+
const pkBytes = Uint8Array.from(Buffer.from(pkHex, "hex"));
|
|
23
|
+
const rawSig = secp256k1.sign(hash, pkBytes);
|
|
24
|
+
const sig = secp256k1.Signature.fromBytes(rawSig);
|
|
25
|
+
// Determine recovery bit by trying both and matching the address
|
|
26
|
+
let recovery = 0;
|
|
27
|
+
for (const v of [0, 1]) {
|
|
28
|
+
try {
|
|
29
|
+
const recovered = sig.addRecoveryBit(v).recoverPublicKey(hash);
|
|
30
|
+
const pubBytes = recovered.toBytes(false).slice(1); // uncompressed, drop 04 prefix
|
|
31
|
+
const addrBytes = keccak_256(pubBytes).slice(-20);
|
|
32
|
+
if ("0x" + bytesToHex(addrBytes) === address.toLowerCase()) {
|
|
33
|
+
recovery = v;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const r = sig.r.toString(16).padStart(64, "0");
|
|
42
|
+
const s = sig.s.toString(16).padStart(64, "0");
|
|
43
|
+
const vHex = (recovery + 27).toString(16).padStart(2, "0");
|
|
44
|
+
return "0x" + r + s + vHex;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get wallet auth headers for the Run402 API.
|
|
48
|
+
* Returns null if no wallet is configured.
|
|
49
|
+
*/
|
|
50
|
+
export function getWalletAuthHeaders(walletPath) {
|
|
51
|
+
const wallet = readWallet(walletPath);
|
|
52
|
+
if (!wallet || !wallet.address || !wallet.privateKey)
|
|
53
|
+
return null;
|
|
54
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
55
|
+
const signature = personalSign(wallet.privateKey, wallet.address, `run402:${timestamp}`);
|
|
56
|
+
return {
|
|
57
|
+
"X-Run402-Wallet": wallet.address,
|
|
58
|
+
"X-Run402-Signature": signature,
|
|
59
|
+
"X-Run402-Timestamp": timestamp,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=wallet-auth.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { getWalletPath } from "./config.js";
|
|
5
|
+
export function readWallet(path) {
|
|
6
|
+
const p = path ?? getWalletPath();
|
|
7
|
+
if (!existsSync(p))
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(readFileSync(p, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function saveWallet(data, path) {
|
|
17
|
+
const p = path ?? getWalletPath();
|
|
18
|
+
const dir = dirname(p);
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
const tmp = join(dir, `.wallet.${randomBytes(4).toString("hex")}.tmp`);
|
|
21
|
+
writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
|
|
22
|
+
renameSync(tmp, p);
|
|
23
|
+
chmodSync(p, 0o600);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=wallet.js.map
|
package/lib/functions.mjs
CHANGED
|
@@ -53,7 +53,15 @@ Options:
|
|
|
53
53
|
--file <file> Required: path to the function source file
|
|
54
54
|
--timeout <s> Runtime timeout in seconds
|
|
55
55
|
--memory <mb> Memory in MB
|
|
56
|
-
--deps <
|
|
56
|
+
--deps <spec,...> Comma-separated npm specs to install and bundle.
|
|
57
|
+
Bare names (e.g. 'lodash') resolve to latest at
|
|
58
|
+
deploy time; pinned ('lodash@4.17.21') or range
|
|
59
|
+
('date-fns@^3.0.0') specs are honored verbatim.
|
|
60
|
+
'@run402/functions' is auto-bundled and is rejected
|
|
61
|
+
here; the legacy 'run402-functions' name is also
|
|
62
|
+
rejected. Max 30 entries, max 200 chars per spec.
|
|
63
|
+
Native binary modules (sharp, canvas, native bcrypt)
|
|
64
|
+
are rejected.
|
|
57
65
|
--schedule <cron> Cron schedule; pass '' to clear an existing schedule
|
|
58
66
|
|
|
59
67
|
Notes:
|
|
@@ -61,6 +69,13 @@ Notes:
|
|
|
61
69
|
export default async (req: Request) => Response
|
|
62
70
|
Deploy may require payment if the project lease has expired.
|
|
63
71
|
|
|
72
|
+
The deploy response includes:
|
|
73
|
+
- runtime_version: the bundled @run402/functions version (e.g. "1.48.0")
|
|
74
|
+
- deps_resolved: map of each --deps name to the actually-installed
|
|
75
|
+
concrete version (e.g. {"lodash":"4.17.21"})
|
|
76
|
+
- warnings (optional, top-level, sibling to the record): non-fatal
|
|
77
|
+
notes such as bundle-size advisories
|
|
78
|
+
|
|
64
79
|
Examples:
|
|
65
80
|
run402 functions deploy abc123 stripe-webhook --file handler.ts
|
|
66
81
|
run402 functions deploy abc123 send-reminders --file remind.ts \\
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet auth helper — generates EIP-191 signature headers for Run402 API.
|
|
3
|
+
* Uses @noble/curves (lighter than viem) for signing.
|
|
4
|
+
*/
|
|
5
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
6
|
+
import { keccak_256 } from "@noble/hashes/sha3.js";
|
|
7
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
|
+
import { readWallet } from "./wallet.js";
|
|
9
|
+
/**
|
|
10
|
+
* EIP-191 personal_sign: sign a message with the wallet's private key.
|
|
11
|
+
*/
|
|
12
|
+
function personalSign(privateKeyHex, address, message) {
|
|
13
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
14
|
+
const prefix = new TextEncoder().encode(`\x19Ethereum Signed Message:\n${msgBytes.length}`);
|
|
15
|
+
const prefixed = new Uint8Array(prefix.length + msgBytes.length);
|
|
16
|
+
prefixed.set(prefix);
|
|
17
|
+
prefixed.set(msgBytes, prefix.length);
|
|
18
|
+
const hash = keccak_256(prefixed);
|
|
19
|
+
const pkHex = privateKeyHex.startsWith("0x")
|
|
20
|
+
? privateKeyHex.slice(2)
|
|
21
|
+
: privateKeyHex;
|
|
22
|
+
const pkBytes = Uint8Array.from(Buffer.from(pkHex, "hex"));
|
|
23
|
+
const rawSig = secp256k1.sign(hash, pkBytes);
|
|
24
|
+
const sig = secp256k1.Signature.fromBytes(rawSig);
|
|
25
|
+
// Determine recovery bit by trying both and matching the address
|
|
26
|
+
let recovery = 0;
|
|
27
|
+
for (const v of [0, 1]) {
|
|
28
|
+
try {
|
|
29
|
+
const recovered = sig.addRecoveryBit(v).recoverPublicKey(hash);
|
|
30
|
+
const pubBytes = recovered.toBytes(false).slice(1); // uncompressed, drop 04 prefix
|
|
31
|
+
const addrBytes = keccak_256(pubBytes).slice(-20);
|
|
32
|
+
if ("0x" + bytesToHex(addrBytes) === address.toLowerCase()) {
|
|
33
|
+
recovery = v;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const r = sig.r.toString(16).padStart(64, "0");
|
|
42
|
+
const s = sig.s.toString(16).padStart(64, "0");
|
|
43
|
+
const vHex = (recovery + 27).toString(16).padStart(2, "0");
|
|
44
|
+
return "0x" + r + s + vHex;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get wallet auth headers for the Run402 API.
|
|
48
|
+
* Returns null if no wallet is configured.
|
|
49
|
+
*/
|
|
50
|
+
export function getWalletAuthHeaders(walletPath) {
|
|
51
|
+
const wallet = readWallet(walletPath);
|
|
52
|
+
if (!wallet || !wallet.address || !wallet.privateKey)
|
|
53
|
+
return null;
|
|
54
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
55
|
+
const signature = personalSign(wallet.privateKey, wallet.address, `run402:${timestamp}`);
|
|
56
|
+
return {
|
|
57
|
+
"X-Run402-Wallet": wallet.address,
|
|
58
|
+
"X-Run402-Signature": signature,
|
|
59
|
+
"X-Run402-Timestamp": timestamp,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=wallet-auth.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { getWalletPath } from "./config.js";
|
|
5
|
+
export function readWallet(path) {
|
|
6
|
+
const p = path ?? getWalletPath();
|
|
7
|
+
if (!existsSync(p))
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(readFileSync(p, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function saveWallet(data, path) {
|
|
17
|
+
const p = path ?? getWalletPath();
|
|
18
|
+
const dir = dirname(p);
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
const tmp = join(dir, `.wallet.${randomBytes(4).toString("hex")}.tmp`);
|
|
21
|
+
writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
|
|
22
|
+
renameSync(tmp, p);
|
|
23
|
+
chmodSync(p, 0o600);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -12,10 +12,18 @@ export declare class Functions {
|
|
|
12
12
|
/**
|
|
13
13
|
* Deploy a serverless function. Deployed functions can
|
|
14
14
|
* `import { db, adminDb, getUser, email, ai } from "@run402/functions"` —
|
|
15
|
-
* the in-function helper library is
|
|
15
|
+
* the in-function helper library is auto-bundled by the platform at the
|
|
16
|
+
* version recorded in {@link FunctionDeployResult.runtime_version}.
|
|
16
17
|
*
|
|
17
|
-
* `opts.deps`
|
|
18
|
-
*
|
|
18
|
+
* `opts.deps` lists additional npm packages to install and bundle. Bare
|
|
19
|
+
* names resolve to the latest published version at deploy time; pinned
|
|
20
|
+
* or range specs (`"lodash@4.17.21"`, `"date-fns@^3.0.0"`) are honored
|
|
21
|
+
* verbatim. The actually-installed concrete versions are returned in
|
|
22
|
+
* {@link FunctionDeployResult.deps_resolved}. `@run402/functions` and
|
|
23
|
+
* the deprecated `run402-functions` are rejected.
|
|
24
|
+
*
|
|
25
|
+
* Non-fatal deploy issues (bundle size warnings, esbuild advisories)
|
|
26
|
+
* surface in {@link FunctionDeployResult.warnings}.
|
|
19
27
|
*
|
|
20
28
|
* @throws {PaymentRequired} when the project lease has expired.
|
|
21
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuB3F;;;;OAIG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,oBAAoB,CAAC;IAgChC;;;OAGG;IACG,IAAI,CACR,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAiB9B,6CAA6C;IACvC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAa1D,kCAAkC;IAC5B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D;;;;OAIG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;CAuBjC"}
|
|
@@ -13,10 +13,18 @@ export class Functions {
|
|
|
13
13
|
/**
|
|
14
14
|
* Deploy a serverless function. Deployed functions can
|
|
15
15
|
* `import { db, adminDb, getUser, email, ai } from "@run402/functions"` —
|
|
16
|
-
* the in-function helper library is
|
|
16
|
+
* the in-function helper library is auto-bundled by the platform at the
|
|
17
|
+
* version recorded in {@link FunctionDeployResult.runtime_version}.
|
|
17
18
|
*
|
|
18
|
-
* `opts.deps`
|
|
19
|
-
*
|
|
19
|
+
* `opts.deps` lists additional npm packages to install and bundle. Bare
|
|
20
|
+
* names resolve to the latest published version at deploy time; pinned
|
|
21
|
+
* or range specs (`"lodash@4.17.21"`, `"date-fns@^3.0.0"`) are honored
|
|
22
|
+
* verbatim. The actually-installed concrete versions are returned in
|
|
23
|
+
* {@link FunctionDeployResult.deps_resolved}. `@run402/functions` and
|
|
24
|
+
* the deprecated `run402-functions` are rejected.
|
|
25
|
+
*
|
|
26
|
+
* Non-fatal deploy issues (bundle size warnings, esbuild advisories)
|
|
27
|
+
* surface in {@link FunctionDeployResult.warnings}.
|
|
20
28
|
*
|
|
21
29
|
* @throws {PaymentRequired} when the project lease has expired.
|
|
22
30
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/namespaces/functions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/C,MAAM,OAAO,SAAS;IACS;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/namespaces/functions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/C,MAAM,OAAO,SAAS;IACS;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,IAA2B;QACzD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,eAAe,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAEzE,MAAM,IAAI,GAA4B;YACpC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,IAAI,CA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,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5D,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;gBAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,sBAAsB,SAAS,cAAc,kBAAkB,CAAC,IAAI,CAAC,EAAE,EACvE;YACE,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,EAAE,EAAE;YAC3D,IAAI;YACJ,OAAO,EAAE,mBAAmB;SAC7B,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -15,10 +15,18 @@ export interface FunctionDeployOptions {
|
|
|
15
15
|
code: string;
|
|
16
16
|
config?: FunctionConfig;
|
|
17
17
|
/**
|
|
18
|
-
* Additional npm packages to bundle with the function.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Additional npm packages to bundle with the function. Each entry is an
|
|
19
|
+
* npm spec: a bare name (`"lodash"`) resolves to latest at deploy time;
|
|
20
|
+
* a pinned spec (`"lodash@4.17.21"`) uses that exact version; a range
|
|
21
|
+
* (`"date-fns@^3.0.0"`) is resolved by npm at deploy time.
|
|
22
|
+
*
|
|
23
|
+
* `@run402/functions` is auto-bundled and `run402-functions` is the
|
|
24
|
+
* deprecated package name — both are rejected with HTTP 400. Native
|
|
25
|
+
* binary modules (e.g. `sharp`, `canvas`) are rejected at install time.
|
|
26
|
+
* Limits: max 30 entries, max 200 chars per spec.
|
|
27
|
+
*
|
|
28
|
+
* The actually-installed concrete versions land in
|
|
29
|
+
* {@link FunctionDeployResult.deps_resolved}.
|
|
22
30
|
*/
|
|
23
31
|
deps?: string[];
|
|
24
32
|
/** Cron schedule (5-field). Omit to deploy without a schedule. */
|
|
@@ -51,6 +59,15 @@ export interface FunctionDeployResult {
|
|
|
51
59
|
* dependency versions," not a lockfile.
|
|
52
60
|
*/
|
|
53
61
|
deps_resolved?: Record<string, string> | null;
|
|
62
|
+
/**
|
|
63
|
+
* Non-fatal warnings surfaced during the deploy (e.g. bundle size
|
|
64
|
+
* exceeded the 10 MB recommended threshold but stayed under the 25 MB
|
|
65
|
+
* hard limit; esbuild emitted a warning about a non-literal dynamic
|
|
66
|
+
* import). Sibling to the function record at the top level of the
|
|
67
|
+
* response, NOT inside it. Omitted (or `[]`) when there are no
|
|
68
|
+
* warnings.
|
|
69
|
+
*/
|
|
70
|
+
warnings?: string[];
|
|
54
71
|
}
|
|
55
72
|
export interface FunctionInvokeOptions {
|
|
56
73
|
/** HTTP method. Default `POST`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB
|
|
1
|
+
{"version":3,"file":"functions.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,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