Add platform/mattermost-redux package for publishing (#30020)
* Replace key-mirror with mattermost-redux/utils/key_mirror At some point, we made our own version for mattermost-redux with proper type definitions but we seem to have forgotten to use that everywhere in the web app. * Remove Rudder reference from mattermost-redux * Remove Giphy API from mattermost-redux * Remove mattermost-webapp refernces from Client and Types packages * Create platform/mattermost-redux without moving its source files * Don't build mattermost-redux automatically * Copy changes to package.json from platform/mattermost-redux to other packages The changes to the typesVersions and exports fields are to make it easier for tooling to know to make it so that importing a folder imports the index file inside that folder since that's not standard to all CommonJS packages. The added type field is just a good pracice. * Explicitly type re-exported selectors For some reason, the types generated by the previous version of this didn't work when mattermost-redux was built as a standalone package. Explicitly typing these is a bit more verbose, but it fixes things. * Fix import loop in selectors introduced by last commit * Update package versions to 10.6.0 * Add explicit dependencies to mattermost-redux package * Remove check and run scripts from mattermost-redux package * Revert changes to NOTICE.txt
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f52e08754c
Коммит
86aad9d0a5
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@mattermost/client",
|
||||
"version": "9.3.0",
|
||||
"version": "10.6.0",
|
||||
"description": "JavaScript/TypeScript client for Mattermost",
|
||||
"keywords": [
|
||||
"mattermost"
|
||||
],
|
||||
"homepage": "https://github.com/mattermost/mattermost/tree/master/webapp/platform/client#readme",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
import {
|
||||
TrackPropertyUser,
|
||||
TrackPropertyUserAgent, TrackScheduledPostsFeature,
|
||||
} from 'mattermost-webapp/src/packages/mattermost-redux/src/constants/telemetry';
|
||||
|
||||
import type {ClusterInfo, AnalyticsRow, SchemaMigration, LogFilterQuery} from '@mattermost/types/admin';
|
||||
import type {AppBinding, AppCallRequest, AppCallResponse} from '@mattermost/types/apps';
|
||||
import type {Audit} from '@mattermost/types/audits';
|
||||
@@ -2125,7 +2120,7 @@ export default class Client4 {
|
||||
`${this.getPostsRoute()}`,
|
||||
{method: 'post', body: JSON.stringify(post)},
|
||||
);
|
||||
const analyticsData = {channel_id: result.channel_id, post_id: result.id, [TrackPropertyUser]: result.user_id, root_id: result.root_id} as PostAnalytics;
|
||||
const analyticsData = {channel_id: result.channel_id, post_id: result.id, user_actual_id: result.user_id, root_id: result.root_id} as PostAnalytics;
|
||||
if (post.metadata?.priority) {
|
||||
analyticsData.priority = post.metadata.priority.priority;
|
||||
analyticsData.requested_ack = post.metadata.priority.requested_ack;
|
||||
@@ -3760,7 +3755,7 @@ export default class Client4 {
|
||||
context: {
|
||||
...call.context,
|
||||
track_as_submit: trackAsSubmit,
|
||||
[TrackPropertyUserAgent]: 'webapp',
|
||||
user_agent: 'webapp',
|
||||
},
|
||||
};
|
||||
return this.doFetch<AppCallResponse>(
|
||||
@@ -3773,7 +3768,7 @@ export default class Client4 {
|
||||
const params = {
|
||||
channel_id: channelID,
|
||||
team_id: teamID,
|
||||
[TrackPropertyUserAgent]: 'webapp',
|
||||
user_agent: 'webapp',
|
||||
};
|
||||
|
||||
return this.doFetch<AppBinding[]>(
|
||||
@@ -4296,7 +4291,7 @@ export default class Client4 {
|
||||
|
||||
// Schedule Post methods
|
||||
createScheduledPost = (schedulePost: PartialExcept<ScheduledPost, 'channel_id' | 'message' | 'scheduled_at'>, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'create_scheduled_post', {[TrackPropertyUser]: schedulePost.user_id, [TrackPropertyUserAgent]: 'desktop'});
|
||||
this.trackFeatureEvent('scheduled_posts', 'create_scheduled_post', {actual_user_id: schedulePost.user_id, user_agent: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule`,
|
||||
@@ -4313,7 +4308,7 @@ export default class Client4 {
|
||||
};
|
||||
|
||||
updateScheduledPost = (schedulePost: ScheduledPost, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'update_scheduled_post', {[TrackPropertyUser]: schedulePost.user_id, [TrackPropertyUserAgent]: 'desktop'});
|
||||
this.trackFeatureEvent('scheduled_posts', 'update_scheduled_post', {actual_user_id: schedulePost.user_id, user_agent: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule/${schedulePost.id}`,
|
||||
@@ -4322,7 +4317,7 @@ export default class Client4 {
|
||||
};
|
||||
|
||||
deleteScheduledPost = (userId: string, schedulePostId: string, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'delete_scheduled_post', {[TrackPropertyUser]: userId, [TrackPropertyUserAgent]: 'desktop'});
|
||||
this.trackFeatureEvent('scheduled_posts', 'delete_scheduled_post', {actual_user_id: userId, user_agent: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule/${schedulePostId}`,
|
||||
|
||||
11
webapp/platform/mattermost-redux/README.md
Обычный файл
11
webapp/platform/mattermost-redux/README.md
Обычный файл
@@ -0,0 +1,11 @@
|
||||
# mattermost-redux
|
||||
|
||||
This package contains a large part of the [Redux](http://redux.js.org) code and some utilities used by [the Mattermost web app](https://github.com/mattermost/mattermost/tree/master/webapp/channels) for usage in Mattermost plugins and other related projects.
|
||||
|
||||
This code doesn't strictly follow semantic versioning as it is mostly internal code to Mattermost, and it will feature breaking changes outside of major releases, but it can be considered stable for the most part.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install mattermost-redux @mattermost/types @mattermost/client
|
||||
```
|
||||
59
webapp/platform/mattermost-redux/package.json
Обычный файл
59
webapp/platform/mattermost-redux/package.json
Обычный файл
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "mattermost-redux",
|
||||
"version": "10.6.0",
|
||||
"description": "Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client",
|
||||
"keywords": [
|
||||
"mattermost"
|
||||
],
|
||||
"homepage": "https://github.com/mattermost/mattermost/tree/master/webapp/platform/mattermost-redux#readme",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"exports": {
|
||||
"./*": [
|
||||
"./lib/*/index.js",
|
||||
"./lib/*.js"
|
||||
]
|
||||
},
|
||||
"typesVersions": {
|
||||
">=3.1": {
|
||||
"*": [
|
||||
"./lib/*.d.ts",
|
||||
"./lib/*/index.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mattermost/mattermost.git",
|
||||
"directory": "webapp/platform/mattermost-redux"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mattermost/client": "10.6.0",
|
||||
"@mattermost/types": "10.6.0",
|
||||
"@redux-devtools/extension": "^3.2.3",
|
||||
"lodash": "^4.17.21",
|
||||
"moment-timezone": "^0.5.38",
|
||||
"redux": "^4.2.0",
|
||||
"redux-batched-actions": "^0.5.0",
|
||||
"redux-thunk": "^2.4.2",
|
||||
"serialize-error": "^11.0.3",
|
||||
"shallow-equals": "^1.0.0",
|
||||
"timezones.json": "^1.7.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^4.3.0 || ^5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --build --verbose",
|
||||
"postbuild": "cp ../../channels/src/packages/mattermost-redux/src/selectors/create_selector/index.d.ts lib/selectors/create_selector/index.d.ts",
|
||||
"clean": "rm -rf lib node_modules *.tsbuildinfo"
|
||||
}
|
||||
}
|
||||
32
webapp/platform/mattermost-redux/tsconfig.json
Обычный файл
32
webapp/platform/mattermost-redux/tsconfig.json
Обычный файл
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"target": "ES2022",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"declaration": true,
|
||||
"strict": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "react",
|
||||
"outDir": "./lib",
|
||||
"rootDir": "../../channels/src/packages/mattermost-redux/src",
|
||||
"composite": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"tsBuildInfoFile": "tsconfig.tsbuildinfo",
|
||||
"paths": {
|
||||
"mattermost-redux/*": ["../../channels/src/packages/mattermost-redux/src/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"../../channels/src/packages/mattermost-redux/src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"../../**/*.test.*"
|
||||
]
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@mattermost/types",
|
||||
"version": "9.3.0",
|
||||
"version": "10.6.0",
|
||||
"description": "Shared type definitions used by the Mattermost web app",
|
||||
"keywords": [
|
||||
"mattermost"
|
||||
],
|
||||
"homepage": "https://github.com/mattermost/mattermost/tree/master/webapp/platform/types#readme",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
@@ -16,7 +17,8 @@
|
||||
"typesVersions": {
|
||||
">=3.1": {
|
||||
"*": [
|
||||
"./lib/*.d.ts"
|
||||
"./lib/*.d.ts",
|
||||
"./lib/*/index.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import type {TrackPropertyUser} from 'mattermost-webapp/src/packages/mattermost-redux/src/constants/telemetry';
|
||||
|
||||
import type {Channel, ChannelType} from './channels';
|
||||
import type {CustomEmoji} from './emojis';
|
||||
import type {FileInfo} from './files';
|
||||
@@ -201,7 +199,7 @@ export declare type TeamsUsageResponse = {
|
||||
export type PostAnalytics = {
|
||||
channel_id: string;
|
||||
post_id: string;
|
||||
[TrackPropertyUser]: string;
|
||||
user_actual_id: string;
|
||||
root_id: string;
|
||||
priority?: PostPriority|'';
|
||||
requested_ack?: boolean;
|
||||
|
||||
Ссылка в новой задаче
Block a user