run402 1.47.0 → 1.48.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/package.json +1 -1
- package/sdk/dist/namespaces/functions.d.ts +6 -4
- package/sdk/dist/namespaces/functions.d.ts.map +1 -1
- package/sdk/dist/namespaces/functions.js +6 -4
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/functions.types.d.ts +41 -1
- package/sdk/dist/namespaces/functions.types.d.ts.map +1 -1
- package/core-dist/wallet-auth.js +0 -62
- package/core-dist/wallet.js +0 -25
- package/sdk/core-dist/wallet-auth.js +0 -62
- package/sdk/core-dist/wallet.js +0 -25
package/package.json
CHANGED
|
@@ -10,10 +10,12 @@ export declare class Functions {
|
|
|
10
10
|
private readonly client;
|
|
11
11
|
constructor(client: Client);
|
|
12
12
|
/**
|
|
13
|
-
* Deploy a serverless function.
|
|
14
|
-
* `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Deploy a serverless function. Deployed functions can
|
|
14
|
+
* `import { db, adminDb, getUser, email, ai } from "@run402/functions"` —
|
|
15
|
+
* the in-function helper library is provided by the platform.
|
|
16
|
+
*
|
|
17
|
+
* `opts.deps` is reserved for a follow-up release that will install
|
|
18
|
+
* user-supplied packages at deploy time; until then it has no effect.
|
|
17
19
|
*
|
|
18
20
|
* @throws {PaymentRequired} when the project lease has expired.
|
|
19
21
|
*/
|
|
@@ -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,sB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
|
|
@@ -11,10 +11,12 @@ export class Functions {
|
|
|
11
11
|
this.client = client;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Deploy a serverless function.
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Deploy a serverless function. Deployed functions can
|
|
15
|
+
* `import { db, adminDb, getUser, email, ai } from "@run402/functions"` —
|
|
16
|
+
* the in-function helper library is provided by the platform.
|
|
17
|
+
*
|
|
18
|
+
* `opts.deps` is reserved for a follow-up release that will install
|
|
19
|
+
* user-supplied packages at deploy time; until then it has no effect.
|
|
18
20
|
*
|
|
19
21
|
* @throws {PaymentRequired} when the project lease has expired.
|
|
20
22
|
*/
|
|
@@ -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;;;;;;;;;OASG;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,IAA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,eAAe,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QAExE,MAAM,IAAI,GAA4B,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/D,IAAI,IAAI,CAAC,OAAO,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"}
|
|
@@ -14,7 +14,12 @@ export interface FunctionDeployOptions {
|
|
|
14
14
|
/** Source code. TypeScript or JavaScript. Must `export default async (req: Request) => Response`. */
|
|
15
15
|
code: string;
|
|
16
16
|
config?: FunctionConfig;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Additional npm packages to bundle with the function. Reserved for a
|
|
19
|
+
* follow-up release that will install user-supplied packages at deploy
|
|
20
|
+
* time. Until then, only `@run402/functions` is available inside
|
|
21
|
+
* deployed functions; this field has no effect.
|
|
22
|
+
*/
|
|
18
23
|
deps?: string[];
|
|
19
24
|
/** Cron schedule (5-field). Omit to deploy without a schedule. */
|
|
20
25
|
schedule?: string | null;
|
|
@@ -28,6 +33,24 @@ export interface FunctionDeployResult {
|
|
|
28
33
|
memory: number;
|
|
29
34
|
schedule?: string | null;
|
|
30
35
|
created_at: string;
|
|
36
|
+
/**
|
|
37
|
+
* The version of `@run402/functions` bundled into the function at deploy
|
|
38
|
+
* time. Set when the function is deployed under the bundling-at-deploy
|
|
39
|
+
* regime (see the companion `drop-functions-layer-and-fix-deps` change).
|
|
40
|
+
* `null` (or omitted) for functions deployed before that change shipped.
|
|
41
|
+
*/
|
|
42
|
+
runtime_version?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Resolved direct user dependency versions from `--deps`. Map of dep
|
|
45
|
+
* name → actually-installed concrete version (NOT the user's spec
|
|
46
|
+
* string). `{}` when the function was deployed with empty `--deps` under
|
|
47
|
+
* the new regime; `null` (or omitted) for legacy functions.
|
|
48
|
+
*
|
|
49
|
+
* Direct dependencies only — transitive deps, integrity hashes, and
|
|
50
|
+
* peer-dep relationships are NOT included. This is "resolved direct
|
|
51
|
+
* dependency versions," not a lockfile.
|
|
52
|
+
*/
|
|
53
|
+
deps_resolved?: Record<string, string> | null;
|
|
31
54
|
}
|
|
32
55
|
export interface FunctionInvokeOptions {
|
|
33
56
|
/** HTTP method. Default `POST`. */
|
|
@@ -74,6 +97,19 @@ export interface FunctionSummary {
|
|
|
74
97
|
schedule_meta?: FunctionScheduleMeta | null;
|
|
75
98
|
created_at: string;
|
|
76
99
|
updated_at: string;
|
|
100
|
+
/**
|
|
101
|
+
* The version of `@run402/functions` bundled into the function at deploy
|
|
102
|
+
* time. `null` for functions deployed before the bundling-at-deploy
|
|
103
|
+
* regime (see the companion `drop-functions-layer-and-fix-deps` change).
|
|
104
|
+
*/
|
|
105
|
+
runtime_version?: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* Resolved direct user dependency versions from `--deps`. Map of dep
|
|
108
|
+
* name → actually-installed concrete version. `{}` for empty-deps
|
|
109
|
+
* deploys under the new regime; `null` for legacy functions.
|
|
110
|
+
* Direct deps only, not a full lockfile.
|
|
111
|
+
*/
|
|
112
|
+
deps_resolved?: Record<string, string> | null;
|
|
77
113
|
}
|
|
78
114
|
export interface FunctionListResult {
|
|
79
115
|
functions: FunctionSummary[];
|
|
@@ -92,5 +128,9 @@ export interface FunctionUpdateResult {
|
|
|
92
128
|
schedule: string | null;
|
|
93
129
|
schedule_meta: Record<string, unknown> | null;
|
|
94
130
|
updated_at: string;
|
|
131
|
+
/** See `FunctionSummary.runtime_version`. */
|
|
132
|
+
runtime_version?: string | null;
|
|
133
|
+
/** See `FunctionSummary.deps_resolved`. */
|
|
134
|
+
deps_resolved?: Record<string, string> | null;
|
|
95
135
|
}
|
|
96
136
|
//# sourceMappingURL=functions.types.d.ts.map
|
|
@@ -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,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,IAAI,EA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IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC/C"}
|
package/core-dist/wallet-auth.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
|
package/core-dist/wallet.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
package/sdk/core-dist/wallet.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|