fsd-vod 0.11.0 → 0.12.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.
package/index.d.ts CHANGED
@@ -120,13 +120,47 @@ export interface UploadTokenWithAutoRefresh {
120
120
  }
121
121
 
122
122
  export default class VODAdpter extends Adapter<VODAdapterOptions> {
123
- createUploadToken: (videoId: string, meta?: any) => Promise<UploadToken>;
123
+ /**
124
+ * 创建上传凭证
125
+ * @param {string} videoId 视频ID
126
+ * @param {any} [meta] 文件元信息
127
+ * @param {number} [durationSeconds] 上传凭证有效期,单位秒, 默认 3600
128
+ */
129
+ createUploadToken: (
130
+ videoId: string,
131
+ meta?: any,
132
+ durationSeconds?: number
133
+ ) => Promise<UploadToken>;
134
+
135
+ /**
136
+ * 创建带自动刷新的上传凭证
137
+ * @param {string} videoId 视频ID
138
+ * @param {any} [meta] 文件元信息
139
+ * @param {number} [durationSeconds] 上传凭证有效期,单位秒, 默认 3600
140
+ */
124
141
  createUploadTokenWithAutoRefresh: (
125
142
  videoId: string,
126
- meta?: any
143
+ meta?: any,
144
+ durationSeconds?: number
127
145
  ) => Promise<UploadTokenWithAutoRefresh>;
128
146
 
147
+ /**
148
+ * 获取视频信息
149
+ * @param {string} videoId 视频ID
150
+ */
129
151
  getVideoInfo(videoId: string): Promise<null | VideoInfo>;
152
+
153
+ /**
154
+ * 获取视频播放信息
155
+ * @param {string} videoId 视频ID
156
+ * @param {any} [options] 参数选项
157
+ */
130
158
  getMezzanineInfo(videoId: string, options?: any): Promise<null | MezzanineInfo>;
159
+
160
+ /**
161
+ * 获取视频播放信息
162
+ * @param {string} videoId 视频ID
163
+ * @param {any} [options] 参数选项
164
+ */
131
165
  getPlayInfo(videoId: string, options?: any): Promise<null | PlayInfoResult>;
132
166
  }
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const LRUCache = require("lru-cache");
3
+ const lru_cache_1 = require("lru-cache");
4
4
  const Debugger = require("debug");
5
5
  const RPC = require("@alicloud/pop-core");
6
6
  const stream_1 = require("stream");
@@ -34,13 +34,13 @@ class VODAdapter {
34
34
  if (!options.accessKeySecret)
35
35
  throw new Error('option accessKeySecret is required for fsd-vod');
36
36
  this._options = options;
37
- this._authCache = new LRUCache({
37
+ this._authCache = new lru_cache_1.LRUCache({
38
38
  max: 1000,
39
- maxAge: 1800000
39
+ ttl: 1800000
40
40
  });
41
- this._videoCache = new LRUCache({
41
+ this._videoCache = new lru_cache_1.LRUCache({
42
42
  max: 1000,
43
- maxAge: 60000
43
+ ttl: 60000
44
44
  });
45
45
  this._rpc = new RPC({
46
46
  accessKeyId: options.accessKeyId,
@@ -74,10 +74,10 @@ class VODAdapter {
74
74
  if (result.Message)
75
75
  throw new Error(result.Message);
76
76
  let token = resultToCache(result);
77
- this._authCache.set(result.VideoId, token, token.expiration);
77
+ this._authCache.set(result.VideoId, token, { ttl: token.expiration });
78
78
  return result.VideoId;
79
79
  };
80
- this.createUploadToken = async (videoId, meta) => {
80
+ this.createUploadToken = async (videoId, meta, durationSeconds) => {
81
81
  if (videoId[0] === '/')
82
82
  videoId = videoId.substring(1);
83
83
  let token = this._authCache.get(videoId);
@@ -90,7 +90,7 @@ class VODAdapter {
90
90
  if (result.Message)
91
91
  throw new Error(result.Message);
92
92
  token = resultToCache(result);
93
- this._authCache.set(videoId, token, token.expiration);
93
+ this._authCache.set(videoId, token, { ttl: token.expiration });
94
94
  }
95
95
  if (options.callbackUrl && meta) {
96
96
  token.callback = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fsd-vod",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Aliyun OSS adapter for fsd",
5
5
  "main": "lib/index.js",
6
6
  "types": "index.d.ts",
@@ -13,10 +13,10 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "@alicloud/pop-core": "^1.7.12",
16
- "akita": "^1.0.3",
16
+ "akita": "^1.0.4",
17
17
  "debug": "^4.3.4",
18
- "fsd-oss": "^0.11.0",
19
- "lru-cache": "^6.0.0"
18
+ "fsd-oss": "^0.12.0",
19
+ "lru-cache": "^9.1.1"
20
20
  },
21
- "gitHead": "8d7862c11a96e4df36805d8b1acbb39aac5a4213"
21
+ "gitHead": "ad01afd0117496a9b857e566a404f0ececbd723d"
22
22
  }