@liquidmetal-ai/raindrop 0.4.4 → 0.4.7
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/README.md +36 -36
- package/dist/base-command.d.ts +1 -1
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +2 -2
- package/dist/commands/annotation/get.d.ts.map +1 -1
- package/dist/commands/annotation/get.js +1 -1
- package/dist/commands/annotation/list.d.ts.map +1 -1
- package/dist/commands/annotation/list.js +1 -1
- package/dist/commands/annotation/put.d.ts.map +1 -1
- package/dist/commands/annotation/put.js +1 -1
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +15 -33
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +15 -31
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +16 -33
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +16 -36
- package/oclif.manifest.json +1465 -1465
- package/package.json +1 -1
|
@@ -66,42 +66,24 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
66
66
|
if (!this.flags.bucket && !this.flags.moduleId) {
|
|
67
67
|
this.error('Either --bucket or --moduleId flag must be specified.');
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
let bucket;
|
|
72
|
-
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
73
|
-
if (!moduleId && this.flags.bucket) {
|
|
74
|
-
// If moduleId is not provided and bucket is specified, we need to fetch the moduleId from the catalog service
|
|
75
|
-
//string split on # to get bucket name and version
|
|
76
|
-
const [bucketName, version] = this.flags.bucket.split('#');
|
|
77
|
-
bucket = (await catalogService.resolveBucketLocationToModuleId({
|
|
78
|
-
userId,
|
|
79
|
-
organizationId,
|
|
69
|
+
const bucketLocation = this.flags.bucket
|
|
70
|
+
? {
|
|
80
71
|
bucketLocation: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
version: version || '',
|
|
86
|
-
},
|
|
72
|
+
case: 'bucket',
|
|
73
|
+
value: {
|
|
74
|
+
name: this.flags.bucket,
|
|
75
|
+
version: '',
|
|
87
76
|
},
|
|
88
77
|
},
|
|
89
|
-
})).bucket;
|
|
90
|
-
if (!bucket || !bucket.moduleId) {
|
|
91
|
-
this.error(`Bucket "${this.flags.bucket}" not found or does not belong to any module.`);
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})).bucket;
|
|
102
|
-
}
|
|
103
|
-
console.log(`Using moduleId: ${moduleId}`);
|
|
104
|
-
const { client: objectService } = await this.objectService(moduleId);
|
|
79
|
+
: {
|
|
80
|
+
bucketLocation: {
|
|
81
|
+
case: 'moduleId',
|
|
82
|
+
value: this.flags.moduleId,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const { args, flags } = await this.parse(ObjectPut);
|
|
86
|
+
const { client: objectService, userId, organizationId } = await this.objectService();
|
|
105
87
|
// Read the file
|
|
106
88
|
const fileContent = await fs.readFile(args.file);
|
|
107
89
|
// Get content type if not specified
|
|
@@ -109,19 +91,17 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
109
91
|
const response = await objectService.putObject({
|
|
110
92
|
userId,
|
|
111
93
|
organizationId,
|
|
112
|
-
|
|
94
|
+
bucketLocation,
|
|
113
95
|
key: args.key,
|
|
114
96
|
content: fileContent,
|
|
115
97
|
contentType,
|
|
116
98
|
});
|
|
117
|
-
//attach the bucket to the response
|
|
118
|
-
response.bucket = bucket;
|
|
119
99
|
if (flags.output === 'json') {
|
|
120
100
|
console.log(toJsonString(PutObjectResponseSchema, response, { prettySpaces: 2 }));
|
|
121
101
|
}
|
|
122
102
|
else {
|
|
123
103
|
console.log('Successfully uploaded file:');
|
|
124
|
-
console.log(`Bucket: ${response.bucket
|
|
104
|
+
console.log(`Bucket: ${response.bucket?.bucketName}`);
|
|
125
105
|
console.log(`Key: ${response.key}`);
|
|
126
106
|
}
|
|
127
107
|
}
|