@ray-js/api 1.7.10 → 1.7.12

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,40 @@
1
+ import { Audio, FileInfo, FileSign, UploadState } from './interface';
2
+ /**
3
+ * 删除文件
4
+ */
5
+ declare const deleteDeviceFile: (fileNos: string[], devId: string) => Promise<boolean>;
6
+ /**
7
+ * 获取文件详情
8
+ */
9
+ declare const fetchDeviceFileDetail: (fileNo: string, devId: string) => Promise<Audio>;
10
+ /**
11
+ * 获取临时地址上传签名
12
+ */
13
+ declare const fetchDeviceFileSign: (bizType: string, fileName: string, contentType: string) => Promise<FileSign>;
14
+ /**
15
+ * 获取上传状态
16
+ */
17
+ declare const fetchDeviceFileUploadState: (uploadToken: string) => Promise<UploadState>;
18
+ /**
19
+ * 轮训大文件上传状态
20
+ */
21
+ declare const fetchBigPublicFileUploadState: (pollingToken: string) => Promise<UploadState>;
22
+ /**
23
+ * 获取宠物媒体文件
24
+ */
25
+ declare const fetchPetAudios: (devId: string) => Promise<{
26
+ data: Audio[];
27
+ }>;
28
+ /**
29
+ * 宠物媒体文件下载
30
+ */
31
+ declare const notifyDownload: (fileNo: string, devId: string) => Promise<boolean>;
32
+ /**
33
+ * 宠物媒体文件保存
34
+ */
35
+ declare const fileRelationSave: (fileInfo: FileInfo, devId: any) => Promise<{
36
+ headers: any;
37
+ token: string;
38
+ action: string;
39
+ }>;
40
+ export { deleteDeviceFile, fetchDeviceFileDetail, fetchPetAudios, notifyDownload, fileRelationSave, fetchDeviceFileSign, fetchDeviceFileUploadState, fetchBigPublicFileUploadState, };
@@ -0,0 +1,99 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { THING } from '../constants';
3
+ import { requestFunc } from './highlights';
4
+
5
+ /**
6
+ * 删除文件
7
+ */
8
+ const deleteDeviceFile = (fileNos, devId) => {
9
+ return requestFunc(`m.ha.storage.device.file.delete.notify`, {
10
+ devId,
11
+ fileInfo: {
12
+ fileNos,
13
+ sceneCode: 'pet_media-device'
14
+ }
15
+ }, '1.0');
16
+ };
17
+
18
+ /**
19
+ * 获取文件详情
20
+ */
21
+ const fetchDeviceFileDetail = (fileNo, devId) => {
22
+ return requestFunc(`m.ha.storage.device.file.upload.get`, {
23
+ devId,
24
+ fileInfo: {
25
+ fileNo
26
+ }
27
+ }, '1.0');
28
+ };
29
+
30
+ /**
31
+ * 获取临时地址上传签名
32
+ */
33
+ const fetchDeviceFileSign = (bizType, fileName, contentType) => {
34
+ return requestFunc(`${THING}.open.iot.upload.sign.get`, {
35
+ biz: bizType,
36
+ uploadFileName: fileName,
37
+ contentType
38
+ }, '3.0');
39
+ };
40
+
41
+ /**
42
+ * 获取上传状态
43
+ */
44
+ const fetchDeviceFileUploadState = uploadToken => {
45
+ return requestFunc(`${THING}.open.iot.upload.file.check`, {
46
+ uploadToken
47
+ }, '1.0');
48
+ };
49
+
50
+ /**
51
+ * 轮训大文件上传状态
52
+ */
53
+ const fetchBigPublicFileUploadState = pollingToken => {
54
+ return requestFunc(`${THING}.open.iot.upload.file.big.public.get`, {
55
+ pollingToken
56
+ }, '1.0');
57
+ };
58
+
59
+ /**
60
+ * 获取宠物媒体文件
61
+ */
62
+ const fetchPetAudios = devId => {
63
+ return requestFunc('m.ha.storage.device.file.upload.list', {
64
+ devId,
65
+ fileInfo: {
66
+ sceneCode: 'pet_media-device',
67
+ pageNo: 1,
68
+ pageSize: 10
69
+ }
70
+ }, '1.0');
71
+ };
72
+
73
+ /**
74
+ * 宠物媒体文件下载
75
+ */
76
+ const notifyDownload = (fileNo, devId) => {
77
+ return requestFunc('m.ha.storage.device.file.download.submit', {
78
+ devId,
79
+ fileInfo: {
80
+ fileNos: fileNo,
81
+ sceneCode: 'pet_media-device'
82
+ }
83
+ }, '1.0');
84
+ };
85
+
86
+ /**
87
+ * 宠物媒体文件保存
88
+ */
89
+ const fileRelationSave = (fileInfo, devId) => {
90
+ return requestFunc('m.ha.storage.device.file.relation.save', {
91
+ devId,
92
+ fileInfo: _objectSpread({
93
+ encryptType: 0,
94
+ fileType: 'wav',
95
+ sceneCode: 'pet_media-device'
96
+ }, fileInfo)
97
+ }, '1.0');
98
+ };
99
+ export { deleteDeviceFile, fetchDeviceFileDetail, fetchPetAudios, notifyDownload, fileRelationSave, fetchDeviceFileSign, fetchDeviceFileUploadState, fetchBigPublicFileUploadState };
@@ -1,4 +1,11 @@
1
1
  import { AiVisualBox, AiVisualNeedCopyQueryParams, AiVisualNeedCopyQueryResult, AlbumSettingEditReq, AlbumSettingSaveReq, CustomEventCheckParams, CustomEventCheckResult, CustomVisionEventCheckParams, CustomVisionEventCheckRet, DeleteAiVisualMessageList, DeviceDetails, DeviceServiceConfigItemDto, GetAiVisualBoxInfoParams, GetAiVisualMessageKey, GetAiVisualMessageKeyRes, GetAiVisualPresetEventParams, GetAlbumSettingReq, GetDeviceConfigParams, GetDeviceConfigResult, GetMessageListRes, GetSmartEventSwitchStateParams, GetSmartEventSwitchStateResult, IAlbumFileDeleteReq, IAlbumFileDeleteRes, IAlbumVideoDateCountReq, IAlbumVideoDateCountRes, IAlbumVideoFileDetailReq, IAlbumVideoFileDetailRes, IAlbumVideoFileListReq, IAlbumVideoFileListRes, Options, PresetEvent, QueryBindDeviceDto, QueryCameraListDto, QueryGetAiVisualList, QueryGetAiVisualReportList, QueryGetDeviceDetailsById, QueryGetMessageList, QueryServiceDetailDto, ResBindDeviceDto, SaveAiVisualBoxInfoParams, ServiceDetailDto, TimeAlbumSettingDto, UpdateDeviceConfigParams, UpdateSwitchStateParams, VisionBoxDto, VisionBoxReport } from './interface';
2
+ /**
3
+ transError 为 true 的情况下走到
4
+ apiRequestByAtop 的 fail 回调时
5
+ 会 resolve false
6
+ 为 false 的情况下则 reject 错误信息
7
+ */
8
+ export declare const requestFunc: <T = any>(a: any, postData: any, v?: string, options?: Options) => Promise<T>;
2
9
  /**
3
10
  * 获取 App 面板内静态资源地址
4
11
  */
@@ -29,7 +29,7 @@ const JsonUtil = {
29
29
  会 resolve false
30
30
  为 false 的情况下则 reject 错误信息
31
31
  */
32
- const requestFunc = function (a, postData) {
32
+ export const requestFunc = function (a, postData) {
33
33
  let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
34
34
  let options = arguments.length > 3 ? arguments[3] : undefined;
35
35
  return new Promise((resolve, reject) => {
@@ -5,6 +5,7 @@ export * from './statistic';
5
5
  export * from './device';
6
6
  export * from './linkage';
7
7
  export * from './highlights';
8
+ export * from './deviceFile';
8
9
  export * from './remoteGroup';
9
10
  export * from './outdoor';
10
11
  export * from './doorlock';
@@ -5,6 +5,7 @@ export * from './statistic';
5
5
  export * from './device';
6
6
  export * from './linkage';
7
7
  export * from './highlights';
8
+ export * from './deviceFile';
8
9
  export * from './remoteGroup';
9
10
 
10
11
  // 仅用于出行产品
@@ -1899,4 +1899,21 @@ export interface IAlbumVideoFileDetailReq {
1899
1899
  timeAlbumRecordId: number;
1900
1900
  }
1901
1901
  export type IAlbumVideoFileDetailRes = IAlbumVideoFileList;
1902
+ export type Audio = {
1903
+ fileNo: string;
1904
+ fileName: string;
1905
+ publicUrl?: string;
1906
+ };
1907
+ export type FileInfo = {
1908
+ objectKey: string;
1909
+ fileName: string;
1910
+ };
1911
+ export type FileSign = {
1912
+ action: string;
1913
+ token: string;
1914
+ };
1915
+ export type UploadState = {
1916
+ bizUrl?: string;
1917
+ pollingToken?: string;
1918
+ };
1902
1919
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,14 +29,14 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.7.10",
33
- "@ray-js/router": "1.7.10",
32
+ "@ray-js/framework": "1.7.12",
33
+ "@ray-js/router": "1.7.12",
34
34
  "@ray-js/wechat": "^0.3.8",
35
35
  "base64-browser": "^1.0.1",
36
36
  "query-string": "^7.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@ray-js/cli": "1.7.10",
39
+ "@ray-js/cli": "1.7.12",
40
40
  "art-template": "^4.13.4",
41
41
  "fs-extra": "^10.1.0",
42
42
  "miniprogram-api-typings": "^3.12.3",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.com"
48
48
  },
49
- "gitHead": "47adc13b06111a27e3a719a1e02dd118c6e365d9"
49
+ "gitHead": "511cd3f8d57c2888411700526781e65959037c5b"
50
50
  }
package/LICENSE.md DELETED
@@ -1,9 +0,0 @@
1
- Copyright © 2014-2022 Tuya.inc
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.