@mastra/deployer 0.0.1-alpha.3 → 0.0.1-alpha.30

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/README.md +159 -0
  3. package/dist/build/index.d.ts +57 -6
  4. package/dist/build/index.js +593 -0
  5. package/dist/index.d.ts +33 -4
  6. package/dist/index.js +743 -5
  7. package/dist/server/index.d.ts +14 -7
  8. package/dist/server/index.js +1355 -6878
  9. package/global.d.ts +1 -0
  10. package/package.json +37 -27
  11. package/src/build/babel/fix-libsql.ts +41 -0
  12. package/src/build/babel/get-deployer.ts +54 -0
  13. package/src/build/babel/remove-deployer.ts +39 -0
  14. package/src/build/bundle.ts +129 -210
  15. package/src/build/deployer.ts +71 -0
  16. package/src/build/deps.ts +31 -14
  17. package/src/build/index.ts +3 -5
  18. package/src/build/plugins/fix-libsql.ts +69 -0
  19. package/src/build/plugins/remove-deployer.ts +37 -0
  20. package/src/build/plugins/telemetry-fix.ts +54 -0
  21. package/src/deploy/base.ts +32 -150
  22. package/src/deploy/index.ts +1 -0
  23. package/src/deploy/log.ts +61 -0
  24. package/src/index.ts +3 -3
  25. package/src/server/handlers/agents.ts +61 -15
  26. package/src/server/handlers/client.ts +2 -2
  27. package/src/server/handlers/error.ts +5 -5
  28. package/src/server/handlers/logs.ts +20 -5
  29. package/src/server/handlers/memory.ts +18 -36
  30. package/src/server/handlers/root.ts +1 -1
  31. package/src/server/handlers/tools.ts +1 -27
  32. package/src/server/handlers/vector.ts +149 -0
  33. package/src/server/handlers/workflows.ts +8 -5
  34. package/src/server/index.ts +353 -156
  35. package/src/server/openapi.json +152 -68
  36. package/tsconfig.json +2 -7
  37. package/vitest.config.ts +1 -1
  38. package/dist/build/bundle.d.ts +0 -8
  39. package/dist/build/bundle.d.ts.map +0 -1
  40. package/dist/build/deps.d.ts +0 -25
  41. package/dist/build/deps.d.ts.map +0 -1
  42. package/dist/build/env.d.ts +0 -14
  43. package/dist/build/env.d.ts.map +0 -1
  44. package/dist/build/fs.d.ts +0 -22
  45. package/dist/build/fs.d.ts.map +0 -1
  46. package/dist/build/index.d.ts.map +0 -1
  47. package/dist/build/utils.d.ts +0 -4
  48. package/dist/build/utils.d.ts.map +0 -1
  49. package/dist/deploy/base.d.ts +0 -39
  50. package/dist/deploy/base.d.ts.map +0 -1
  51. package/dist/deploy/index.d.ts +0 -2
  52. package/dist/deploy/index.d.ts.map +0 -1
  53. package/dist/deployer.cjs.development.js +0 -3442
  54. package/dist/deployer.cjs.development.js.map +0 -1
  55. package/dist/deployer.cjs.production.min.js +0 -2
  56. package/dist/deployer.cjs.production.min.js.map +0 -1
  57. package/dist/deployer.esm.js +0 -3410
  58. package/dist/deployer.esm.js.map +0 -1
  59. package/dist/index.d.ts.map +0 -1
  60. package/dist/server/handlers/agents.d.ts +0 -6
  61. package/dist/server/handlers/agents.d.ts.map +0 -1
  62. package/dist/server/handlers/client.d.ts +0 -7
  63. package/dist/server/handlers/client.d.ts.map +0 -1
  64. package/dist/server/handlers/error.d.ts +0 -7
  65. package/dist/server/handlers/error.d.ts.map +0 -1
  66. package/dist/server/handlers/logs.d.ts +0 -4
  67. package/dist/server/handlers/logs.d.ts.map +0 -1
  68. package/dist/server/handlers/memory.d.ts +0 -17
  69. package/dist/server/handlers/memory.d.ts.map +0 -1
  70. package/dist/server/handlers/root.d.ts +0 -3
  71. package/dist/server/handlers/root.d.ts.map +0 -1
  72. package/dist/server/handlers/syncs.d.ts +0 -3
  73. package/dist/server/handlers/syncs.d.ts.map +0 -1
  74. package/dist/server/handlers/tools.d.ts +0 -7
  75. package/dist/server/handlers/tools.d.ts.map +0 -1
  76. package/dist/server/handlers/utils.d.ts +0 -2
  77. package/dist/server/handlers/utils.d.ts.map +0 -1
  78. package/dist/server/handlers/workflows.d.ts +0 -11
  79. package/dist/server/handlers/workflows.d.ts.map +0 -1
  80. package/dist/server/index.d.ts.map +0 -1
  81. package/dist/server/types.d.ts +0 -5
  82. package/dist/server/types.d.ts.map +0 -1
  83. package/dist/server/welcome.d.ts +0 -2
  84. package/dist/server/welcome.d.ts.map +0 -1
  85. package/src/server/handlers/syncs.ts +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,213 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.0.1-alpha.30
4
+
5
+ ### Patch Changes
6
+
7
+ - e27fe69: Add dir to deployer
8
+
9
+ ## 0.0.1-alpha.29
10
+
11
+ ### Patch Changes
12
+
13
+ - 0696eeb: Cleanup Mastra server
14
+ - 38b7f66: Update deployer logic
15
+ - Updated dependencies [2f17a5f]
16
+ - Updated dependencies [cb290ee]
17
+ - Updated dependencies [b4d7416]
18
+ - Updated dependencies [38b7f66]
19
+ - @mastra/core@0.2.0-alpha.84
20
+
21
+ ## 0.0.1-alpha.28
22
+
23
+ ### Patch Changes
24
+
25
+ - 2ab57d6: Fix: Workflows require a trigger schema otherwise it fails to run in dev
26
+ - 9625602: Use mastra core splitted bundles in other packages
27
+ - Updated dependencies [30322ce]
28
+ - Updated dependencies [78eec7c]
29
+ - Updated dependencies [9625602]
30
+ - Updated dependencies [8769a62]
31
+ - @mastra/core@0.2.0-alpha.83
32
+
33
+ ## 0.0.1-alpha.27
34
+
35
+ ### Patch Changes
36
+
37
+ - 73d112c: Core and deployer fixes
38
+ - ac8c61a: Mastra server vector operations
39
+ - Updated dependencies [73d112c]
40
+ - @mastra/core@0.1.27-alpha.82
41
+
42
+ ## 0.0.1-alpha.26
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [9fb3039]
47
+ - @mastra/core@0.1.27-alpha.81
48
+
49
+ ## 0.0.1-alpha.25
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [327ece7]
54
+ - @mastra/core@0.1.27-alpha.80
55
+
56
+ ## 0.0.1-alpha.24
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [21fe536]
61
+ - @mastra/core@0.1.27-alpha.79
62
+
63
+ ## 0.0.1-alpha.23
64
+
65
+ ### Patch Changes
66
+
67
+ - 88f18d7: Update cors support
68
+
69
+ ## 0.0.1-alpha.22
70
+
71
+ ### Patch Changes
72
+
73
+ - 685108a: Remove syncs and excess rag
74
+ - 685108a: Removing mastra syncs
75
+ - Updated dependencies [685108a]
76
+ - Updated dependencies [685108a]
77
+ - @mastra/core@0.1.27-alpha.78
78
+
79
+ ## 0.0.1-alpha.21
80
+
81
+ ### Patch Changes
82
+
83
+ - cfb966f: Deprecate @mastra/tts for mastra speech providers
84
+ - Updated dependencies [8105fae]
85
+ - @mastra/core@0.1.27-alpha.77
86
+
87
+ ## 0.0.1-alpha.20
88
+
89
+ ### Patch Changes
90
+
91
+ - ae7bf94: Fix loggers messing up deploys
92
+ - ae7bf94: Changeset
93
+ - Updated dependencies [ae7bf94]
94
+ - Updated dependencies [ae7bf94]
95
+ - @mastra/core@0.1.27-alpha.76
96
+
97
+ ## 0.0.1-alpha.19
98
+
99
+ ### Patch Changes
100
+
101
+ - 7064554: deployer fixes
102
+ - Updated dependencies [23dcb23]
103
+ - @mastra/core@0.1.27-alpha.75
104
+
105
+ ## 0.0.1-alpha.18
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [7b87567]
110
+ - @mastra/core@0.1.27-alpha.74
111
+
112
+ ## 0.0.1-alpha.17
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [3427b95]
117
+ - @mastra/core@0.1.27-alpha.73
118
+
119
+ ## 0.0.1-alpha.16
120
+
121
+ ### Patch Changes
122
+
123
+ - e4d4ede: Better setLogger()
124
+ - Updated dependencies [e4d4ede]
125
+ - Updated dependencies [06b2c0a]
126
+ - @mastra/core@0.1.27-alpha.72
127
+
128
+ ## 0.0.1-alpha.15
129
+
130
+ ### Patch Changes
131
+
132
+ - d9c8dd0: Logger changes for default transports
133
+ - Updated dependencies [d9c8dd0]
134
+ - @mastra/core@0.1.27-alpha.71
135
+
136
+ ## 0.0.1-alpha.14
137
+
138
+ ### Patch Changes
139
+
140
+ - ad2cd74: Deploy fix
141
+
142
+ ## 0.0.1-alpha.13
143
+
144
+ ### Patch Changes
145
+
146
+ - a1774e7: Improve bundling
147
+
148
+ ## 0.0.1-alpha.12
149
+
150
+ ### Patch Changes
151
+
152
+ - 28dceab: Catch apiKey error in dev
153
+
154
+ ## 0.0.1-alpha.11
155
+
156
+ ### Patch Changes
157
+
158
+ - bdaf834: publish packages
159
+
160
+ ## 0.0.1-alpha.10
161
+
162
+ ### Patch Changes
163
+
164
+ - Updated dependencies [dd6d87f]
165
+ - Updated dependencies [04434b6]
166
+ - @mastra/core@0.1.27-alpha.70
167
+
168
+ ## 0.0.1-alpha.9
169
+
170
+ ### Patch Changes
171
+
172
+ - 9066f95: CF deployer fixes
173
+
174
+ ## 0.0.1-alpha.8
175
+
176
+ ### Patch Changes
177
+
178
+ - b425845: Logger and execa logs
179
+
180
+ ## 0.0.1-alpha.7
181
+
182
+ ### Patch Changes
183
+
184
+ - 1944807: Unified logger and major step in better logs
185
+ - 9ade36e: Changed measure for evals, added endpoints, attached metrics to agent, added ui for evals in playground, and updated docs
186
+ - Updated dependencies [1944807]
187
+ - Updated dependencies [9ade36e]
188
+ - @mastra/core@0.1.27-alpha.69
189
+
190
+ ## 0.0.1-alpha.6
191
+
192
+ ### Patch Changes
193
+
194
+ - 291fe57: mastra openapi, swagger ui, dynamic servers
195
+ - 1a41fbf: Fix playground workflow triggerData on execution
196
+
197
+ ## 0.0.1-alpha.5
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [0be7181]
202
+ - Updated dependencies [0be7181]
203
+ - @mastra/core@0.1.27-alpha.68
204
+
205
+ ## 0.0.1-alpha.4
206
+
207
+ ### Patch Changes
208
+
209
+ - 7babd5c: CLI build and other
210
+
3
211
  ## 0.0.1-alpha.3
4
212
 
5
213
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # @mastra/deployer
2
+
3
+ Core deployment infrastructure for Mastra applications, handling build, packaging, and deployment processes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/deployer
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ The `@mastra/deployer` package provides the foundational deployment infrastructure for Mastra applications. It handles:
14
+
15
+ - Project building and bundling
16
+ - Dependency management
17
+ - Environment configuration
18
+ - Development and production deployments
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import { Deployer } from '@mastra/deployer';
24
+
25
+ // Create a deployer instance
26
+ const deployer = new Deployer({
27
+ dir: '/path/to/project',
28
+ type: 'Deploy', // or 'Dev' for development mode
29
+ });
30
+
31
+ // Install dependencies
32
+ await deployer.install();
33
+
34
+ // Write package.json
35
+ await deployer.writePackageJson();
36
+
37
+ // Get Mastra instance
38
+ const { mastra } = await deployer.getMastra();
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ ### Required Parameters
44
+
45
+ - `dir`: Project directory path
46
+ - `type`: Deployment type ('Deploy' or 'Dev')
47
+
48
+ ## Features
49
+
50
+ ### Project Structure Management
51
+
52
+ - Creates and manages `.mastra` directory
53
+ - Handles package.json generation and updates
54
+ - Manages project dependencies
55
+
56
+ ### Dependency Management
57
+
58
+ - Automatic dependency installation
59
+ - Workspace dependency resolution
60
+ - Version management for @mastra packages
61
+
62
+ ### Environment Handling
63
+
64
+ - Support for multiple environment files:
65
+ - `.env`
66
+ - `.env.development`
67
+ - `.env.local`
68
+ - Environment variable validation and processing
69
+
70
+ ### Build Process
71
+
72
+ - Project bundling
73
+ - Asset management
74
+ - Source code transformation
75
+
76
+ ### Development Support
77
+
78
+ - Development server configuration
79
+ - Hot reloading capabilities
80
+ - Debug logging
81
+
82
+ ## Project Structure
83
+
84
+ The deployer creates and manages the following structure:
85
+
86
+ ```
87
+ your-project/
88
+ ├── .mastra/
89
+ │ ├── package.json
90
+ │ ├── mastra.mjs
91
+ │ └── index.mjs
92
+ ├── .env
93
+ ├── .env.development
94
+ ├── .env.local
95
+ └── package.json
96
+ ```
97
+
98
+ ## Package.json Management
99
+
100
+ The deployer automatically manages dependencies in the `.mastra/package.json`:
101
+
102
+ ```json
103
+ {
104
+ "name": "server",
105
+ "version": "1.0.0",
106
+ "type": "module",
107
+ "dependencies": {
108
+ "@mastra/loggers": "latest",
109
+ "hono": "4.6.17",
110
+ "@hono/node-server": "^1.13.7",
111
+ "superjson": "^2.2.2",
112
+ "zod-to-json-schema": "^3.24.1"
113
+ }
114
+ }
115
+ ```
116
+
117
+ ## Methods
118
+
119
+ ### `install()`
120
+
121
+ Installs and updates project dependencies.
122
+
123
+ ### `writePackageJson()`
124
+
125
+ Generates or updates the package.json in the .mastra directory.
126
+
127
+ ### `getMastra()`
128
+
129
+ Returns the Mastra instance for the project.
130
+
131
+ ### `getMastraPath()`
132
+
133
+ Returns the path to the .mastra directory.
134
+
135
+ ## Error Handling
136
+
137
+ The deployer includes comprehensive error handling for:
138
+
139
+ - Dependency installation failures
140
+ - File system operations
141
+ - Environment configuration issues
142
+ - Build process errors
143
+
144
+ ## Logging
145
+
146
+ Built-in logging support through @mastra/core:
147
+
148
+ - Debug information
149
+ - Installation progress
150
+ - Build status
151
+ - Error reporting
152
+
153
+ ## Related Packages
154
+
155
+ - `@mastra/core`: Core Mastra functionality
156
+ - `@mastra/loggers`: Logging infrastructure
157
+ - Deployer implementations:
158
+ - `@mastra/deployer-cloudflare`
159
+ - Other platform-specific deployers
@@ -1,6 +1,57 @@
1
- export * from './fs.js';
2
- export * from './env.js';
3
- export * from './utils.js';
4
- export * from './bundle.js';
5
- export * from './deps.js';
6
- //# sourceMappingURL=index.d.ts.map
1
+ import * as rollup from 'rollup';
2
+ import { InputOptions, Plugin, InputOption } from 'rollup';
3
+ import { MastraBase } from '@mastra/core/base';
4
+
5
+ declare class Deps extends MastraBase {
6
+ private packageManager;
7
+ constructor();
8
+ private findLockFile;
9
+ private getPackageManager;
10
+ install({ dir, packages }: {
11
+ dir?: string;
12
+ packages?: string[];
13
+ }): Promise<unknown>;
14
+ installPackages(packages: string[]): Promise<unknown>;
15
+ checkDependencies(dependencies: string[]): Promise<string>;
16
+ getProjectName(): Promise<any>;
17
+ getPackageVersion(): Promise<string | undefined>;
18
+ addScriptsToPackageJson(scripts: Record<string, string>): Promise<void>;
19
+ }
20
+
21
+ type NormalizedInputOptions = Omit<Partial<InputOptions>, 'plugins' | 'input' | 'external'> & {
22
+ plugins?: Plugin[];
23
+ input: InputOption;
24
+ external?: (string | RegExp)[];
25
+ };
26
+ declare function getBundler(inputOptions: NormalizedInputOptions, args?: {
27
+ platform?: 'node' | 'browser';
28
+ dir?: string;
29
+ }): Promise<rollup.RollupBuild>;
30
+ declare function getWatcher(inputOptions: NormalizedInputOptions, args?: {
31
+ platform?: 'node' | 'browser';
32
+ dir?: string;
33
+ }): Promise<rollup.RollupWatcher>;
34
+
35
+ declare class FileService {
36
+ /**
37
+ *
38
+ * @param inputFile the file in the starter files directory to copy
39
+ * @param outputFilePath the destination path
40
+ * @param replaceIfExists flag to replace if it exists
41
+ * @returns
42
+ */
43
+ copyStarterFile(inputFile: string, outputFilePath: string, replaceIfExists?: boolean): Promise<boolean>;
44
+ setupEnvFile({ dbUrl }: {
45
+ dbUrl: string;
46
+ }): Promise<void>;
47
+ getFirstExistingFile(files: string[]): string;
48
+ replaceValuesInFile({ filePath, replacements, }: {
49
+ filePath: string;
50
+ replacements: {
51
+ search: string;
52
+ replace: string;
53
+ }[];
54
+ }): void;
55
+ }
56
+
57
+ export { Deps, FileService, getBundler, getWatcher };