@mastra/deployer-cloud 0.14.2-alpha.2

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.
@@ -0,0 +1,24 @@
1
+ export declare function detectPm({ path }: {
2
+ path: string;
3
+ }): string;
4
+ export declare function installNodeVersion({ path }: {
5
+ path: string;
6
+ }): Promise<void>;
7
+ export declare function installDeps({ path, pm }: {
8
+ path: string;
9
+ pm?: string;
10
+ }): Promise<void>;
11
+ export declare function runInstallCommand({ path, installCommand }: {
12
+ path: string;
13
+ installCommand: string;
14
+ }): Promise<void>;
15
+ export declare function runScript({ scriptName, path, args }: {
16
+ scriptName: string;
17
+ path: string;
18
+ args?: string[];
19
+ }): Promise<void>;
20
+ export declare function runBuildCommand({ command, path }: {
21
+ command: string;
22
+ path: string;
23
+ }): Promise<void>;
24
+ //# sourceMappingURL=deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/utils/deps.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CA2B3D;AAED,wBAAsB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,iBAoClE;AAED,wBAAsB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,iBAe5E;AAED,wBAAsB,iBAAiB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,iBAazG;AAED,wBAAsB,SAAS,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,iBAkBhH;AAED,wBAAsB,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,iBAazF"}
@@ -0,0 +1,18 @@
1
+ import { Transform } from 'stream';
2
+ export declare const createPinoStream: () => Transform;
3
+ export declare function runWithExeca({ cmd, args, cwd, env, }: {
4
+ cmd: string;
5
+ args: string[];
6
+ cwd?: string;
7
+ env?: Record<string, string>;
8
+ }): Promise<{
9
+ stdout?: string;
10
+ stderr?: string;
11
+ success: boolean;
12
+ error?: Error;
13
+ }>;
14
+ export declare function runWithChildProcess(cmd: string, args: string[]): {
15
+ stdout?: string;
16
+ stderr?: string;
17
+ };
18
+ //# sourceMappingURL=execa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execa.d.ts","sourceRoot":"","sources":["../../src/utils/execa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAKnC,eAAO,MAAM,gBAAgB,iBAe5B,CAAC;AAEF,wBAAsB,YAAY,CAAC,EACjC,GAAG,EACH,IAAI,EACJ,GAAmB,EACnB,GAAsB,GACvB,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAsBjF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CA6BrG"}
@@ -0,0 +1,2 @@
1
+ export declare function getMastraEntryFile(mastraDir: string): string;
2
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/utils/file.ts"],"names":[],"mappings":"AAMA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,UAiBnD"}
@@ -0,0 +1,45 @@
1
+ import type { TransformCallback } from 'stream';
2
+ import type { BaseLogMessage, LogLevel } from '@mastra/core/logger';
3
+ import { LoggerTransport } from '@mastra/core/logger';
4
+ import { PinoLogger } from '@mastra/loggers';
5
+ declare class RedisTransport extends LoggerTransport {
6
+ _transform(chunk: any, _encoding: string, callback: TransformCallback): void;
7
+ _write(chunk: any, encoding?: string, callback?: (error?: Error | null) => void): boolean;
8
+ _flush(): Promise<void>;
9
+ _destroy(err: Error, cb: Function): Promise<void>;
10
+ getLogs(_args: {
11
+ fromDate?: Date;
12
+ toDate?: Date;
13
+ logLevel?: LogLevel;
14
+ filters?: Record<string, any>;
15
+ returnPaginationResults?: boolean;
16
+ page?: number;
17
+ perPage?: number;
18
+ }): Promise<{
19
+ logs: BaseLogMessage[];
20
+ total: number;
21
+ page: number;
22
+ perPage: number;
23
+ hasMore: boolean;
24
+ }>;
25
+ getLogsByRunId(_args?: {
26
+ fromDate?: Date;
27
+ toDate?: Date;
28
+ logLevel?: LogLevel;
29
+ filters?: Record<string, any>;
30
+ returnPaginationResults?: boolean;
31
+ page?: number;
32
+ perPage?: number;
33
+ }): Promise<{
34
+ logs: BaseLogMessage[];
35
+ total: number;
36
+ page: number;
37
+ perPage: number;
38
+ hasMore: boolean;
39
+ }>;
40
+ }
41
+ export declare const transport: RedisTransport;
42
+ export declare const closeLogger: () => Promise<void>;
43
+ export declare const logger: P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AC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAUvG,cAAc,CAAC,KAAK,CAAC,EAAE;QACrB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC;QACV,IAAI,EAAE,cAAc,EAAE,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CASH;AAED,eAAO,MAAM,SAAS,gBAAuB,CAAC;AAE9C,eAAO,MAAM,WAAW,qBAMvB,CAAC;AAEF,eAAO,MAAM,MAAM,YAKjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function successEntrypoint(): string;
2
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/utils/report.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,WAuBhC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@mastra/deployer-cloud",
3
+ "version": "0.14.2-alpha.2",
4
+ "description": "",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "templates"
9
+ ],
10
+ "main": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "keywords": [],
26
+ "author": "",
27
+ "license": "Apache-2.0",
28
+ "dependencies": {
29
+ "execa": "^9.6.0",
30
+ "fs-extra": "^11.3.0",
31
+ "pino": "^9.7.0",
32
+ "redis": "^5.8.0",
33
+ "@mastra/deployer": "^0.14.2-alpha.2",
34
+ "@mastra/loggers": "0.10.7"
35
+ },
36
+ "devDependencies": {
37
+ "@types/fs-extra": "^11.0.4",
38
+ "@types/node": "^20.19.0",
39
+ "eslint": "^9.30.1",
40
+ "tsup": "^8.5.0",
41
+ "typescript": "^5.8.3",
42
+ "vitest": "^3.2.4",
43
+ "@internal/lint": "0.0.31",
44
+ "@internal/types-builder": "0.0.6"
45
+ },
46
+ "peerDependencies": {
47
+ "@mastra/core": ">=0.10.1-0 <0.15.0-0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup --silent --config tsup.config.ts",
51
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
52
+ "test": "vitest run",
53
+ "lint": "eslint ."
54
+ }
55
+ }
@@ -0,0 +1,69 @@
1
+ import { MastraCloudExporter } from '@mastra/cloud';
2
+ import {
3
+ NodeSDK,
4
+ getNodeAutoInstrumentations,
5
+ ATTR_SERVICE_NAME,
6
+ resourceFromAttributes,
7
+ ParentBasedSampler,
8
+ TraceIdRatioBasedSampler,
9
+ AlwaysOnSampler,
10
+ AlwaysOffSampler,
11
+ OTLPHttpExporter,
12
+ } from '@mastra/core/telemetry/otel-vendor';
13
+
14
+ import { telemetry } from './telemetry-config.mjs';
15
+
16
+ function getSampler(config) {
17
+ if (!config.sampling) {
18
+ return new AlwaysOnSampler();
19
+ }
20
+
21
+ if (!config.enabled) {
22
+ return new AlwaysOffSampler();
23
+ }
24
+
25
+ switch (config.sampling.type) {
26
+ case 'ratio':
27
+ return new TraceIdRatioBasedSampler(config.sampling.probability);
28
+ case 'always_on':
29
+ return new AlwaysOnSampler();
30
+ case 'always_off':
31
+ return new AlwaysOffSampler();
32
+ case 'parent_based':
33
+ const rootSampler = new TraceIdRatioBasedSampler(config.sampling.root?.probability || 1.0);
34
+ return new ParentBasedSampler({ root: rootSampler });
35
+ default:
36
+ return new AlwaysOnSampler();
37
+ }
38
+ }
39
+
40
+ async function getExporter(config) {
41
+ if (config.export?.type === 'otlp') {
42
+ return new OTLPHttpExporter({
43
+ url: config.export.endpoint,
44
+ headers: config.export.headers,
45
+ });
46
+ } else if (config.export?.type === 'custom') {
47
+ return config.export.exporter;
48
+ } else {
49
+ console.info('Using default Mastra Cloud Exporter');
50
+ return new MastraCloudExporter({
51
+ endpoint: process.env.BUSINESS_API_TRACE_ENDPOINT,
52
+ accessToken: process.env.BUSINESS_JWT_TOKEN,
53
+ });
54
+ }
55
+ }
56
+
57
+ const sampler = getSampler(telemetry);
58
+ const exporter = await getExporter(telemetry);
59
+
60
+ const sdk = new NodeSDK({
61
+ resource: resourceFromAttributes({
62
+ [ATTR_SERVICE_NAME]: telemetry.serviceName || 'default-service',
63
+ }),
64
+ sampler,
65
+ traceExporter: exporter,
66
+ instrumentations: [getNodeAutoInstrumentations()],
67
+ });
68
+
69
+ sdk.start();