@rocket.chat/rest-typings 6.3.0-rc.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +85 -0
  3. package/package.json +37 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # @rocket.chat/rest-typings
2
+
3
+ ## 6.3.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 74aa677088: feat: Add custom OAuth setting to allow merging users to others from distinct services
8
+ - e846d873b7: feat: Introduce Feature Preview page
9
+ - 0645f42e12: Reintroduce an user preference to allow users to see all thread messages in the main channel
10
+
11
+ ### Patch Changes
12
+
13
+ - e14ec50816: Added and Improved Custom Fields form to Registration Flow
14
+ - e006013e5f: chore: New Livechat SDK Implementation
15
+ - eecd9fc99a: fix: Omnichannel Tags available to be used in the wrong department
16
+ - 6a474ff952: Refactored Omnichannel department pages to use best practices, also fixed existing bugs
17
+ - 9da856cc67: fix: Resume on-hold chat not working with max-chat's allowed per agent config
18
+ - 12d97e16c2: feat: Allow Incoming Webhooks to override destination channel
19
+ - Updated dependencies [e14ec50816]
20
+ - Updated dependencies [9da856cc67]
21
+ - Updated dependencies [12d97e16c2]
22
+ - @rocket.chat/core-typings@6.3.0-rc.0
23
+
24
+ ## 6.2.6
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies []:
29
+ - @rocket.chat/core-typings@6.2.6
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+
2
+ # @rocket.chat/rest-typings
3
+
4
+ Package containing all Rocket.Chat rest endpoint definitions
5
+
6
+
7
+ ## Contributing
8
+
9
+ Contributions are always welcome!
10
+ However we have some recommendations.
11
+ - Check if your implementation matches your definitions, a bad definition is worse than none.
12
+ - Use the generic types we created for paging.
13
+ - Create functions that assert properties (very useful for the backend)
14
+ - Do tests to ensure that your assertions are correct.
15
+ - Avoid incomplete and unknow typings
16
+
17
+ ### Good examples of what not to do:
18
+
19
+ #### If you have an endpoint that accepts name or id, both are not optional, one of them is required
20
+
21
+ ```typescript
22
+
23
+ type EndPointTestGetParams = { name?: string; id?: string; } // WRONG!
24
+
25
+ type EndPointTestGetParams = { name: string; } | { id: string; } // Better :)
26
+ ````
27
+
28
+ #### If you have an endpoint that accepts name or id, both are not optional, one of them is required
29
+
30
+ ```typescript
31
+ export const isEndPointTestGetParams = (props: any) is EndPointTestGetParams => 'name' in prop || 'id' in prop; // WRONG!
32
+
33
+ // .... Better
34
+
35
+
36
+ import Ajv from 'ajv';
37
+
38
+ const ajv = new Ajv();
39
+ const endPointTestGetParams = {
40
+ oneOf: [
41
+ {
42
+ type: 'object',
43
+ properties: {
44
+ name: {
45
+ type: 'string',
46
+ },
47
+ },
48
+ required: ['name'],
49
+ additionalProperties: false,
50
+ },
51
+ {
52
+ type: 'object',
53
+ properties: {
54
+ id: {
55
+ type: 'string',
56
+ },
57
+ },
58
+ required: ['id'],
59
+ additionalProperties: false,
60
+ },
61
+ ],
62
+ };
63
+
64
+ export const isEndPointTestGetParams = ajv.compile<EndPointTestGetParams>(endPointTestGetParams);
65
+ ```
66
+ ## Optimizations
67
+
68
+ we use interfaces to register endpoints, so if you use a custom version, or miss an endpoint, you don't necessarily need to recompile the code, you can do it in your own code
69
+
70
+ ```typescript
71
+ declare module '@rocket.chat/rest-typings' {
72
+ interface Endpoints {
73
+ 'custom/endpoint': {
74
+ GET: (params: PaginatedRequest<{ query: string }>) => PaginatedResult<{
75
+ some: string[];
76
+ }>;
77
+ };
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## License
83
+
84
+ MIT
85
+
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@rocket.chat/rest-typings",
3
+ "version": "6.3.0-rc.0",
4
+ "devDependencies": {
5
+ "@rocket.chat/eslint-config": "^0.5.0",
6
+ "@types/jest": "~29.5.2",
7
+ "eslint": "~8.43.0",
8
+ "jest": "~29.5.0",
9
+ "jest-environment-jsdom": "~29.5.0",
10
+ "mongodb": "^4.12.1",
11
+ "ts-jest": "~29.0.5",
12
+ "typescript": "~5.1.3"
13
+ },
14
+ "scripts": {
15
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx .",
16
+ "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
17
+ "test": "jest",
18
+ "dev": "tsc --watch --preserveWatchOutput -p tsconfig.json",
19
+ "build": "rm -rf dist && tsc -p tsconfig.json"
20
+ },
21
+ "main": "./dist/index.js",
22
+ "typings": "./dist/index.d.ts",
23
+ "files": [
24
+ "/dist"
25
+ ],
26
+ "dependencies": {
27
+ "@rocket.chat/apps-engine": "1.39.1",
28
+ "@rocket.chat/core-typings": "^6.3.0-rc.0",
29
+ "@rocket.chat/message-parser": "next",
30
+ "@rocket.chat/ui-kit": "next",
31
+ "ajv": "^8.11.0",
32
+ "ajv-formats": "^2.1.1"
33
+ },
34
+ "volta": {
35
+ "extends": "../../package.json"
36
+ }
37
+ }