@multiplayer-app/cli 1.3.35 → 2.0.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.
@@ -0,0 +1,27 @@
1
+ ; Query from: https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/markdown/injections.scm
2
+ (fenced_code_block
3
+ (info_string
4
+ (language) @_lang)
5
+ (code_fence_content) @injection.content
6
+ (#set-lang-from-info-string! @_lang))
7
+
8
+ ((html_block) @injection.content
9
+ (#set! injection.language "html")
10
+ (#set! injection.combined)
11
+ (#set! injection.include-children))
12
+
13
+ ((minus_metadata) @injection.content
14
+ (#set! injection.language "yaml")
15
+ (#offset! @injection.content 1 0 -1 0)
16
+ (#set! injection.include-children))
17
+
18
+ ((plus_metadata) @injection.content
19
+ (#set! injection.language "toml")
20
+ (#offset! @injection.content 1 0 -1 0)
21
+ (#set! injection.include-children))
22
+
23
+ ([
24
+ (inline)
25
+ (pipe_table_cell)
26
+ ] @injection.content
27
+ (#set! injection.language "markdown_inline"))
@@ -0,0 +1,135 @@
1
+ const tsPlugin = require('@typescript-eslint/eslint-plugin')
2
+ const tsParser = require('@typescript-eslint/parser')
3
+
4
+ // Equivalent to env: { es6: true, node: true, jest: true, mocha: true }
5
+ const envGlobals = {
6
+ // Node.js
7
+ __dirname: 'readonly',
8
+ __filename: 'readonly',
9
+ Buffer: 'readonly',
10
+ clearImmediate: 'readonly',
11
+ clearInterval: 'readonly',
12
+ clearTimeout: 'readonly',
13
+ console: 'readonly',
14
+ exports: 'writable',
15
+ global: 'readonly',
16
+ module: 'writable',
17
+ process: 'readonly',
18
+ require: 'readonly',
19
+ setImmediate: 'readonly',
20
+ setInterval: 'readonly',
21
+ setTimeout: 'readonly',
22
+ URL: 'readonly',
23
+ URLSearchParams: 'readonly',
24
+ // Jest
25
+ afterAll: 'readonly',
26
+ afterEach: 'readonly',
27
+ beforeAll: 'readonly',
28
+ beforeEach: 'readonly',
29
+ describe: 'readonly',
30
+ expect: 'readonly',
31
+ fit: 'readonly',
32
+ it: 'readonly',
33
+ jest: 'readonly',
34
+ test: 'readonly',
35
+ xdescribe: 'readonly',
36
+ xit: 'readonly',
37
+ xtest: 'readonly',
38
+ // Mocha
39
+ after: 'readonly',
40
+ before: 'readonly',
41
+ context: 'readonly',
42
+ mocha: 'readonly',
43
+ run: 'readonly',
44
+ specify: 'readonly',
45
+ suite: 'readonly',
46
+ suiteSetup: 'readonly',
47
+ suiteTeardown: 'readonly',
48
+ xcontext: 'readonly',
49
+ xspecify: 'readonly',
50
+ }
51
+
52
+ module.exports = [
53
+ {
54
+ ignores: [
55
+ 'package.json',
56
+ 'node_modules/**',
57
+ 'clients/**',
58
+ 'libs/multiplayer-blocknote-lib/**',
59
+ '**/dist/**',
60
+ ],
61
+ },
62
+ {
63
+ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
64
+ languageOptions: {
65
+ parser: tsParser,
66
+ parserOptions: {
67
+ ecmaVersion: 'latest',
68
+ sourceType: 'module',
69
+ },
70
+ globals: envGlobals,
71
+ },
72
+ plugins: {
73
+ '@typescript-eslint': tsPlugin,
74
+ },
75
+ rules: {
76
+ // plugin:@typescript-eslint/eslint-recommended — disables ESLint rules
77
+ // that TypeScript handles natively, enables TS-aware replacements
78
+ 'constructor-super': 'off',
79
+ 'getter-return': 'off',
80
+ 'no-const-assign': 'off',
81
+ 'no-dupe-args': 'off',
82
+ 'no-dupe-class-members': 'off',
83
+ 'no-dupe-keys': 'off',
84
+ 'no-func-assign': 'off',
85
+ 'no-import-assign': 'off',
86
+ 'no-new-symbol': 'off',
87
+ 'no-obj-calls': 'off',
88
+ 'no-redeclare': 'off',
89
+ 'no-setter-return': 'off',
90
+ 'no-this-before-super': 'off',
91
+ 'no-undef': 'off',
92
+ 'no-unreachable': 'off',
93
+ 'no-unsafe-negation': 'off',
94
+ 'no-var': 'error',
95
+ 'prefer-rest-params': 'error',
96
+ 'prefer-spread': 'error',
97
+ // plugin:@typescript-eslint/recommended
98
+ '@typescript-eslint/ban-ts-comment': 'error',
99
+ 'no-array-constructor': 'off',
100
+ '@typescript-eslint/no-array-constructor': 'error',
101
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
102
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
103
+ '@typescript-eslint/no-misused-new': 'error',
104
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
105
+ '@typescript-eslint/no-this-alias': 'error',
106
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
107
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
108
+ '@typescript-eslint/no-var-requires': 'error',
109
+ '@typescript-eslint/prefer-as-const': 'error',
110
+ '@typescript-eslint/triple-slash-reference': 'error',
111
+ // Custom rules (from .eslintrc)
112
+ 'prefer-const': 'error',
113
+ '@typescript-eslint/no-namespace': 0,
114
+ '@typescript-eslint/prefer-namespace-keyword': 0,
115
+ '@typescript-eslint/no-empty-function': 0,
116
+ '@typescript-eslint/no-unused-vars': 0,
117
+ '@typescript-eslint/no-explicit-any': 0,
118
+ 'block-spacing': ['error', 'always'],
119
+ 'keyword-spacing': ['error', { before: true, after: true }],
120
+ 'indent': ['error', 2, { SwitchCase: 1 }],
121
+ 'linebreak-style': ['error', 'unix'],
122
+ 'quotes': ['error', 'single'],
123
+ 'semi': ['error', 'never'],
124
+ 'comma-dangle': ['error', 'always-multiline'],
125
+ 'no-console': 1,
126
+ 'object-curly-spacing': ['error', 'always'],
127
+ 'space-in-parens': ['error', 'never'],
128
+ 'array-bracket-spacing': ['error', 'never'],
129
+ 'no-trailing-spaces': 'error',
130
+ 'no-multi-spaces': 'error',
131
+ 'no-lonely-if': 'error',
132
+ 'key-spacing': 'error',
133
+ },
134
+ },
135
+ ]
package/package.json CHANGED
@@ -1,47 +1,43 @@
1
1
  {
2
2
  "name": "@multiplayer-app/cli",
3
- "version": "1.3.35",
3
+ "version": "2.0.0",
4
4
  "description": "Multiplayer CLI",
5
- "author": {
6
- "name": "Multiplayer Software, Inc.",
7
- "url": "https://www.multiplayer.app"
8
- },
9
- "private": false,
10
- "bugs": {
11
- "url": "https://github.com/multiplayer-app/multiplayer-session-recorder-javascript/issues"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/multiplayer-app/multiplayer-session-recorder-javascript.git"
16
- },
17
- "license": "MIT",
18
- "type": "module",
19
- "engines": {
20
- "node": ">=18",
21
- "npm": ">=8"
22
- },
23
- "keywords": [
24
- "multiplayer",
25
- "api",
26
- "release",
27
- "sourcemap",
28
- "deployment"
29
- ],
30
- "main": "src/index.js",
5
+ "main": "dist/index.js",
31
6
  "bin": {
32
- "multiplayer-app-cli": "./bin/multiplayer-app-cli"
7
+ "multiplayer": "./dist/index.js"
33
8
  },
34
9
  "scripts": {
35
- "lint": "eslint src/**/*.js",
36
- "preversion": "npm run lint",
37
- "prepublishOnly": "npm run lint"
10
+ "build": "bun build src/index.tsx --outdir dist --target bun --format esm --sourcemap=none && rm -f dist/index.js.map",
11
+ "start": "bun dist/index.js",
12
+ "dev": "bun src/index.tsx",
13
+ "typecheck": "tsc --noEmit",
14
+ "lint": "eslint src/**/*.ts --config eslint.config.js"
38
15
  },
39
16
  "dependencies": {
17
+ "@anthropic-ai/claude-agent-sdk": "0.2.73",
18
+ "@anthropic-ai/sdk": "^0.78.0",
19
+ "@opentui/core": "0.1.93",
20
+ "@opentui/react": "0.1.93",
21
+ "commander": "14.0.3",
22
+ "dotenv": "16.0.0",
40
23
  "jsonwebtoken": "9.0.3",
41
- "superagent": "10.1.0",
42
- "yargs": "16.0.3"
24
+ "mongoose": "9.3.3",
25
+ "openai": "6.33.0",
26
+ "react": "19.2.4",
27
+ "simple-git": "3.33.0",
28
+ "socket.io-client": "4.8.3",
29
+ "superagent": "10.3.0"
30
+ },
31
+ "overrides": {
32
+ "react": "19.2.4"
43
33
  },
44
34
  "devDependencies": {
45
- "eslint": "9.30.1"
35
+ "@sindresorhus/tsconfig": "^8.1.0",
36
+ "@types/jsonwebtoken": "^9.0.10",
37
+ "@types/node": "25.5.0",
38
+ "@types/react": "19.2.14",
39
+ "@types/superagent": "8.1.9",
40
+ "eslint": "10.1.0",
41
+ "typescript": "6.0.2"
46
42
  }
47
43
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Multiplayer Software, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import yargs from 'yargs'
4
- import { hideBin } from 'yargs/helpers'
5
- import { create as createRelease } from '../src/commands/releases/create.js'
6
- import { create as createDeployment } from '../src/commands/deployments/create.js'
7
- import { upload as uploadSourcemap } from '../src/commands/sourcemaps/upload.js'
8
-
9
- function handleResult(err, response) {
10
- if (err) {
11
- if (err.status) console.error('Status Code:', err.status)
12
- if (err.response) console.error(err.response.text)
13
- else console.error(err.message)
14
- process.exit(1)
15
- } else {
16
- console.log(JSON.stringify(response, null, 2))
17
- }
18
- }
19
-
20
- yargs(hideBin(process.argv))
21
- .command('releases', 'Manage releases', (yargs) => {
22
- yargs.command(
23
- 'create',
24
- 'Create a release',
25
- (yargs) => yargs
26
- .option('apiKey', { describe: 'Multiplayer personal user API key (MULTIPLAYER_API_KEY)', type: 'string' })
27
- .option('service', { describe: 'Service name (SERVICE_NAME)', type: 'string' })
28
- .option('releaseVersion', { describe: 'Release version (RELEASE)', type: 'string' })
29
- .option('commitHash', { describe: 'Commit hash (COMMIT_HASH)', type: 'string' })
30
- .option('releaseNotes', { describe: '[Optional] Release notes (RELEASE_NOTES)', type: 'string' })
31
- .option('baseUrl', { describe: '[Optional] Base URL (BASE_URL)', type: 'string' }),
32
- (argv) => {
33
-
34
- const options = {
35
- apiKey: argv.apiKey || process.env.MULTIPLAYER_API_KEY,
36
- service: argv.service || process.env.SERVICE_NAME,
37
- release: argv.release || process.env.RELEASE,
38
- commitHash: argv.commitHash || process.env.COMMIT_HASH,
39
- releaseNotes: argv.releaseNotes || process.env.RELEASE_NOTES,
40
- baseUrl: argv.baseUrl || process.env.BASE_URL,
41
- }
42
- if (!options.apiKey) return exitWithError('A Multiplayer personal user API key is required.', yargs)
43
- if (!options.service) return exitWithError('A service name is required.', yargs)
44
- if (!options.release) return exitWithError('A release is required.', yargs)
45
- createRelease(options, handleResult)
46
- },
47
- )
48
- .demandCommand()
49
- .help()
50
- })
51
- .command('deployments', 'Manage deployments', (yargs) => {
52
- yargs.command(
53
- 'create',
54
- 'Create a deployment',
55
- (yargs) => yargs
56
- .option('apiKey', { describe: 'Multiplayer personal user API key (MULTIPLAYER_API_KEY)', type: 'string' })
57
- .option('service', { describe: 'Service name (SERVICE_NAME)', type: 'string' })
58
- .option('release', { describe: 'Service release (RELEASE)', type: 'string' })
59
- .option('environment', { describe: 'Environment name (ENVIRONMENT)', type: 'string' })
60
- .option('baseUrl', { describe: '[Optional] Base URL (BASE_URL)', type: 'string' }),
61
- (argv) => {
62
- const options = {
63
- apiKey: argv.apiKey || process.env.MULTIPLAYER_API_KEY,
64
- service: argv.service || process.env.SERVICE_NAME,
65
- release: argv.release || process.env.VERSION,
66
- environment: argv.environment || process.env.ENVIRONMENT,
67
- baseUrl: argv.baseUrl || process.env.BASE_URL,
68
- }
69
- if (!options.apiKey) return exitWithError('A Multiplayer personal user API key is required.', yargs)
70
- if (!options.service) return exitWithError('A service name is required.', yargs)
71
- if (!options.release) return exitWithError('A version is required.', yargs)
72
- if (!options.environment) return exitWithError('A environment is required.', yargs)
73
- createDeployment(options, handleResult)
74
- },
75
- )
76
- .demandCommand()
77
- .help()
78
- })
79
- .command('sourcemaps', 'Manage sourcemaps', (yargs) => {
80
- yargs.command(
81
- 'upload <directories...>',
82
- 'Upload sourcemaps from a directory',
83
- (yargs) => yargs
84
- .positional('directories', { describe: 'Path to directory containing sourcemap files' })
85
- .option('apiKey', { describe: 'Multiplayer personal user API key (MULTIPLAYER_API_KEY)', type: 'string' })
86
- .option('service', { describe: 'Service name (SERVICE_NAME)', type: 'string' })
87
- .option('release', { describe: 'Service release (RELEASE)', type: 'string' })
88
- .option('baseUrl', { describe: '[Optional] Base URL (BASE_URL)', type: 'string' }),
89
- (argv) => {
90
- const options = {
91
- apiKey: argv.apiKey || process.env.MULTIPLAYER_API_KEY,
92
- service: argv.service || process.env.SERVICE_NAME,
93
- release: argv.release || process.env.RELEASE,
94
- baseUrl: argv.baseUrl || process.env.BASE_URL,
95
- }
96
- if (!options.apiKey) return exitWithError('A Multiplayer personal user API key is required.', yargs)
97
- if (!options.service) return exitWithError('A service name is required.', yargs)
98
- if (!options.release) return exitWithError('A release is required.', yargs)
99
-
100
- uploadSourcemap(argv.directories, options, handleResult)
101
- },
102
- )
103
- .demandCommand()
104
- .help()
105
- })
106
- .demandCommand()
107
- .help()
108
- .parse()
109
-
110
- function exitWithError(message, yargsInstance) {
111
- yargsInstance.showHelp()
112
- console.error(message)
113
- process.exit(1)
114
- }
package/src/api.js DELETED
@@ -1,97 +0,0 @@
1
- import superagent from 'superagent'
2
-
3
- const MULTIPLAYER_BASE_API_URL = 'https://api.multiplayer.app/v0'
4
-
5
- export const getDefaultBranchId = async (
6
- apiKey,
7
- workspaceId,
8
- projectId,
9
- baseUrl = MULTIPLAYER_BASE_API_URL,
10
- ) => {
11
- const response = await superagent.get(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/branches/default`)
12
- .set('x-api-key', apiKey)
13
-
14
- return response.body?._id
15
- }
16
-
17
- export const getEntityId = async (
18
- apiKey,
19
- workspaceId,
20
- projectId,
21
- branchId,
22
- entityName,
23
- entityType,
24
- baseUrl = MULTIPLAYER_BASE_API_URL,
25
- ) => {
26
- const response = await superagent.get(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/branches/${branchId}/entities?key=${entityName}&type=${entityType}&limit=1&skip=0`)
27
- .set('x-api-key', apiKey)
28
-
29
- const entityId = response.body?.data?.[0]?.entityId
30
- if (!entityId) {
31
- throw new Error(`Entity ${entityName} not found`)
32
- }
33
- return entityId
34
- }
35
-
36
- export const createRelease = async (
37
- apiKey,
38
- workspaceId,
39
- projectId,
40
- payload,
41
- baseUrl = MULTIPLAYER_BASE_API_URL,
42
- ) => {
43
- const response = await superagent.post(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/releases`)
44
- .set('x-api-key', apiKey)
45
- .send(payload)
46
-
47
- return response.body
48
- }
49
-
50
- export const getReleaseId = async (
51
- apiKey,
52
- workspaceId,
53
- projectId,
54
- entityId,
55
- version,
56
- baseUrl = MULTIPLAYER_BASE_API_URL,
57
- ) => {
58
- const response = await superagent.get(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/releases?version=${version}&entity=${entityId}`)
59
- .set('x-api-key', apiKey)
60
-
61
- const versionId = response.body?.data?.[0]?._id
62
- if (!versionId) {
63
- throw new Error(`Version ${version} not found`)
64
- }
65
- return versionId
66
- }
67
-
68
- export const createDeployment = async (
69
- apiKey,
70
- workspaceId,
71
- projectId,
72
- payload,
73
- baseUrl = MULTIPLAYER_BASE_API_URL,
74
- ) => {
75
- const response = await superagent.post(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/deployments`)
76
- .set('x-api-key', apiKey)
77
- .send(payload)
78
-
79
- return response.body
80
- }
81
-
82
- export const uploadSourcemap = async (
83
- apiKey,
84
- workspaceId,
85
- projectId,
86
- releaseId,
87
- filePath,
88
- stream,
89
- baseUrl = MULTIPLAYER_BASE_API_URL,
90
- ) => {
91
- const response = await superagent.post(`${baseUrl}/version/workspaces/${workspaceId}/projects/${projectId}/releases/${releaseId}/sourcemaps`)
92
- .set('x-api-key', apiKey)
93
- .set('Content-disposition', `attachment; filename=${filePath}`)
94
- .attach('file', stream, filePath)
95
-
96
- return response.body
97
- }
@@ -1,70 +0,0 @@
1
- import * as API from '../../api.js'
2
- import { decodeJwtToken } from '../../helper.js'
3
-
4
- export const create = async (options, callback) => {
5
- try {
6
- const {
7
- apiKey,
8
- service,
9
- release,
10
- environment,
11
- baseUrl,
12
- } = options
13
-
14
- const jwtToken = decodeJwtToken(apiKey) || {}
15
-
16
- const branchId = await API.getDefaultBranchId(
17
- apiKey,
18
- jwtToken.workspace,
19
- jwtToken.project,
20
- baseUrl,
21
- )
22
-
23
- const serviceId = await API.getEntityId(
24
- apiKey,
25
- jwtToken.workspace,
26
- jwtToken.project,
27
- branchId,
28
- service,
29
- 'platform_component',
30
- baseUrl,
31
- )
32
-
33
- const releaseId = await API.getReleaseId(
34
- apiKey,
35
- jwtToken.workspace,
36
- jwtToken.project,
37
- serviceId,
38
- release,
39
- baseUrl,
40
- )
41
-
42
- const environmentId = await API.getEntityId(
43
- apiKey,
44
- jwtToken.workspace,
45
- jwtToken.project,
46
- branchId,
47
- environment,
48
- 'environment',
49
- baseUrl,
50
- )
51
-
52
- await API.createDeployment(
53
- apiKey,
54
- jwtToken.workspace,
55
- jwtToken.project,
56
- {
57
- entity: serviceId,
58
- release: releaseId,
59
- environment: environmentId,
60
- },
61
- baseUrl,
62
- )
63
-
64
- callback(null, {
65
- message: 'Deployment created successfully',
66
- })
67
- } catch (err) {
68
- callback(err, null)
69
- }
70
- }
@@ -1,55 +0,0 @@
1
- import * as API from '../../api.js'
2
- import { decodeJwtToken } from '../../helper.js'
3
-
4
- export const create = async (options, callback) => {
5
- try {
6
- const {
7
- apiKey,
8
- service,
9
- release,
10
- commitHash,
11
- repositoryUrl,
12
- releaseNotes,
13
- baseUrl,
14
- } = options
15
-
16
- const jwtToken = decodeJwtToken(apiKey) || {}
17
-
18
- const branchId = await API.getDefaultBranchId(
19
- apiKey,
20
- jwtToken.workspace,
21
- jwtToken.project,
22
- baseUrl,
23
- )
24
-
25
- const serviceId = await API.getEntityId(
26
- apiKey,
27
- jwtToken.workspace,
28
- jwtToken.project,
29
- branchId,
30
- service,
31
- 'platform_component',
32
- baseUrl,
33
- )
34
-
35
- await API.createRelease(
36
- apiKey,
37
- jwtToken.workspace,
38
- jwtToken.project,
39
- {
40
- entity: serviceId,
41
- version: release,
42
- releaseNotes: releaseNotes || '',
43
- commitHash,
44
- repositoryUrl,
45
- },
46
- baseUrl,
47
- )
48
-
49
- callback(null, {
50
- message: 'Release created successfully',
51
- })
52
- } catch (err) {
53
- callback(err, null)
54
- }
55
- }
@@ -1,76 +0,0 @@
1
- import fs from 'fs'
2
- import path from 'path'
3
- import * as API from '../../api.js'
4
- import { decodeJwtToken } from '../../helper.js'
5
-
6
- const collectSourcemaps = (dir) => {
7
- const entries = fs.readdirSync(dir, { withFileTypes: true })
8
- const files = []
9
-
10
- for (const entry of entries) {
11
- const fullPath = path.join(dir, entry.name)
12
- if (entry.isDirectory()) {
13
- files.push(...collectSourcemaps(fullPath))
14
- } else if (entry.isFile() && entry.name.endsWith('.map')) {
15
- files.push(fullPath)
16
- }
17
- }
18
- return files
19
- }
20
-
21
- export const upload = async (directories, options, callback) => {
22
- try {
23
- const { apiKey, service, release, baseUrl } = options
24
-
25
- const jwtToken = decodeJwtToken(apiKey) || {}
26
-
27
- const branchId = await API.getDefaultBranchId(
28
- apiKey,
29
- jwtToken.workspace,
30
- jwtToken.project,
31
- baseUrl,
32
- )
33
-
34
- const serviceId = await API.getEntityId(
35
- apiKey,
36
- jwtToken.workspace,
37
- jwtToken.project,
38
- branchId,
39
- service,
40
- 'platform_component',
41
- baseUrl,
42
- )
43
-
44
- const releaseId = await API.getReleaseId(
45
- apiKey,
46
- jwtToken.workspace,
47
- jwtToken.project,
48
- serviceId,
49
- release,
50
- baseUrl,
51
- )
52
-
53
- const files = directories.flatMap(collectSourcemaps)
54
-
55
- if (files.length === 0) {
56
- return callback(new Error(`No sourcemap files found in directories: ${directories.join(', ')}`), null)
57
- }
58
-
59
- for (const filePath of files) {
60
- const stream = fs.createReadStream(filePath)
61
- await API.uploadSourcemap(
62
- apiKey,
63
- jwtToken.workspace,
64
- jwtToken.project,
65
- releaseId,
66
- filePath,
67
- stream,
68
- baseUrl,
69
- )
70
- }
71
-
72
- callback(null, { message: `Uploaded ${files.length} sourcemap(s) successfully` })
73
- } catch (err) {
74
- callback(err, null)
75
- }
76
- }