@mesadev/sdk 0.34.0 → 0.36.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/dist/api/access-token.d.ts +69 -0
- package/dist/api/access-token.d.ts.map +1 -0
- package/dist/api/access-token.js +96 -0
- package/dist/api/access-token.js.map +1 -0
- package/dist/api/client.d.ts +2 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/resources.d.ts +43 -1
- package/dist/api/resources.d.ts.map +1 -1
- package/dist/api/resources.js +11 -1
- package/dist/api/resources.js.map +1 -1
- package/dist/fs/mesa-file-system.d.ts +17 -2
- package/dist/fs/mesa-file-system.d.ts.map +1 -1
- package/dist/fs/mesa-file-system.js +10 -1
- package/dist/fs/mesa-file-system.js.map +1 -1
- package/dist/fs/native-loader.d.ts.map +1 -1
- package/dist/fs/native-loader.js +10 -81
- package/dist/fs/native-loader.js.map +1 -1
- package/dist/lib/errors.d.ts +9 -3
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +10 -4
- package/dist/lib/errors.js.map +1 -1
- package/dist/mesa.d.ts +27 -0
- package/dist/mesa.d.ts.map +1 -1
- package/dist/mesa.js +106 -34
- package/dist/mesa.js.map +1 -1
- package/package.json +5 -19
- package/dist/fs/key-cleanup.d.ts +0 -7
- package/dist/fs/key-cleanup.d.ts.map +0 -1
- package/dist/fs/key-cleanup.js +0 -70
- package/dist/fs/key-cleanup.js.map +0 -1
package/dist/fs/native-loader.js
CHANGED
|
@@ -1,98 +1,27 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const report = process.report?.getReport?.();
|
|
8
|
-
const header = report && typeof report === 'object' && 'header' in report ? report.header : undefined;
|
|
9
|
-
if (header && typeof header === 'object' && 'glibcVersionRuntime' in header) {
|
|
10
|
-
if (typeof header.glibcVersionRuntime === 'string' && header.glibcVersionRuntime.length > 0) {
|
|
11
|
-
return 'gnu';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const sharedObjects = report && typeof report === 'object' && 'sharedObjects' in report ? report.sharedObjects : undefined;
|
|
15
|
-
if (Array.isArray(sharedObjects)) {
|
|
16
|
-
if (sharedObjects.some((sharedObject) => sharedObject.includes('musl'))) {
|
|
17
|
-
return 'musl';
|
|
18
|
-
}
|
|
19
|
-
if (sharedObjects.some((sharedObject) => sharedObject.includes('glibc') || sharedObject.includes('ld-linux'))) {
|
|
20
|
-
return 'gnu';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
function getPackageSuffix() {
|
|
26
|
-
const { platform, arch } = process;
|
|
27
|
-
if (platform === 'darwin' && arch === 'arm64') {
|
|
28
|
-
return { suffix: 'darwin-arm64' };
|
|
29
|
-
}
|
|
30
|
-
if (platform !== 'linux') {
|
|
31
|
-
throw new Error(`Unsupported mesa-napi runtime: platform=${platform} arch=${arch}`);
|
|
32
|
-
}
|
|
33
|
-
const libc = detectLinuxLibc();
|
|
34
|
-
if (!libc) {
|
|
35
|
-
throw new Error('Unable to determine Linux libc for mesa-napi runtime selection.');
|
|
36
|
-
}
|
|
37
|
-
if (arch === 'x64') {
|
|
38
|
-
return { suffix: `linux-x64-${libc}`, libc };
|
|
39
|
-
}
|
|
40
|
-
if (arch === 'arm64') {
|
|
41
|
-
return { suffix: `linux-arm64-${libc}`, libc };
|
|
42
|
-
}
|
|
43
|
-
throw new Error(`Unsupported mesa-napi runtime: platform=${platform} arch=${arch} libc=${libc}`);
|
|
44
|
-
}
|
|
45
|
-
function getRuntimeTarget() {
|
|
46
|
-
const { suffix, libc } = getPackageSuffix();
|
|
47
|
-
return {
|
|
48
|
-
arch: process.arch,
|
|
49
|
-
libc,
|
|
50
|
-
packageName: `@mesadev/mesa-napi-${suffix}`,
|
|
51
|
-
platform: process.platform,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function createMissingNativeAddonError(target) {
|
|
55
|
-
return new Error(`Unable to load mesa-napi native addon. ` +
|
|
56
|
-
`Install the package for your platform: npm install ${target.packageName} ` +
|
|
57
|
-
`or set MESA_NAPI_PATH to a local .node file.`);
|
|
2
|
+
const NATIVE_PACKAGE_NAME = '@mesadev/mesafs-napi';
|
|
3
|
+
function createMissingNativeAddonError() {
|
|
4
|
+
return new Error(`Unable to load mesafs-napi native addon. ` +
|
|
5
|
+
`Build the local native package with pnpm --dir packages/rust/crates/mesafs-napi run build ` +
|
|
6
|
+
`or install ${NATIVE_PACKAGE_NAME}.`);
|
|
58
7
|
}
|
|
59
8
|
function loadFromEnvPath(require) {
|
|
60
9
|
const envPath = process.env.MESA_NAPI_PATH;
|
|
61
10
|
if (!envPath) {
|
|
62
11
|
return null;
|
|
63
12
|
}
|
|
64
|
-
|
|
65
|
-
return require(envPath);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (isRecoverableNativeLoadError(error)) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
13
|
+
return require(envPath);
|
|
73
14
|
}
|
|
74
|
-
function
|
|
15
|
+
function loadInstalledNativeAddon(require) {
|
|
75
16
|
try {
|
|
76
|
-
return require
|
|
17
|
+
return require(NATIVE_PACKAGE_NAME);
|
|
77
18
|
}
|
|
78
19
|
catch (error) {
|
|
79
20
|
if (error.code !== 'MODULE_NOT_FOUND') {
|
|
80
21
|
throw error;
|
|
81
22
|
}
|
|
82
23
|
}
|
|
83
|
-
|
|
84
|
-
return require.resolve(`${target.packageName}/${NATIVE_ADDON_FILENAME}`);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
if (error.code === 'MODULE_NOT_FOUND') {
|
|
88
|
-
throw createMissingNativeAddonError(target);
|
|
89
|
-
}
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function loadInstalledNativeAddon(require, target) {
|
|
94
|
-
const resolvedPath = resolveInstalledNativeAddonPath(require, target);
|
|
95
|
-
return require(resolvedPath);
|
|
24
|
+
throw createMissingNativeAddonError();
|
|
96
25
|
}
|
|
97
26
|
export function loadNativeAddon() {
|
|
98
27
|
const require = createRequire(import.meta.url);
|
|
@@ -100,6 +29,6 @@ export function loadNativeAddon() {
|
|
|
100
29
|
if (envAddon) {
|
|
101
30
|
return envAddon;
|
|
102
31
|
}
|
|
103
|
-
return loadInstalledNativeAddon(require
|
|
32
|
+
return loadInstalledNativeAddon(require);
|
|
104
33
|
}
|
|
105
34
|
//# sourceMappingURL=native-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-loader.js","sourceRoot":"","sources":["../../src/fs/native-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"native-loader.js","sourceRoot":"","sources":["../../src/fs/native-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AA0GnD,SAAS,6BAA6B;IACpC,OAAO,IAAI,KAAK,CACd,2CAA2C;QACzC,4FAA4F;QAC5F,cAAc,mBAAmB,GAAG,CACvC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAAoB;IAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAE3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAiB,CAAC;AAC1C,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAoB;IACpD,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,mBAAmB,CAAiB,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACjE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM,6BAA6B,EAAE,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/C,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type MesaErrorCode = 'INVALID_API_URL' | 'INVALID_OPTIONS' | '
|
|
1
|
+
export type MesaErrorCode = 'INVALID_API_URL' | 'INVALID_OPTIONS' | 'MISSING_CREDENTIAL' | 'MISSING_WEBHOOK_SECRET' | 'ORG_RESOLUTION_FAILED' | 'WEBHOOK_VERIFICATION_FAILED';
|
|
2
2
|
export declare class MesaError extends Error {
|
|
3
3
|
readonly code: MesaErrorCode;
|
|
4
4
|
constructor(code: MesaErrorCode, message: string, options?: ErrorOptions);
|
|
@@ -18,9 +18,15 @@ export declare class MesaApiError extends Error {
|
|
|
18
18
|
readonly status?: number;
|
|
19
19
|
constructor({ body, cause, code, headers, message, status }: MesaApiErrorOptions);
|
|
20
20
|
}
|
|
21
|
-
export declare class
|
|
22
|
-
constructor(
|
|
21
|
+
export declare class MissingCredentialError extends MesaError {
|
|
22
|
+
constructor(apiKeyEnvVar?: string);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Renamed to {@link MissingCredentialError}. This alias points at the
|
|
26
|
+
* same class, so `instanceof MissingApiKeyError` and `instanceof MissingCredentialError`
|
|
27
|
+
* are interchangeable. Prefer `MissingCredentialError`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MissingApiKeyError: typeof MissingCredentialError;
|
|
24
30
|
export declare class InvalidApiUrlError extends MesaError {
|
|
25
31
|
constructor(apiUrl: string);
|
|
26
32
|
}
|
package/dist/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,6BAA6B,CAAC;AAElC,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;gBAEjB,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKzE;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,mBAAmB;CAQjF;AAED,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,YAAY,SAAiB;CAI1C;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,+BAAyB,CAAC;AAEzD,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,MAAM,EAAE,MAAM;CAI3B;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,4BAA6B,SAAQ,SAAS;gBAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,yBAA0B,SAAQ,SAAS;;CAKvD"}
|
package/dist/lib/errors.js
CHANGED
|
@@ -20,12 +20,18 @@ export class MesaApiError extends Error {
|
|
|
20
20
|
this.status = status;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export class
|
|
24
|
-
constructor(
|
|
25
|
-
super('
|
|
26
|
-
this.name = '
|
|
23
|
+
export class MissingCredentialError extends MesaError {
|
|
24
|
+
constructor(apiKeyEnvVar = 'MESA_API_KEY') {
|
|
25
|
+
super('MISSING_CREDENTIAL', `Missing API key. Pass \`apiKey\` or set \`${apiKeyEnvVar}\` in your environment.`);
|
|
26
|
+
this.name = 'MissingCredentialError';
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Renamed to {@link MissingCredentialError}. This alias points at the
|
|
31
|
+
* same class, so `instanceof MissingApiKeyError` and `instanceof MissingCredentialError`
|
|
32
|
+
* are interchangeable. Prefer `MissingCredentialError`.
|
|
33
|
+
*/
|
|
34
|
+
export const MissingApiKeyError = MissingCredentialError;
|
|
29
35
|
export class InvalidApiUrlError extends MesaError {
|
|
30
36
|
constructor(apiUrl) {
|
|
31
37
|
super('INVALID_API_URL', `Invalid API URL: ${apiUrl}`);
|
package/dist/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAgB;IAE7B,YAAY,IAAmB,EAAE,OAAe,EAAE,OAAsB;QACtE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAWD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAW;IACf,IAAI,CAAU;IACd,OAAO,CAAW;IAClB,MAAM,CAAU;IAEzB,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAuB;QAC9E,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAgB;IAE7B,YAAY,IAAmB,EAAE,OAAe,EAAE,OAAsB;QACtE,KAAK,CAAC,OAAO,EAAE,OAAO,CA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AClC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,uBAAuB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IACzD,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IACtD;QACE,KAAK,CAAC,wBAAwB,EAAE,uEAAuE,CAAC,CAAC;QACzG,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/mesa.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import type { WhoamiResponse } from '@mesadev/rest';
|
|
|
2
2
|
import { type ApiResources } from './api/resources.js';
|
|
3
3
|
import { MesaFileSystem, type RepoConfig, type TelemetryConfig } from './fs/mesa-file-system.js';
|
|
4
4
|
export interface MesaOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Long-lived API key (`mesa_...`). The client signs short-lived access tokens
|
|
7
|
+
* locally (no network round-trip) for filesystem mounts and requests. Required
|
|
8
|
+
* unless `MESA_API_KEY` is set in the environment.
|
|
9
|
+
*/
|
|
5
10
|
apiKey?: string;
|
|
6
11
|
apiUrl?: string;
|
|
7
12
|
vcsUrl?: string;
|
|
@@ -19,12 +24,21 @@ export interface FsMountOptions {
|
|
|
19
24
|
};
|
|
20
25
|
};
|
|
21
26
|
telemetry?: TelemetryConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Lifetime of the mount, in seconds. The mount mints a single access token
|
|
29
|
+
* with this TTL and uses it for its whole lifetime; there is no refresh, so
|
|
30
|
+
* once the token expires the mount fails closed with auth errors. Capped at
|
|
31
|
+
* 24h (86400) by the signer. Defaults to {@link ACCESS_TOKEN_DEFAULT_TTL_SECONDS}.
|
|
32
|
+
*/
|
|
33
|
+
ttl?: number;
|
|
22
34
|
}
|
|
23
35
|
export declare class Mesa {
|
|
36
|
+
/** The API key this client was constructed with. */
|
|
24
37
|
readonly apiKey: string;
|
|
25
38
|
readonly apiUrl: string;
|
|
26
39
|
readonly vcsUrl: string;
|
|
27
40
|
readonly org: ApiResources['org'];
|
|
41
|
+
readonly tokens: ApiResources['tokens'];
|
|
28
42
|
readonly apiKeys: ApiResources['apiKeys'];
|
|
29
43
|
readonly repos: ApiResources['repos'];
|
|
30
44
|
readonly content: ApiResources['content'];
|
|
@@ -36,15 +50,28 @@ export declare class Mesa {
|
|
|
36
50
|
readonly fs: {
|
|
37
51
|
mount: (options: FsMountOptions) => Promise<MesaFileSystem>;
|
|
38
52
|
};
|
|
53
|
+
private readonly credential;
|
|
39
54
|
private readonly restClient;
|
|
40
55
|
private readonly orgResolutionPromise;
|
|
41
56
|
private readonly whoAmIResolutionPromise;
|
|
42
57
|
private cachedOrgSlug;
|
|
43
58
|
private cachedWhoAmI;
|
|
59
|
+
private cachedKeyId;
|
|
60
|
+
private keyIdResolutionPromise;
|
|
44
61
|
constructor(options?: MesaOptions);
|
|
62
|
+
private createFs;
|
|
45
63
|
resolveOrg(org?: string): Promise<string>;
|
|
46
64
|
whoami(): Promise<WhoamiResponse>;
|
|
47
65
|
private fetchWhoAmI;
|
|
66
|
+
/**
|
|
67
|
+
* Resolve and cache this client's API key id, needed to build the access
|
|
68
|
+
* token `kid` header. Sourced from GET /whoami, which returns the id of the
|
|
69
|
+
* key the request authenticated with. Lazily fetched and cached for the life
|
|
70
|
+
* of the client.
|
|
71
|
+
*/
|
|
72
|
+
private resolveKeyId;
|
|
73
|
+
/** Sign an access token locally from the raw API key this client holds. */
|
|
74
|
+
private signToken;
|
|
48
75
|
private resolveOrgFromWhoAmI;
|
|
49
76
|
}
|
|
50
77
|
//# sourceMappingURL=mesa.d.ts.map
|
package/dist/mesa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesa.d.ts","sourceRoot":"","sources":["../src/mesa.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"mesa.d.ts","sourceRoot":"","sources":["../src/mesa.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EAEd,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAoDlC,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,CAAC;IACF,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,IAAI;IACf,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,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GAAG,OAAO,CAAC,MAAM,CAAC;IAYzC,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;YAazB,WAAW;IAUzB;;;;;OAKG;YACW,YAAY;IAyB1B,2EAA2E;YAC7D,SAAS;YAkBT,oBAAoB;CAWnC"}
|
package/dist/mesa.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import { ACCESS_TOKEN_DEFAULT_TTL_SECONDS, signAccessToken } from './api/access-token.js';
|
|
1
2
|
import { createRestClient } from './api/client.js';
|
|
2
|
-
import { createApiResources } from './api/resources.js';
|
|
3
|
-
import { trackMintedKey } from './fs/key-cleanup.js';
|
|
3
|
+
import { createApiResources, } from './api/resources.js';
|
|
4
4
|
import { MesaFileSystem, } from './fs/mesa-file-system.js';
|
|
5
|
-
import { InvalidApiUrlError, InvalidOptionsError,
|
|
5
|
+
import { InvalidApiUrlError, InvalidOptionsError, MissingCredentialError, OrgResolutionError } from './lib/errors.js';
|
|
6
6
|
const DEFAULT_API_URL = 'https://api.mesa.dev/v1';
|
|
7
7
|
const DEFAULT_VCS_URL = 'https://vcs.mesa.dev';
|
|
8
8
|
const API_KEY_ENV_VAR = 'MESA_API_KEY';
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Default requested scopes when a caller does not specify any (used both for
|
|
11
|
+
* `tokens.create` and for filesystem mounts). The server clamps these to the
|
|
12
|
+
* key's actual scopes at verify time, so requesting the full set just means "as
|
|
13
|
+
* much as this key allows"; per-repo read-only is enforced client-side.
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_TOKEN_SCOPES = ['read', 'write'];
|
|
16
|
+
function getEnvVar(name) {
|
|
10
17
|
if (typeof process === 'undefined') {
|
|
11
18
|
return undefined;
|
|
12
19
|
}
|
|
13
|
-
return process.env[
|
|
20
|
+
return process.env[name]?.trim();
|
|
14
21
|
}
|
|
15
22
|
function normalizeUrl(input) {
|
|
16
23
|
let parsed;
|
|
@@ -26,18 +33,25 @@ function normalizeUrl(input) {
|
|
|
26
33
|
parsed.pathname = parsed.pathname.replace(/\/+$/, '') || '/';
|
|
27
34
|
return parsed.toString().replace(/\/$/, '');
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the client's API key from explicit options or the environment. The
|
|
38
|
+
* SDK client is always constructed from an API key — it signs the short-lived
|
|
39
|
+
* access tokens that mounts and requests run on.
|
|
40
|
+
*/
|
|
41
|
+
function resolveApiKey(options) {
|
|
42
|
+
const apiKey = options.apiKey?.trim() || getEnvVar(API_KEY_ENV_VAR);
|
|
43
|
+
if (apiKey) {
|
|
44
|
+
return apiKey;
|
|
33
45
|
}
|
|
34
|
-
|
|
46
|
+
throw new MissingCredentialError(API_KEY_ENV_VAR);
|
|
35
47
|
}
|
|
36
48
|
export class Mesa {
|
|
49
|
+
/** The API key this client was constructed with. */
|
|
37
50
|
apiKey;
|
|
38
51
|
apiUrl;
|
|
39
52
|
vcsUrl;
|
|
40
53
|
org;
|
|
54
|
+
tokens;
|
|
41
55
|
apiKeys;
|
|
42
56
|
repos;
|
|
43
57
|
content;
|
|
@@ -47,17 +61,21 @@ export class Mesa {
|
|
|
47
61
|
webhookTargets;
|
|
48
62
|
webhooks;
|
|
49
63
|
fs;
|
|
64
|
+
credential;
|
|
50
65
|
restClient;
|
|
51
66
|
orgResolutionPromise;
|
|
52
67
|
whoAmIResolutionPromise;
|
|
53
68
|
cachedOrgSlug = null;
|
|
54
69
|
cachedWhoAmI = null;
|
|
70
|
+
cachedKeyId = null;
|
|
71
|
+
keyIdResolutionPromise = null;
|
|
55
72
|
constructor(options = {}) {
|
|
56
|
-
this.apiKey = resolveApiKey(options
|
|
73
|
+
this.apiKey = resolveApiKey(options);
|
|
74
|
+
this.credential = this.apiKey;
|
|
57
75
|
this.apiUrl = normalizeUrl(options.apiUrl?.trim() || DEFAULT_API_URL);
|
|
58
76
|
this.vcsUrl = normalizeUrl(options.vcsUrl?.trim() || DEFAULT_VCS_URL);
|
|
59
77
|
this.restClient = createRestClient({
|
|
60
|
-
|
|
78
|
+
credential: this.credential,
|
|
61
79
|
apiUrl: this.apiUrl,
|
|
62
80
|
fetch: options.fetch,
|
|
63
81
|
userAgent: options.userAgent,
|
|
@@ -78,8 +96,10 @@ export class Mesa {
|
|
|
78
96
|
restClient: this.restClient,
|
|
79
97
|
resolveOrg: (org) => this.resolveOrg(org),
|
|
80
98
|
webhookSecret: options.webhookSecret,
|
|
99
|
+
signToken: (input) => this.signToken(input),
|
|
81
100
|
});
|
|
82
101
|
this.org = resources.org;
|
|
102
|
+
this.tokens = resources.tokens;
|
|
83
103
|
this.apiKeys = resources.apiKeys;
|
|
84
104
|
this.repos = resources.repos;
|
|
85
105
|
this.content = resources.content;
|
|
@@ -94,31 +114,35 @@ export class Mesa {
|
|
|
94
114
|
throw new InvalidOptionsError('mesa.fs.mount() requires at least one repo');
|
|
95
115
|
}
|
|
96
116
|
const org = await this.resolveOrg();
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
repo_ids: repoIds,
|
|
106
|
-
});
|
|
107
|
-
const config = {
|
|
117
|
+
// Scope the token to the mounted repos as full `org/repo` names. The
|
|
118
|
+
// server resolves names → ids at verify time, so no network call is
|
|
119
|
+
// needed to resolve ids here.
|
|
120
|
+
const repos = fsOptions.repos.map((r) => `${org}/${r.name}`);
|
|
121
|
+
// Mint a single access token for the mount's whole lifetime. There is no
|
|
122
|
+
// refresh and no credential hot-swap: when the token expires, the mount
|
|
123
|
+
// expires with it.
|
|
124
|
+
const { token } = await this.tokens.create({
|
|
108
125
|
org,
|
|
109
|
-
|
|
110
|
-
repos
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
telemetry: fsOptions.telemetry,
|
|
115
|
-
};
|
|
116
|
-
const fs = MesaFileSystem.create(config);
|
|
117
|
-
trackMintedKey(fs, id, (input) => this.apiKeys.revoke(input));
|
|
118
|
-
return fs;
|
|
126
|
+
scopes: DEFAULT_TOKEN_SCOPES,
|
|
127
|
+
repos,
|
|
128
|
+
ttl_seconds: fsOptions.ttl ?? ACCESS_TOKEN_DEFAULT_TTL_SECONDS,
|
|
129
|
+
});
|
|
130
|
+
return this.createFs(org, fsOptions, token);
|
|
119
131
|
},
|
|
120
132
|
};
|
|
121
133
|
}
|
|
134
|
+
createFs(org, fsOptions, credential) {
|
|
135
|
+
const config = {
|
|
136
|
+
org,
|
|
137
|
+
credential,
|
|
138
|
+
repos: fsOptions.repos,
|
|
139
|
+
cache: fsOptions.cache,
|
|
140
|
+
apiBaseUrl: this.apiUrl,
|
|
141
|
+
vcsUrl: this.vcsUrl,
|
|
142
|
+
telemetry: fsOptions.telemetry,
|
|
143
|
+
};
|
|
144
|
+
return MesaFileSystem.create(config);
|
|
145
|
+
}
|
|
122
146
|
async resolveOrg(org) {
|
|
123
147
|
if (org?.trim()) {
|
|
124
148
|
return org;
|
|
@@ -144,15 +168,63 @@ export class Mesa {
|
|
|
144
168
|
const whoami = await this.restClient.whoami();
|
|
145
169
|
this.cachedWhoAmI = whoami;
|
|
146
170
|
this.cachedOrgSlug = whoami.org.slug;
|
|
171
|
+
if (whoami.key_id) {
|
|
172
|
+
this.cachedKeyId = whoami.key_id;
|
|
173
|
+
}
|
|
147
174
|
return whoami;
|
|
148
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Resolve and cache this client's API key id, needed to build the access
|
|
178
|
+
* token `kid` header. Sourced from GET /whoami, which returns the id of the
|
|
179
|
+
* key the request authenticated with. Lazily fetched and cached for the life
|
|
180
|
+
* of the client.
|
|
181
|
+
*/
|
|
182
|
+
async resolveKeyId() {
|
|
183
|
+
if (this.cachedKeyId) {
|
|
184
|
+
return this.cachedKeyId;
|
|
185
|
+
}
|
|
186
|
+
// Dedupe concurrent signs: without this, each in-flight call would kick off
|
|
187
|
+
// its own /whoami. Reuse the constructor's whoami when present (no explicit
|
|
188
|
+
// org), otherwise share a single lazy fetch across all callers.
|
|
189
|
+
this.keyIdResolutionPromise ??= (this.whoAmIResolutionPromise ?? this.fetchWhoAmI())
|
|
190
|
+
.then((whoami) => {
|
|
191
|
+
if (!whoami.key_id) {
|
|
192
|
+
throw new OrgResolutionError('Unable to resolve API key id from /whoami; cannot sign access tokens.');
|
|
193
|
+
}
|
|
194
|
+
this.cachedKeyId = whoami.key_id;
|
|
195
|
+
return whoami.key_id;
|
|
196
|
+
})
|
|
197
|
+
.catch((error) => {
|
|
198
|
+
// Allow a later sign to retry rather than caching the failure forever.
|
|
199
|
+
this.keyIdResolutionPromise = null;
|
|
200
|
+
throw error;
|
|
201
|
+
});
|
|
202
|
+
return this.keyIdResolutionPromise;
|
|
203
|
+
}
|
|
204
|
+
/** Sign an access token locally from the raw API key this client holds. */
|
|
205
|
+
async signToken(input) {
|
|
206
|
+
const keyId = await this.resolveKeyId();
|
|
207
|
+
const signed = signAccessToken({
|
|
208
|
+
apiKeyId: keyId,
|
|
209
|
+
rawApiKey: this.apiKey,
|
|
210
|
+
scopes: input.scopes ?? [...DEFAULT_TOKEN_SCOPES],
|
|
211
|
+
repos: input.repos ?? null,
|
|
212
|
+
ttlSeconds: input.ttl_seconds,
|
|
213
|
+
});
|
|
214
|
+
return {
|
|
215
|
+
token: signed.token,
|
|
216
|
+
expires_at: signed.expiresAt,
|
|
217
|
+
scopes: signed.scopes,
|
|
218
|
+
repos: signed.repos,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
149
221
|
async resolveOrgFromWhoAmI(whoAmIPromise) {
|
|
150
222
|
try {
|
|
151
223
|
const whoami = await whoAmIPromise;
|
|
152
224
|
return whoami.org.slug;
|
|
153
225
|
}
|
|
154
226
|
catch (error) {
|
|
155
|
-
throw new OrgResolutionError('Unable to resolve default organization from /whoami. Provide `org` per call or verify your
|
|
227
|
+
throw new OrgResolutionError('Unable to resolve default organization from /whoami. Provide `org` per call or verify your credential scopes.', { cause: error });
|
|
156
228
|
}
|
|
157
229
|
}
|
|
158
230
|
}
|
package/dist/mesa.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesa.js","sourceRoot":"","sources":["../src/mesa.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mesa.js","sourceRoot":"","sources":["../src/mesa.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAEL,kBAAkB,GAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,GAIf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEtH,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAClD,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAC/C,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,oBAAoB,GAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElE,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,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AK;YACf,SAAS,EAAE,IAAI,CAAC,MAAM;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,oBAAoB,CAAC;YACjD,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;YAC1B,UAAU,EAAE,KAAK,CAAC,WAAW;SAC9B,CAAC,CAAC;QAEH,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,aAAsC;QACvE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;YACnC,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAC1B,+GAA+G,EAC/G,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mesadev/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Official Mesa TypeScript SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"node": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@mesadev/
|
|
28
|
+
"@mesadev/mesafs-napi": "0.36.0",
|
|
29
|
+
"@mesadev/rest": "0.36.0",
|
|
29
30
|
"just-bash": "^2.13.0",
|
|
30
31
|
"zod": "^4.3.6"
|
|
31
32
|
},
|
|
@@ -40,24 +41,9 @@
|
|
|
40
41
|
"homepage": "https://mesa.dev",
|
|
41
42
|
"author": "Mesa",
|
|
42
43
|
"license": "Apache-2.0",
|
|
43
|
-
"optionalDependencies": {
|
|
44
|
-
"@mesadev/mesa-napi-darwin-arm64": "^0.34.0",
|
|
45
|
-
"@mesadev/mesa-napi-linux-x64-gnu": "^0.34.0",
|
|
46
|
-
"@mesadev/mesa-napi-linux-x64-musl": "^0.34.0",
|
|
47
|
-
"@mesadev/mesa-napi-linux-arm64-gnu": "^0.34.0",
|
|
48
|
-
"@mesadev/mesa-napi-linux-arm64-musl": "^0.34.0"
|
|
49
|
-
},
|
|
50
44
|
"scripts": {
|
|
51
|
-
"clean": "rm -rf dist tsconfig.build.tsbuildinfo",
|
|
52
|
-
"build": "pnpm run clean && pnpm --dir ../rest/ts run build && tsc -b tsconfig.build.json",
|
|
53
45
|
"typecheck": "pnpm --dir ../rest/ts run build && tsc --noEmit -p tsconfig.typecheck.json",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"fmt": "oxfmt --config ../../../.oxfmtrc.json --write",
|
|
57
|
-
"fmt:ci": "oxfmt --config ../../../.oxfmtrc.json --check",
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"test:integration": "vitest run integration",
|
|
60
|
-
"test:unit": "pnpm --dir ../rest/ts run build && vitest run --exclude='**/*.integration.test.ts' --exclude='**/native-loader.test.ts'",
|
|
61
|
-
"test:native-loader": "pnpm run build && vitest run test/native-loader.test.ts"
|
|
46
|
+
"clean": "rm -rf dist",
|
|
47
|
+
"build": "pnpm run clean && pnpm --dir ../rest/ts run build && tsc -b tsconfig.build.json"
|
|
62
48
|
}
|
|
63
49
|
}
|
package/dist/fs/key-cleanup.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type RevokeKey = (input: {
|
|
2
|
-
id: string;
|
|
3
|
-
}) => Promise<unknown>;
|
|
4
|
-
export declare function trackMintedKey(fsInstance: object, id: string, revoke: RevokeKey): void;
|
|
5
|
-
export declare function revokeAllActiveKeys(): Promise<void>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=key-cleanup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key-cleanup.d.ts","sourceRoot":"","sources":["../../src/fs/key-cleanup.ts"],"names":[],"mappings":"AAqBA,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAsB7D,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAItF;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAIzD"}
|