motia 0.13.1-beta.163-093858 → 0.13.1-beta.163-010752
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/cjs/cli.js +73 -4
- package/dist/cjs/utils/analytics.d.ts.map +1 -1
- package/dist/cjs/utils/analytics.js +3 -4
- package/dist/esm/cli.js +73 -4
- package/dist/esm/utils/analytics.d.ts.map +1 -1
- package/dist/esm/utils/analytics.js +1 -2
- package/dist/types/utils/analytics.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/cjs/cli.js
CHANGED
|
@@ -14,9 +14,6 @@ const registerTsNode = () => {
|
|
|
14
14
|
compilerOptions: { module: 'commonjs' },
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
const registerCloudCommands = () => {
|
|
18
|
-
require('./cloud');
|
|
19
|
-
};
|
|
20
17
|
commander_1.program
|
|
21
18
|
.command('version')
|
|
22
19
|
.description('Display detailed version information')
|
|
@@ -192,7 +189,79 @@ docker
|
|
|
192
189
|
await build(arg.projectName);
|
|
193
190
|
process.exit(0);
|
|
194
191
|
}));
|
|
195
|
-
|
|
192
|
+
const cloud = commander_1.program.command('cloud').description('Motia cloud commands');
|
|
193
|
+
cloud
|
|
194
|
+
.command('build')
|
|
195
|
+
.description('Build the project')
|
|
196
|
+
.action((0, config_utils_1.handler)(async (_, context) => {
|
|
197
|
+
const { buildValidation } = require('./cloud/build/build-validation');
|
|
198
|
+
const { build } = require('./cloud/new-deployment/build');
|
|
199
|
+
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
200
|
+
const listener = new CliListener(context);
|
|
201
|
+
const builder = await build(listener);
|
|
202
|
+
const isValid = buildValidation(builder, listener);
|
|
203
|
+
if (!isValid) {
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
207
|
+
}));
|
|
208
|
+
cloud
|
|
209
|
+
.command('deploy')
|
|
210
|
+
.description('Deploy a new version to Motia Cloud')
|
|
211
|
+
.requiredOption('-k, --api-key <key>', 'The API key for authentication', process.env.MOTIA_API_KEY)
|
|
212
|
+
.requiredOption('-v, --version-name <version>', 'The version to deploy')
|
|
213
|
+
.option('-p, --project-id <id>', 'Project ID (Deprecated)')
|
|
214
|
+
.option('-n, --project-name <name>', 'Project name (used when creating a new project)')
|
|
215
|
+
.option('-s, --environment-id <id>', 'Environment ID', process.env.MOTIA_ENVIRONMENT_ID)
|
|
216
|
+
.option('--environment-name <name>', 'Environment name')
|
|
217
|
+
.option('-e, --env-file <path>', 'Path to environment file')
|
|
218
|
+
.option('-d, --version-description <description>', 'The description of the version')
|
|
219
|
+
.option('-c, --ci', 'CI mode', process.env.CI)
|
|
220
|
+
.action((0, config_utils_1.handler)(async (arg, context) => {
|
|
221
|
+
const { buildValidation } = require('./cloud/build/build-validation');
|
|
222
|
+
const { build } = require('./cloud/new-deployment/build');
|
|
223
|
+
const { cloudApi } = require('./cloud/new-deployment/cloud-api');
|
|
224
|
+
const { deploy } = require('./cloud/new-deployment/deploy');
|
|
225
|
+
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
226
|
+
const { uploadArtifacts } = require('./cloud/new-deployment/upload-artifacts');
|
|
227
|
+
const { loadEnvData } = require('./cloud/new-deployment/utils/load-env-data');
|
|
228
|
+
const listener = new CliListener(context);
|
|
229
|
+
const builder = await build(listener);
|
|
230
|
+
const isValid = buildValidation(builder, listener);
|
|
231
|
+
if (!isValid) {
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
235
|
+
context.log('creating-deployment', (message) => message.tag('progress').append('Creating deployment...'));
|
|
236
|
+
const deployment = await cloudApi
|
|
237
|
+
.createDeployment({
|
|
238
|
+
apiKey: arg.apiKey,
|
|
239
|
+
projectName: arg.projectName,
|
|
240
|
+
environmentId: arg.environmentId,
|
|
241
|
+
environmentName: arg.environmentName,
|
|
242
|
+
versionName: arg.versionName,
|
|
243
|
+
versionDescription: arg.versionDescription,
|
|
244
|
+
})
|
|
245
|
+
.catch((error) => {
|
|
246
|
+
context.log('creating-deployment', (message) => message.tag('failed').append('Failed to create deployment'));
|
|
247
|
+
throw error;
|
|
248
|
+
});
|
|
249
|
+
context.log('creating-deployment', (message) => message.tag('success').append('Deployment created'));
|
|
250
|
+
context.log('uploading-artifacts', (message) => message.tag('progress').append('Uploading artifacts...'));
|
|
251
|
+
await uploadArtifacts(builder, deployment.deploymentToken, listener);
|
|
252
|
+
context.log('uploading-artifacts', (message) => message.tag('success').append('Artifacts uploaded'));
|
|
253
|
+
context.log('starting-deployment', (message) => message.tag('progress').append('Starting deployment...'));
|
|
254
|
+
await deploy({
|
|
255
|
+
envVars: loadEnvData(arg.envFile, context),
|
|
256
|
+
deploymentId: deployment.deploymentId,
|
|
257
|
+
deploymentToken: deployment.deploymentToken,
|
|
258
|
+
builder,
|
|
259
|
+
listener,
|
|
260
|
+
context,
|
|
261
|
+
ci: arg.ci,
|
|
262
|
+
});
|
|
263
|
+
context.exit(0);
|
|
264
|
+
}));
|
|
196
265
|
commander_1.program.version(version_1.version, '-V, --version', 'Output the current version');
|
|
197
266
|
commander_1.program.parseAsync(process.argv).catch(() => {
|
|
198
267
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAejD,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,gBAAgB,YAE5B,CAAA;AAED,eAAO,MAAM,YAAY,YAYxB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,OAAO,UAAU,SAkB7D,CAAA;AAkBD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,KAAG,CAalF,CAAA"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.wrapAction = exports.logCliError = exports.identifyUser = exports.disableAnalytics = exports.enableAnalytics = void 0;
|
|
4
4
|
const analytics_node_1 = require("@amplitude/analytics-node");
|
|
5
|
-
const core_1 = require("@motiadev/core");
|
|
6
5
|
const utils_1 = require("@motiadev/core/dist/src/analytics/utils");
|
|
7
6
|
const version_1 = require("../version");
|
|
8
7
|
const enrichment_plugin_1 = require("./amplitude/enrichment-plugin");
|
|
@@ -11,7 +10,7 @@ const build_error_1 = require("./errors/build.error");
|
|
|
11
10
|
logLevel: analytics_node_1.Types.LogLevel.None,
|
|
12
11
|
});
|
|
13
12
|
const updateOptOutStatus = () => {
|
|
14
|
-
const optOut = !(0,
|
|
13
|
+
const optOut = !(0, utils_1.isAnalyticsEnabled)();
|
|
15
14
|
(0, analytics_node_1.setOptOut)(optOut);
|
|
16
15
|
};
|
|
17
16
|
updateOptOutStatus();
|
|
@@ -31,7 +30,7 @@ const identifyUser = () => {
|
|
|
31
30
|
identifyObj.postInsert('motia_version', version_1.version || 'unknown');
|
|
32
31
|
identifyObj.postInsert('project_version', process.env.npm_package_version || 'unknown');
|
|
33
32
|
(0, analytics_node_1.identify)(identifyObj, {
|
|
34
|
-
user_id: (0,
|
|
33
|
+
user_id: (0, utils_1.getUserIdentifier)(),
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
catch (error) {
|
|
@@ -46,7 +45,7 @@ const logCliError = (command, error) => {
|
|
|
46
45
|
const errorType = cause?.constructor?.name || 'Unknown error type';
|
|
47
46
|
const errorStack = cause?.stack ? cause.stack.split('\n').slice(0, 10).join('\n') : undefined;
|
|
48
47
|
const truncatedMessage = errorMessage.length > 500 ? `${errorMessage.substring(0, 500)}...` : errorMessage;
|
|
49
|
-
(0,
|
|
48
|
+
(0, utils_1.trackEvent)('cli_command_error', {
|
|
50
49
|
command,
|
|
51
50
|
error_message: truncatedMessage,
|
|
52
51
|
error_type: errorType,
|
package/dist/esm/cli.js
CHANGED
|
@@ -12,9 +12,6 @@ const registerTsNode = () => {
|
|
|
12
12
|
compilerOptions: { module: 'commonjs' },
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
const registerCloudCommands = () => {
|
|
16
|
-
require('./cloud');
|
|
17
|
-
};
|
|
18
15
|
program
|
|
19
16
|
.command('version')
|
|
20
17
|
.description('Display detailed version information')
|
|
@@ -190,7 +187,79 @@ docker
|
|
|
190
187
|
await build(arg.projectName);
|
|
191
188
|
process.exit(0);
|
|
192
189
|
}));
|
|
193
|
-
|
|
190
|
+
const cloud = program.command('cloud').description('Motia cloud commands');
|
|
191
|
+
cloud
|
|
192
|
+
.command('build')
|
|
193
|
+
.description('Build the project')
|
|
194
|
+
.action(handler(async (_, context) => {
|
|
195
|
+
const { buildValidation } = require('./cloud/build/build-validation');
|
|
196
|
+
const { build } = require('./cloud/new-deployment/build');
|
|
197
|
+
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
198
|
+
const listener = new CliListener(context);
|
|
199
|
+
const builder = await build(listener);
|
|
200
|
+
const isValid = buildValidation(builder, listener);
|
|
201
|
+
if (!isValid) {
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
205
|
+
}));
|
|
206
|
+
cloud
|
|
207
|
+
.command('deploy')
|
|
208
|
+
.description('Deploy a new version to Motia Cloud')
|
|
209
|
+
.requiredOption('-k, --api-key <key>', 'The API key for authentication', process.env.MOTIA_API_KEY)
|
|
210
|
+
.requiredOption('-v, --version-name <version>', 'The version to deploy')
|
|
211
|
+
.option('-p, --project-id <id>', 'Project ID (Deprecated)')
|
|
212
|
+
.option('-n, --project-name <name>', 'Project name (used when creating a new project)')
|
|
213
|
+
.option('-s, --environment-id <id>', 'Environment ID', process.env.MOTIA_ENVIRONMENT_ID)
|
|
214
|
+
.option('--environment-name <name>', 'Environment name')
|
|
215
|
+
.option('-e, --env-file <path>', 'Path to environment file')
|
|
216
|
+
.option('-d, --version-description <description>', 'The description of the version')
|
|
217
|
+
.option('-c, --ci', 'CI mode', process.env.CI)
|
|
218
|
+
.action(handler(async (arg, context) => {
|
|
219
|
+
const { buildValidation } = require('./cloud/build/build-validation');
|
|
220
|
+
const { build } = require('./cloud/new-deployment/build');
|
|
221
|
+
const { cloudApi } = require('./cloud/new-deployment/cloud-api');
|
|
222
|
+
const { deploy } = require('./cloud/new-deployment/deploy');
|
|
223
|
+
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
224
|
+
const { uploadArtifacts } = require('./cloud/new-deployment/upload-artifacts');
|
|
225
|
+
const { loadEnvData } = require('./cloud/new-deployment/utils/load-env-data');
|
|
226
|
+
const listener = new CliListener(context);
|
|
227
|
+
const builder = await build(listener);
|
|
228
|
+
const isValid = buildValidation(builder, listener);
|
|
229
|
+
if (!isValid) {
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
233
|
+
context.log('creating-deployment', (message) => message.tag('progress').append('Creating deployment...'));
|
|
234
|
+
const deployment = await cloudApi
|
|
235
|
+
.createDeployment({
|
|
236
|
+
apiKey: arg.apiKey,
|
|
237
|
+
projectName: arg.projectName,
|
|
238
|
+
environmentId: arg.environmentId,
|
|
239
|
+
environmentName: arg.environmentName,
|
|
240
|
+
versionName: arg.versionName,
|
|
241
|
+
versionDescription: arg.versionDescription,
|
|
242
|
+
})
|
|
243
|
+
.catch((error) => {
|
|
244
|
+
context.log('creating-deployment', (message) => message.tag('failed').append('Failed to create deployment'));
|
|
245
|
+
throw error;
|
|
246
|
+
});
|
|
247
|
+
context.log('creating-deployment', (message) => message.tag('success').append('Deployment created'));
|
|
248
|
+
context.log('uploading-artifacts', (message) => message.tag('progress').append('Uploading artifacts...'));
|
|
249
|
+
await uploadArtifacts(builder, deployment.deploymentToken, listener);
|
|
250
|
+
context.log('uploading-artifacts', (message) => message.tag('success').append('Artifacts uploaded'));
|
|
251
|
+
context.log('starting-deployment', (message) => message.tag('progress').append('Starting deployment...'));
|
|
252
|
+
await deploy({
|
|
253
|
+
envVars: loadEnvData(arg.envFile, context),
|
|
254
|
+
deploymentId: deployment.deploymentId,
|
|
255
|
+
deploymentToken: deployment.deploymentToken,
|
|
256
|
+
builder,
|
|
257
|
+
listener,
|
|
258
|
+
context,
|
|
259
|
+
ci: arg.ci,
|
|
260
|
+
});
|
|
261
|
+
context.exit(0);
|
|
262
|
+
}));
|
|
194
263
|
program.version(version, '-V, --version', 'Output the current version');
|
|
195
264
|
program.parseAsync(process.argv).catch(() => {
|
|
196
265
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAejD,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,gBAAgB,YAE5B,CAAA;AAED,eAAO,MAAM,YAAY,YAYxB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,OAAO,UAAU,SAkB7D,CAAA;AAkBD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,KAAG,CAalF,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { add, flush, Identify, identify, init, setOptOut, Types } from '@amplitude/analytics-node';
|
|
2
|
-
import { getUserIdentifier, isAnalyticsEnabled, trackEvent } from '@motiadev/core';
|
|
3
|
-
import { getProjectName } from '@motiadev/core/dist/src/analytics/utils';
|
|
2
|
+
import { getProjectName, getUserIdentifier, isAnalyticsEnabled, trackEvent, } from '@motiadev/core/dist/src/analytics/utils';
|
|
4
3
|
import { version } from '../version';
|
|
5
4
|
import { MotiaEnrichmentPlugin } from './amplitude/enrichment-plugin';
|
|
6
5
|
import { BuildError } from './errors/build.error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAejD,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,gBAAgB,YAE5B,CAAA;AAED,eAAO,MAAM,YAAY,YAYxB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,OAAO,UAAU,SAkB7D,CAAA;AAkBD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,KAAG,CAalF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motia",
|
|
3
3
|
"description": "Build production-grade backends with a single primitive. APIs, background jobs, Queues, Workflows, and AI agents - unified in one system with built-in State management, Streaming, and Observability.",
|
|
4
|
-
"version": "0.13.1-beta.163-
|
|
4
|
+
"version": "0.13.1-beta.163-010752",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"table": "^6.9.0",
|
|
50
50
|
"ts-node": "^10.9.2",
|
|
51
51
|
"zod": "^4.1.12",
|
|
52
|
-
"@motiadev/adapter-redis-state": "0.13.1-beta.163-
|
|
53
|
-
"@motiadev/adapter-redis-streams": "0.13.1-beta.163-
|
|
54
|
-
"@motiadev/stream-client-node": "0.13.1-beta.163-
|
|
55
|
-
"@motiadev/core": "0.13.1-beta.163-
|
|
56
|
-
"@motiadev/workbench": "0.13.1-beta.163-
|
|
52
|
+
"@motiadev/adapter-redis-state": "0.13.1-beta.163-010752",
|
|
53
|
+
"@motiadev/adapter-redis-streams": "0.13.1-beta.163-010752",
|
|
54
|
+
"@motiadev/stream-client-node": "0.13.1-beta.163-010752",
|
|
55
|
+
"@motiadev/core": "0.13.1-beta.163-010752",
|
|
56
|
+
"@motiadev/workbench": "0.13.1-beta.163-010752"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@amplitude/analytics-types": "^2.9.2",
|