@celljs/cloud 3.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.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/cell.yml +0 -0
- package/lib/common/account-protocol.d.ts +8 -0
- package/lib/common/account-protocol.d.ts.map +1 -0
- package/lib/common/account-protocol.js +5 -0
- package/lib/common/account-protocol.js.map +1 -0
- package/lib/common/client-protocol.d.ts +10 -0
- package/lib/common/client-protocol.d.ts.map +1 -0
- package/lib/common/client-protocol.js +5 -0
- package/lib/common/client-protocol.js.map +1 -0
- package/lib/common/cloud-protocol.d.ts +23 -0
- package/lib/common/cloud-protocol.d.ts.map +1 -0
- package/lib/common/cloud-protocol.js +60 -0
- package/lib/common/cloud-protocol.js.map +1 -0
- package/lib/common/credentials-protocol.d.ts +10 -0
- package/lib/common/credentials-protocol.d.ts.map +1 -0
- package/lib/common/credentials-protocol.js +5 -0
- package/lib/common/credentials-protocol.js.map +1 -0
- package/lib/common/index.d.ts +7 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +23 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/object-storage-protocol.d.ts +128 -0
- package/lib/common/object-storage-protocol.d.ts.map +1 -0
- package/lib/common/object-storage-protocol.js +14 -0
- package/lib/common/object-storage-protocol.js.map +1 -0
- package/lib/common/region-protocol.d.ts +5 -0
- package/lib/common/region-protocol.d.ts.map +1 -0
- package/lib/common/region-protocol.js +5 -0
- package/lib/common/region-protocol.js.map +1 -0
- package/lib/node/account-provider.d.ts +6 -0
- package/lib/node/account-provider.d.ts.map +1 -0
- package/lib/node/account-provider.js +28 -0
- package/lib/node/account-provider.js.map +1 -0
- package/lib/node/client-options-provider.d.ts +6 -0
- package/lib/node/client-options-provider.d.ts.map +1 -0
- package/lib/node/client-options-provider.js +28 -0
- package/lib/node/client-options-provider.js.map +1 -0
- package/lib/node/credentials-provider.d.ts +6 -0
- package/lib/node/credentials-provider.d.ts.map +1 -0
- package/lib/node/credentials-provider.js +28 -0
- package/lib/node/credentials-provider.js.map +1 -0
- package/lib/node/index.d.ts +5 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +21 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/regin-provider.d.ts +6 -0
- package/lib/node/regin-provider.d.ts.map +1 -0
- package/lib/node/regin-provider.js +28 -0
- package/lib/node/regin-provider.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +41 -0
- package/src/common/account-protocol.ts +9 -0
- package/src/common/client-protocol.ts +11 -0
- package/src/common/cloud-protocol.ts +64 -0
- package/src/common/credentials-protocol.ts +11 -0
- package/src/common/index.ts +6 -0
- package/src/common/object-storage-protocol.ts +143 -0
- package/src/common/region-protocol.ts +5 -0
- package/src/node/account-provider.ts +14 -0
- package/src/node/client-options-provider.ts +14 -0
- package/src/node/credentials-provider.ts +14 -0
- package/src/node/index.ts +4 -0
- package/src/node/module.ts +4 -0
- package/src/node/regin-provider.ts +13 -0
- package/src/package.spec.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Cellbang
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Cell - cloud Component
|
package/cell.yml
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-protocol.d.ts","sourceRoot":"","sources":["../../src/common/account-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,eAA4B,CAAC;AAEzD,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-protocol.js","sourceRoot":"","sources":["../../src/common/account-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const ClientOptionsProvider: unique symbol;
|
|
2
|
+
export interface ClientOptions {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
internal?: boolean;
|
|
5
|
+
apiVersion?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ClientOptionsProvider {
|
|
8
|
+
provide(): Promise<ClientOptions | undefined>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=client-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-protocol.d.ts","sourceRoot":"","sources":["../../src/common/client-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAA;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-protocol.js","sourceRoot":"","sources":["../../src/common/client-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Account, AccountProvider } from './account-protocol';
|
|
2
|
+
import { ClientOptions, ClientOptionsProvider } from './client-protocol';
|
|
3
|
+
import { Credentials, CredentialsProvider } from './credentials-protocol';
|
|
4
|
+
import { RegionProvider } from './region-protocol';
|
|
5
|
+
export interface CloudService<T extends RawCloudService> {
|
|
6
|
+
name: string;
|
|
7
|
+
getRawCloudService(): Promise<T>;
|
|
8
|
+
setRawCloudService(innerService: T): void;
|
|
9
|
+
}
|
|
10
|
+
export interface RawCloudService {
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class AbstractCloudService<T extends RawCloudService> implements CloudService<T> {
|
|
13
|
+
name: string;
|
|
14
|
+
protected readonly regionProvider: RegionProvider;
|
|
15
|
+
protected readonly credentialsProvider: CredentialsProvider;
|
|
16
|
+
protected readonly accountProvider: AccountProvider;
|
|
17
|
+
protected readonly clientOptionsProvider: ClientOptionsProvider;
|
|
18
|
+
protected _rawCloudService: T;
|
|
19
|
+
getRawCloudService(): Promise<T>;
|
|
20
|
+
setRawCloudService(rawCloudService: T): void;
|
|
21
|
+
protected abstract doCreateRawCloudService(credentials: Credentials, region: string, clientOptions: ClientOptions, account?: Account): Promise<T>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=cloud-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-protocol.d.ts","sourceRoot":"","sources":["../../src/common/cloud-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,eAAe;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACjC,kBAAkB,CAAC,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;CAE/B;AAED,8BAAsB,oBAAoB,CAAC,CAAC,SAAS,eAAe,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAE5F,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAG5D,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAEhE,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAExB,kBAAkB,IAAI,OAAO,CAAC,CAAC,CAAC;IAuBtC,kBAAkB,CAAC,eAAe,EAAE,CAAC,GAAG,IAAI;IAI5C,SAAS,CAAC,QAAQ,CAAC,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAEpJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AbstractCloudService = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const account_protocol_1 = require("./account-protocol");
|
|
15
|
+
const client_protocol_1 = require("./client-protocol");
|
|
16
|
+
const credentials_protocol_1 = require("./credentials-protocol");
|
|
17
|
+
const region_protocol_1 = require("./region-protocol");
|
|
18
|
+
class AbstractCloudService {
|
|
19
|
+
async getRawCloudService() {
|
|
20
|
+
if (!this._rawCloudService) {
|
|
21
|
+
const accountProp = `cell.cloud.${this.name}.account`;
|
|
22
|
+
const clientProp = `cell.cloud.${this.name}.client`;
|
|
23
|
+
const regionProp = `cell.cloud.${this.name}.region`;
|
|
24
|
+
const credentialsProp = `cell.cloud.${this.name}.credentials`;
|
|
25
|
+
const account = core_1.ConfigUtil.get(accountProp) || await this.accountProvider.provide();
|
|
26
|
+
const clientOptions = core_1.ConfigUtil.get(clientProp) || await this.clientOptionsProvider.provide() || { internal: true };
|
|
27
|
+
const region = core_1.ConfigUtil.get(regionProp) || await this.regionProvider.provide();
|
|
28
|
+
if (!region) {
|
|
29
|
+
throw Error(`Please configure region through the properties "cell.cloud.region" or "${regionProp}"`);
|
|
30
|
+
}
|
|
31
|
+
const credentials = core_1.ConfigUtil.get(credentialsProp) || await this.credentialsProvider.provide();
|
|
32
|
+
if (!credentials) {
|
|
33
|
+
throw Error(`Please configure credentials through the properties "cell.cloud.credentials" or "${credentialsProp}"`);
|
|
34
|
+
}
|
|
35
|
+
this._rawCloudService = await this.doCreateRawCloudService(credentials, region, clientOptions, account);
|
|
36
|
+
}
|
|
37
|
+
return this._rawCloudService;
|
|
38
|
+
}
|
|
39
|
+
setRawCloudService(rawCloudService) {
|
|
40
|
+
this._rawCloudService = rawCloudService;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, core_1.Autowired)(region_protocol_1.RegionProvider),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], AbstractCloudService.prototype, "regionProvider", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, core_1.Autowired)(credentials_protocol_1.CredentialsProvider),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], AbstractCloudService.prototype, "credentialsProvider", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, core_1.Autowired)(account_protocol_1.AccountProvider),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], AbstractCloudService.prototype, "accountProvider", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, core_1.Autowired)(client_protocol_1.ClientOptionsProvider),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], AbstractCloudService.prototype, "clientOptionsProvider", void 0);
|
|
59
|
+
exports.AbstractCloudService = AbstractCloudService;
|
|
60
|
+
//# sourceMappingURL=cloud-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-protocol.js","sourceRoot":"","sources":["../../src/common/cloud-protocol.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAqD;AACrD,yDAA8D;AAC9D,uDAAyE;AACzE,iEAA0E;AAC1E,uDAAmD;AAYnD,MAAsB,oBAAoB;IAkBtC,KAAK,CAAC,kBAAkB;QACpB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACxB,MAAM,WAAW,GAAG,cAAc,IAAI,CAAC,IAAI,UAAU,CAAC;YACtD,MAAM,UAAU,GAAG,cAAc,IAAI,CAAC,IAAI,SAAS,CAAC;YACpD,MAAM,UAAU,GAAG,cAAc,IAAI,CAAC,IAAI,SAAS,CAAC;YACpD,MAAM,eAAe,GAAG,cAAc,IAAI,CAAC,IAAI,cAAc,CAAC;YAE9D,MAAM,OAAO,GAAG,iBAAU,CAAC,GAAG,CAAU,WAAW,CAAC,IAAI,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;YAC7F,MAAM,aAAa,GAAG,iBAAU,CAAC,GAAG,CAAgB,UAAU,CAAC,IAAI,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACpI,MAAM,MAAM,GAAG,iBAAU,CAAC,GAAG,CAAS,UAAU,CAAC,IAAI,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YACzF,IAAI,CAAC,MAAM,EAAE;gBACT,MAAM,KAAK,CAAC,0EAA0E,UAAU,GAAG,CAAC,CAAC;aACxG;YACD,MAAM,WAAW,GAAG,iBAAU,CAAC,GAAG,CAAc,eAAe,CAAC,IAAI,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;YAC7G,IAAI,CAAC,WAAW,EAAE;gBACd,MAAM,KAAK,CAAC,oFAAoF,eAAe,GAAG,CAAC,CAAC;aACvH;YAED,IAAI,CAAC,gBAAgB,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;SAC3G;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,kBAAkB,CAAC,eAAkB;QACjC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;IAC5C,CAAC;CAIJ;AA3CG;IAAC,IAAA,gBAAS,EAAC,gCAAc,CAAC;;4DACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,0CAAmB,CAAC;;iEAC6B;AAE5D;IAAC,IAAA,gBAAS,EAAC,kCAAe,CAAC;;6DACyB;AAEpD;IAAC,IAAA,gBAAS,EAAC,uCAAqB,CAAC;;mEAC+B;AAdpE,oDA+CC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const CredentialsProvider: unique symbol;
|
|
2
|
+
export interface Credentials {
|
|
3
|
+
accessKeyId: string;
|
|
4
|
+
accessKeySecret: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CredentialsProvider {
|
|
8
|
+
provide(): Promise<Credentials | undefined>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=credentials-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-protocol.d.ts","sourceRoot":"","sources":["../../src/common/credentials-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-protocol.js","sourceRoot":"","sources":["../../src/common/credentials-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './account-protocol';
|
|
2
|
+
export * from './credentials-protocol';
|
|
3
|
+
export * from './object-storage-protocol';
|
|
4
|
+
export * from './region-protocol';
|
|
5
|
+
export * from './cloud-protocol';
|
|
6
|
+
export * from './client-protocol';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-protocol"), exports);
|
|
18
|
+
__exportStar(require("./credentials-protocol"), exports);
|
|
19
|
+
__exportStar(require("./object-storage-protocol"), exports);
|
|
20
|
+
__exportStar(require("./region-protocol"), exports);
|
|
21
|
+
__exportStar(require("./cloud-protocol"), exports);
|
|
22
|
+
__exportStar(require("./client-protocol"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC;AACvC,4DAA0C;AAC1C,oDAAkC;AAClC,mDAAiC;AACjC,oDAAkC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Stream } from 'stream';
|
|
4
|
+
import { AbstractCloudService, CloudService, RawCloudService } from './cloud-protocol';
|
|
5
|
+
export declare const ObjectStorageService: unique symbol;
|
|
6
|
+
export declare const OBJECT_STORAGE_NAME = "objectStorage";
|
|
7
|
+
export declare type Body = Buffer | string | Stream;
|
|
8
|
+
export interface Owner {
|
|
9
|
+
id?: string;
|
|
10
|
+
displayName?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Bucket {
|
|
13
|
+
name: string;
|
|
14
|
+
creationDate: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface Object {
|
|
17
|
+
etag?: string;
|
|
18
|
+
key: string;
|
|
19
|
+
lastModified?: Date;
|
|
20
|
+
Owner?: Owner;
|
|
21
|
+
size: number;
|
|
22
|
+
storageClass: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ListAllMyBucketsResult {
|
|
25
|
+
owner?: Owner;
|
|
26
|
+
buckets: Bucket[];
|
|
27
|
+
}
|
|
28
|
+
export interface ListObjectsRequest {
|
|
29
|
+
bucket: string;
|
|
30
|
+
continuationToken?: string;
|
|
31
|
+
delimiter?: string;
|
|
32
|
+
encodingType?: string;
|
|
33
|
+
fetchOwner?: string;
|
|
34
|
+
maxKeys: number;
|
|
35
|
+
prefix?: string;
|
|
36
|
+
startAfter?: string;
|
|
37
|
+
requestPayer?: string;
|
|
38
|
+
expectedBucketOwner?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ListObjectsResult {
|
|
41
|
+
commonPrefixes?: {
|
|
42
|
+
prefix: string;
|
|
43
|
+
}[];
|
|
44
|
+
contents: Object[];
|
|
45
|
+
continuationToken?: string;
|
|
46
|
+
delimiter?: string;
|
|
47
|
+
encodingType?: string;
|
|
48
|
+
isTruncated: boolean;
|
|
49
|
+
keyCount: number;
|
|
50
|
+
maxKeys: number;
|
|
51
|
+
name: string;
|
|
52
|
+
nextContinuationToken?: string;
|
|
53
|
+
prefix?: string;
|
|
54
|
+
startAfter?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface GetObjectRequest {
|
|
57
|
+
bucket: string;
|
|
58
|
+
key: string;
|
|
59
|
+
range?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface CreateBucketRequest {
|
|
62
|
+
bucket: string;
|
|
63
|
+
}
|
|
64
|
+
export interface CreateBucketResult {
|
|
65
|
+
location?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface PutObjectRequest {
|
|
68
|
+
bucket: string;
|
|
69
|
+
key: string;
|
|
70
|
+
body: Body;
|
|
71
|
+
cacheControl?: string;
|
|
72
|
+
contentDisposition?: string;
|
|
73
|
+
contentEncoding?: string;
|
|
74
|
+
contentLength?: number;
|
|
75
|
+
contentType?: string;
|
|
76
|
+
expires?: Date;
|
|
77
|
+
}
|
|
78
|
+
export interface CopyObjectRequest {
|
|
79
|
+
bucket: string;
|
|
80
|
+
key: string;
|
|
81
|
+
copySource: string;
|
|
82
|
+
}
|
|
83
|
+
export interface DeleteObjectRequest {
|
|
84
|
+
bucket: string;
|
|
85
|
+
key: string;
|
|
86
|
+
mfa?: string;
|
|
87
|
+
requestPayer?: string;
|
|
88
|
+
bypassGovernanceRetention?: string;
|
|
89
|
+
expectedBucketOwner?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DeleteBucketRequest {
|
|
92
|
+
bucket: string;
|
|
93
|
+
expectedBucketOwner?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface HeadObjectResult {
|
|
96
|
+
cacheControl?: string;
|
|
97
|
+
contentDisposition?: string;
|
|
98
|
+
contentEncoding?: string;
|
|
99
|
+
contentLength?: number;
|
|
100
|
+
contentType?: string;
|
|
101
|
+
expires?: Date;
|
|
102
|
+
}
|
|
103
|
+
export interface ObjectStorageService<T extends RawCloudService> extends CloudService<T> {
|
|
104
|
+
createBucket(request: CreateBucketRequest): Promise<CreateBucketResult>;
|
|
105
|
+
deleteBucket(request: DeleteBucketRequest): Promise<void>;
|
|
106
|
+
listBuckets(): Promise<ListAllMyBucketsResult>;
|
|
107
|
+
listObjects(request: ListObjectsRequest): Promise<ListObjectsResult>;
|
|
108
|
+
getObject(request: GetObjectRequest): Promise<Body>;
|
|
109
|
+
getStream(request: GetObjectRequest): Promise<Stream>;
|
|
110
|
+
putObject(request: PutObjectRequest): Promise<void>;
|
|
111
|
+
copyObject(request: CopyObjectRequest): Promise<void>;
|
|
112
|
+
deleteObject(request: DeleteObjectRequest): Promise<void>;
|
|
113
|
+
headObject(request: GetObjectRequest): Promise<HeadObjectResult>;
|
|
114
|
+
}
|
|
115
|
+
export declare abstract class AbstractObjectStorageService<T extends RawCloudService> extends AbstractCloudService<T> implements ObjectStorageService<T> {
|
|
116
|
+
name: string;
|
|
117
|
+
abstract createBucket(request: CreateBucketRequest): Promise<CreateBucketResult>;
|
|
118
|
+
abstract deleteBucket(request: DeleteBucketRequest): Promise<void>;
|
|
119
|
+
abstract listBuckets(): Promise<ListAllMyBucketsResult>;
|
|
120
|
+
abstract listObjects(request: ListObjectsRequest): Promise<ListObjectsResult>;
|
|
121
|
+
abstract getObject(request: GetObjectRequest): Promise<Body>;
|
|
122
|
+
abstract getStream(request: GetObjectRequest): Promise<Stream>;
|
|
123
|
+
abstract putObject(request: PutObjectRequest): Promise<void>;
|
|
124
|
+
abstract copyObject(request: CopyObjectRequest): Promise<void>;
|
|
125
|
+
abstract deleteObject(request: DeleteObjectRequest): Promise<void>;
|
|
126
|
+
abstract headObject(request: GetObjectRequest): Promise<HeadObjectResult>;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=object-storage-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-storage-protocol.d.ts","sourceRoot":"","sources":["../../src/common/object-storage-protocol.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvF,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAEnE,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD,oBAAY,IAAI,GAAG,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC;AAExC,MAAM,WAAW,KAAK;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAC9B,cAAc,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,eAAe,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACpF,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxE,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,WAAW,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/C,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrE,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpE;AAED,8BAAsB,4BAA4B,CAAC,CAAC,SAAS,eAAe,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAE,YAAW,oBAAoB,CAAC,CAAC,CAAC;IACnI,IAAI,SAAuB;IACpC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAChF,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAClE,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,sBAAsB,CAAC;IACvD,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAC7E,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5D,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9D,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5D,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9D,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAClE,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAC5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractObjectStorageService = exports.OBJECT_STORAGE_NAME = exports.ObjectStorageService = void 0;
|
|
4
|
+
const cloud_protocol_1 = require("./cloud-protocol");
|
|
5
|
+
exports.ObjectStorageService = Symbol('ObjectStorageService');
|
|
6
|
+
exports.OBJECT_STORAGE_NAME = 'objectStorage';
|
|
7
|
+
class AbstractObjectStorageService extends cloud_protocol_1.AbstractCloudService {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = exports.OBJECT_STORAGE_NAME;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AbstractObjectStorageService = AbstractObjectStorageService;
|
|
14
|
+
//# sourceMappingURL=object-storage-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-storage-protocol.js","sourceRoot":"","sources":["../../src/common/object-storage-protocol.ts"],"names":[],"mappings":";;;AACA,qDAAuF;AAE1E,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEtD,QAAA,mBAAmB,GAAG,eAAe,CAAC;AA4HnD,MAAsB,4BAAwD,SAAQ,qCAAuB;IAA7G;;QACa,SAAI,GAAG,2BAAmB,CAAC;IAWxC,CAAC;CAAA;AAZD,oEAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region-protocol.d.ts","sourceRoot":"","sources":["../../src/common/region-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC3B,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region-protocol.js","sourceRoot":"","sources":["../../src/common/region-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-provider.d.ts","sourceRoot":"","sources":["../../src/node/account-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAErD,qBACa,sBAAuB,YAAW,eAAe;IAG1D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE9B,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;CAIhD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultAccountProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const common_1 = require("../common");
|
|
15
|
+
let DefaultAccountProvider = class DefaultAccountProvider {
|
|
16
|
+
async provide() {
|
|
17
|
+
return this.account;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, core_1.Value)('cell.cloud.account'),
|
|
22
|
+
__metadata("design:type", Object)
|
|
23
|
+
], DefaultAccountProvider.prototype, "account", void 0);
|
|
24
|
+
DefaultAccountProvider = __decorate([
|
|
25
|
+
(0, core_1.Component)(common_1.AccountProvider)
|
|
26
|
+
], DefaultAccountProvider);
|
|
27
|
+
exports.DefaultAccountProvider = DefaultAccountProvider;
|
|
28
|
+
//# sourceMappingURL=account-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-provider.js","sourceRoot":"","sources":["../../src/node/account-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAgD;AAChD,sCAAqD;AAG9C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAK/B,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CAEJ,CAAA;AAPG;IAAC,IAAA,YAAK,EAAC,oBAAoB,CAAC;;uDACQ;AAH3B,sBAAsB;IADlC,IAAA,gBAAS,EAAC,wBAAe,CAAC;GACd,sBAAsB,CASlC;AATY,wDAAsB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ClientOptions, ClientOptionsProvider } from '../common';
|
|
2
|
+
export declare class DefaultClientOptionsProvider implements ClientOptionsProvider {
|
|
3
|
+
protected readonly clientOptions: ClientOptions;
|
|
4
|
+
provide(): Promise<ClientOptions | undefined>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=client-options-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-options-provider.d.ts","sourceRoot":"","sources":["../../src/node/client-options-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEjE,qBACa,4BAA6B,YAAW,qBAAqB;IAGtE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAE1C,OAAO,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAItD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultClientOptionsProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const common_1 = require("../common");
|
|
15
|
+
let DefaultClientOptionsProvider = class DefaultClientOptionsProvider {
|
|
16
|
+
async provide() {
|
|
17
|
+
return this.clientOptions;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, core_1.Value)('cell.cloud.client'),
|
|
22
|
+
__metadata("design:type", Object)
|
|
23
|
+
], DefaultClientOptionsProvider.prototype, "clientOptions", void 0);
|
|
24
|
+
DefaultClientOptionsProvider = __decorate([
|
|
25
|
+
(0, core_1.Component)(common_1.ClientOptionsProvider)
|
|
26
|
+
], DefaultClientOptionsProvider);
|
|
27
|
+
exports.DefaultClientOptionsProvider = DefaultClientOptionsProvider;
|
|
28
|
+
//# sourceMappingURL=client-options-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-options-provider.js","sourceRoot":"","sources":["../../src/node/client-options-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAgD;AAChD,sCAAiE;AAG1D,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAKrC,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CAEJ,CAAA;AAPG;IAAC,IAAA,YAAK,EAAC,mBAAmB,CAAC;;mEACqB;AAHvC,4BAA4B;IADxC,IAAA,gBAAS,EAAC,8BAAqB,CAAC;GACpB,4BAA4B,CASxC;AATY,oEAA4B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Credentials, CredentialsProvider } from '../common';
|
|
2
|
+
export declare class DefaultCredentialsProvider implements CredentialsProvider {
|
|
3
|
+
protected readonly credentials: Credentials;
|
|
4
|
+
provide(): Promise<Credentials | undefined>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=credentials-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-provider.d.ts","sourceRoot":"","sources":["../../src/node/credentials-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE7D,qBACa,0BAA2B,YAAW,mBAAmB;IAGlE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAEtC,OAAO,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAIpD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultCredentialsProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const common_1 = require("../common");
|
|
15
|
+
let DefaultCredentialsProvider = class DefaultCredentialsProvider {
|
|
16
|
+
async provide() {
|
|
17
|
+
return this.credentials;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, core_1.Value)('cell.cloud.credentials'),
|
|
22
|
+
__metadata("design:type", Object)
|
|
23
|
+
], DefaultCredentialsProvider.prototype, "credentials", void 0);
|
|
24
|
+
DefaultCredentialsProvider = __decorate([
|
|
25
|
+
(0, core_1.Component)(common_1.CredentialsProvider)
|
|
26
|
+
], DefaultCredentialsProvider);
|
|
27
|
+
exports.DefaultCredentialsProvider = DefaultCredentialsProvider;
|
|
28
|
+
//# sourceMappingURL=credentials-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-provider.js","sourceRoot":"","sources":["../../src/node/credentials-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAgD;AAChD,sCAA6D;AAGtD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAKnC,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CAEJ,CAAA;AAPG;IAAC,IAAA,YAAK,EAAC,wBAAwB,CAAC;;+DACY;AAHnC,0BAA0B;IADtC,IAAA,gBAAS,EAAC,4BAAmB,CAAC;GAClB,0BAA0B,CAStC;AATY,gEAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-provider"), exports);
|
|
18
|
+
__exportStar(require("./credentials-provider"), exports);
|
|
19
|
+
__exportStar(require("./regin-provider"), exports);
|
|
20
|
+
__exportStar(require("./client-options-provider"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC;AACvC,mDAAiC;AACjC,4DAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,CAAC;;AAEjB,wBAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,mBAAiB;AAEjB,kBAAe,IAAA,eAAQ,GAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regin-provider.d.ts","sourceRoot":"","sources":["../../src/node/regin-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,qBACa,qBAAsB,YAAW,cAAc;IAGxD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAE5B,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAG/C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultRegionProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const common_1 = require("../common");
|
|
15
|
+
let DefaultRegionProvider = class DefaultRegionProvider {
|
|
16
|
+
async provide() {
|
|
17
|
+
return this.region;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, core_1.Value)('cell.cloud.region'),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], DefaultRegionProvider.prototype, "region", void 0);
|
|
24
|
+
DefaultRegionProvider = __decorate([
|
|
25
|
+
(0, core_1.Component)(common_1.RegionProvider)
|
|
26
|
+
], DefaultRegionProvider);
|
|
27
|
+
exports.DefaultRegionProvider = DefaultRegionProvider;
|
|
28
|
+
//# sourceMappingURL=regin-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regin-provider.js","sourceRoot":"","sources":["../../src/node/regin-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAgD;AAChD,sCAA2C;AAGpC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAK9B,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ,CAAA;AANG;IAAC,IAAA,YAAK,EAAC,mBAAmB,CAAC;;qDACO;AAHzB,qBAAqB;IADjC,IAAA,gBAAS,EAAC,uBAAc,CAAC;GACb,qBAAqB,CAQjC;AARY,sDAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAE3B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@celljs/cloud",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/common/index.js",
|
|
6
|
+
"typings": "lib/common/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@celljs/core": "3.0.0"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"cell-component"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/cellbang/cell.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/cellbang/cell/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/cellbang/cell",
|
|
25
|
+
"files": [
|
|
26
|
+
"lib",
|
|
27
|
+
"src",
|
|
28
|
+
"cell.yml"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "cell-component lint",
|
|
32
|
+
"build": "cell-component build",
|
|
33
|
+
"watch": "cell-component watch",
|
|
34
|
+
"clean": "cell-component clean",
|
|
35
|
+
"test": "cell-component test:js"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@celljs/component": "3.0.0"
|
|
39
|
+
},
|
|
40
|
+
"gitHead": "c0ef8d269e33a795406bcbb240cac4b845c6c24c"
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const ClientOptionsProvider = Symbol('ClientOptionsProvider');
|
|
2
|
+
|
|
3
|
+
export interface ClientOptions {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
internal?: boolean;
|
|
6
|
+
apiVersion?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ClientOptionsProvider {
|
|
10
|
+
provide(): Promise<ClientOptions | undefined>
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Autowired, ConfigUtil } from '@celljs/core';
|
|
2
|
+
import { Account, AccountProvider } from './account-protocol';
|
|
3
|
+
import { ClientOptions, ClientOptionsProvider } from './client-protocol';
|
|
4
|
+
import { Credentials, CredentialsProvider } from './credentials-protocol';
|
|
5
|
+
import { RegionProvider } from './region-protocol';
|
|
6
|
+
|
|
7
|
+
export interface CloudService<T extends RawCloudService> {
|
|
8
|
+
name: string;
|
|
9
|
+
getRawCloudService(): Promise<T>;
|
|
10
|
+
setRawCloudService(innerService: T): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface RawCloudService {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export abstract class AbstractCloudService<T extends RawCloudService> implements CloudService<T> {
|
|
18
|
+
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
@Autowired(RegionProvider)
|
|
22
|
+
protected readonly regionProvider: RegionProvider;
|
|
23
|
+
|
|
24
|
+
@Autowired(CredentialsProvider)
|
|
25
|
+
protected readonly credentialsProvider: CredentialsProvider;
|
|
26
|
+
|
|
27
|
+
@Autowired(AccountProvider)
|
|
28
|
+
protected readonly accountProvider: AccountProvider;
|
|
29
|
+
|
|
30
|
+
@Autowired(ClientOptionsProvider)
|
|
31
|
+
protected readonly clientOptionsProvider: ClientOptionsProvider;
|
|
32
|
+
|
|
33
|
+
protected _rawCloudService: T;
|
|
34
|
+
|
|
35
|
+
async getRawCloudService(): Promise<T> {
|
|
36
|
+
if (!this._rawCloudService) {
|
|
37
|
+
const accountProp = `cell.cloud.${this.name}.account`;
|
|
38
|
+
const clientProp = `cell.cloud.${this.name}.client`;
|
|
39
|
+
const regionProp = `cell.cloud.${this.name}.region`;
|
|
40
|
+
const credentialsProp = `cell.cloud.${this.name}.credentials`;
|
|
41
|
+
|
|
42
|
+
const account = ConfigUtil.get<Account>(accountProp) || await this.accountProvider.provide();
|
|
43
|
+
const clientOptions = ConfigUtil.get<ClientOptions>(clientProp) || await this.clientOptionsProvider.provide() || { internal: true };
|
|
44
|
+
const region = ConfigUtil.get<string>(regionProp) || await this.regionProvider.provide();
|
|
45
|
+
if (!region) {
|
|
46
|
+
throw Error(`Please configure region through the properties "cell.cloud.region" or "${regionProp}"`);
|
|
47
|
+
}
|
|
48
|
+
const credentials = ConfigUtil.get<Credentials>(credentialsProp) || await this.credentialsProvider.provide();
|
|
49
|
+
if (!credentials) {
|
|
50
|
+
throw Error(`Please configure credentials through the properties "cell.cloud.credentials" or "${credentialsProp}"`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this._rawCloudService = await this.doCreateRawCloudService(credentials, region, clientOptions, account);
|
|
54
|
+
}
|
|
55
|
+
return this._rawCloudService;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setRawCloudService(rawCloudService: T): void {
|
|
59
|
+
this._rawCloudService = rawCloudService;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected abstract doCreateRawCloudService(credentials: Credentials, region: string, clientOptions: ClientOptions, account?: Account): Promise<T>;
|
|
63
|
+
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const CredentialsProvider = Symbol('CredentialsProvider');
|
|
2
|
+
|
|
3
|
+
export interface Credentials {
|
|
4
|
+
accessKeyId: string;
|
|
5
|
+
accessKeySecret: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CredentialsProvider {
|
|
10
|
+
provide(): Promise<Credentials | undefined>
|
|
11
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Stream } from 'stream';
|
|
2
|
+
import { AbstractCloudService, CloudService, RawCloudService } from './cloud-protocol';
|
|
3
|
+
|
|
4
|
+
export const ObjectStorageService = Symbol('ObjectStorageService');
|
|
5
|
+
|
|
6
|
+
export const OBJECT_STORAGE_NAME = 'objectStorage';
|
|
7
|
+
|
|
8
|
+
export type Body = Buffer|string|Stream;
|
|
9
|
+
|
|
10
|
+
export interface Owner {
|
|
11
|
+
id?: string;
|
|
12
|
+
displayName?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Bucket {
|
|
16
|
+
name: string;
|
|
17
|
+
creationDate: Date;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Object {
|
|
21
|
+
etag?: string;
|
|
22
|
+
key: string;
|
|
23
|
+
lastModified?: Date;
|
|
24
|
+
Owner?: Owner;
|
|
25
|
+
size: number;
|
|
26
|
+
storageClass: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ListAllMyBucketsResult {
|
|
30
|
+
owner?: Owner;
|
|
31
|
+
buckets: Bucket[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ListObjectsRequest {
|
|
35
|
+
bucket: string;
|
|
36
|
+
continuationToken?: string;
|
|
37
|
+
delimiter?: string;
|
|
38
|
+
encodingType?: string;
|
|
39
|
+
fetchOwner?: string;
|
|
40
|
+
maxKeys: number;
|
|
41
|
+
prefix?: string;
|
|
42
|
+
startAfter?: string;
|
|
43
|
+
requestPayer?: string;
|
|
44
|
+
expectedBucketOwner?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ListObjectsResult {
|
|
48
|
+
commonPrefixes?: { prefix: string }[];
|
|
49
|
+
contents: Object[];
|
|
50
|
+
continuationToken?: string;
|
|
51
|
+
delimiter?: string;
|
|
52
|
+
encodingType?: string;
|
|
53
|
+
isTruncated: boolean;
|
|
54
|
+
keyCount: number;
|
|
55
|
+
maxKeys: number;
|
|
56
|
+
name: string;
|
|
57
|
+
nextContinuationToken?: string;
|
|
58
|
+
prefix?: string;
|
|
59
|
+
startAfter?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GetObjectRequest {
|
|
63
|
+
bucket: string;
|
|
64
|
+
key: string;
|
|
65
|
+
range?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CreateBucketRequest {
|
|
69
|
+
bucket: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CreateBucketResult {
|
|
73
|
+
location?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface PutObjectRequest {
|
|
77
|
+
bucket: string;
|
|
78
|
+
key: string;
|
|
79
|
+
body: Body;
|
|
80
|
+
cacheControl?: string;
|
|
81
|
+
contentDisposition?: string;
|
|
82
|
+
contentEncoding?: string;
|
|
83
|
+
contentLength?: number;
|
|
84
|
+
contentType?: string;
|
|
85
|
+
expires?: Date;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface CopyObjectRequest {
|
|
89
|
+
bucket: string;
|
|
90
|
+
key: string;
|
|
91
|
+
copySource: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface DeleteObjectRequest {
|
|
95
|
+
bucket: string;
|
|
96
|
+
key: string;
|
|
97
|
+
mfa?: string;
|
|
98
|
+
requestPayer?: string;
|
|
99
|
+
bypassGovernanceRetention?: string;
|
|
100
|
+
expectedBucketOwner?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface DeleteBucketRequest {
|
|
104
|
+
bucket: string;
|
|
105
|
+
expectedBucketOwner?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface HeadObjectResult {
|
|
109
|
+
cacheControl?: string;
|
|
110
|
+
contentDisposition?: string;
|
|
111
|
+
contentEncoding?: string;
|
|
112
|
+
contentLength?: number;
|
|
113
|
+
contentType?: string;
|
|
114
|
+
expires?: Date;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface ObjectStorageService<T extends RawCloudService> extends CloudService<T> {
|
|
118
|
+
createBucket(request: CreateBucketRequest): Promise<CreateBucketResult>;
|
|
119
|
+
deleteBucket(request: DeleteBucketRequest): Promise<void>;
|
|
120
|
+
listBuckets(): Promise<ListAllMyBucketsResult>;
|
|
121
|
+
listObjects(request: ListObjectsRequest): Promise<ListObjectsResult>;
|
|
122
|
+
getObject(request: GetObjectRequest): Promise<Body>;
|
|
123
|
+
getStream(request: GetObjectRequest): Promise<Stream>;
|
|
124
|
+
putObject(request: PutObjectRequest): Promise<void>;
|
|
125
|
+
copyObject(request: CopyObjectRequest): Promise<void>;
|
|
126
|
+
deleteObject(request: DeleteObjectRequest): Promise<void>;
|
|
127
|
+
headObject(request: GetObjectRequest): Promise<HeadObjectResult>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export abstract class AbstractObjectStorageService<T extends RawCloudService> extends AbstractCloudService<T> implements ObjectStorageService<T> {
|
|
131
|
+
override name = OBJECT_STORAGE_NAME;
|
|
132
|
+
abstract createBucket(request: CreateBucketRequest): Promise<CreateBucketResult>;
|
|
133
|
+
abstract deleteBucket(request: DeleteBucketRequest): Promise<void>;
|
|
134
|
+
abstract listBuckets(): Promise<ListAllMyBucketsResult>;
|
|
135
|
+
abstract listObjects(request: ListObjectsRequest): Promise<ListObjectsResult> ;
|
|
136
|
+
abstract getObject(request: GetObjectRequest): Promise<Body>;
|
|
137
|
+
abstract getStream(request: GetObjectRequest): Promise<Stream>;
|
|
138
|
+
abstract putObject(request: PutObjectRequest): Promise<void>;
|
|
139
|
+
abstract copyObject(request: CopyObjectRequest): Promise<void>;
|
|
140
|
+
abstract deleteObject(request: DeleteObjectRequest): Promise<void>;
|
|
141
|
+
abstract headObject(request: GetObjectRequest): Promise<HeadObjectResult>;
|
|
142
|
+
}
|
|
143
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, Value } from '@celljs/core';
|
|
2
|
+
import { AccountProvider, Account } from '../common';
|
|
3
|
+
|
|
4
|
+
@Component(AccountProvider)
|
|
5
|
+
export class DefaultAccountProvider implements AccountProvider {
|
|
6
|
+
|
|
7
|
+
@Value('cell.cloud.account')
|
|
8
|
+
protected readonly account: Account;
|
|
9
|
+
|
|
10
|
+
async provide(): Promise<Account | undefined> {
|
|
11
|
+
return this.account;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, Value } from '@celljs/core';
|
|
2
|
+
import { ClientOptions, ClientOptionsProvider } from '../common';
|
|
3
|
+
|
|
4
|
+
@Component(ClientOptionsProvider)
|
|
5
|
+
export class DefaultClientOptionsProvider implements ClientOptionsProvider {
|
|
6
|
+
|
|
7
|
+
@Value('cell.cloud.client')
|
|
8
|
+
protected readonly clientOptions: ClientOptions;
|
|
9
|
+
|
|
10
|
+
async provide(): Promise<ClientOptions | undefined> {
|
|
11
|
+
return this.clientOptions;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, Value } from '@celljs/core';
|
|
2
|
+
import { Credentials, CredentialsProvider } from '../common';
|
|
3
|
+
|
|
4
|
+
@Component(CredentialsProvider)
|
|
5
|
+
export class DefaultCredentialsProvider implements CredentialsProvider {
|
|
6
|
+
|
|
7
|
+
@Value('cell.cloud.credentials')
|
|
8
|
+
protected readonly credentials: Credentials;
|
|
9
|
+
|
|
10
|
+
async provide(): Promise<Credentials | undefined> {
|
|
11
|
+
return this.credentials;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component, Value } from '@celljs/core';
|
|
2
|
+
import { RegionProvider } from '../common';
|
|
3
|
+
|
|
4
|
+
@Component(RegionProvider)
|
|
5
|
+
export class DefaultRegionProvider implements RegionProvider {
|
|
6
|
+
|
|
7
|
+
@Value('cell.cloud.region')
|
|
8
|
+
protected readonly region: string;
|
|
9
|
+
|
|
10
|
+
async provide(): Promise<string | undefined> {
|
|
11
|
+
return this.region;
|
|
12
|
+
}
|
|
13
|
+
}
|