@spica-devkit/storage 0.9.12 → 0.9.16
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/dist/index.d.ts +0 -1
- package/dist/index.js +194 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -133
- package/dist/index.mjs.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/interface.d.ts +0 -1
- package/dist/src/storage.d.ts +0 -1
- package/dist/src/utility.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,20 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var axios_1 = require('axios');
|
|
6
6
|
var buffer = require('buffer');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var axios_1__default = /*#__PURE__*/_interopDefaultLegacy(axios_1);
|
|
11
11
|
var buffer__default = /*#__PURE__*/_interopDefaultLegacy(buffer);
|
|
12
12
|
|
|
13
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
14
|
+
|
|
15
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
16
|
+
return module = {
|
|
17
|
+
path: basedir,
|
|
18
|
+
exports: {},
|
|
19
|
+
require: function (path, base) {
|
|
20
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
21
|
+
}
|
|
22
|
+
}, fn(module, module.exports), module.exports;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function commonjsRequire () {
|
|
26
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var request = createCommonjsModule(function (module, exports) {
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.Axios = exports.logWarning = void 0;
|
|
32
|
+
|
|
13
33
|
function logWarning(response) {
|
|
14
34
|
const warning = response.headers["warning"];
|
|
15
35
|
if (warning) {
|
|
16
36
|
console.warn(warning);
|
|
17
37
|
}
|
|
18
38
|
}
|
|
39
|
+
exports.logWarning = logWarning;
|
|
19
40
|
class Axios {
|
|
20
41
|
constructor(config) {
|
|
21
42
|
this.interceptors = {
|
|
@@ -40,7 +61,7 @@ class Axios {
|
|
|
40
61
|
}
|
|
41
62
|
}
|
|
42
63
|
};
|
|
43
|
-
this.instance =
|
|
64
|
+
this.instance = axios_1__default['default'].default.create(config);
|
|
44
65
|
this.instance.interceptors.request.use(this.interceptors.request.onFulfilled, this.interceptors.request.onRejected);
|
|
45
66
|
this.instance.interceptors.response.use(this.interceptors.response.onFulfilled, this.interceptors.response.onRejected);
|
|
46
67
|
this.baseUrl = this.instance.defaults.baseURL;
|
|
@@ -73,6 +94,13 @@ class Axios {
|
|
|
73
94
|
return this.instance.delete(url, config);
|
|
74
95
|
}
|
|
75
96
|
}
|
|
97
|
+
exports.Axios = Axios;
|
|
98
|
+
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
var initialize_1 = createCommonjsModule(function (module, exports) {
|
|
102
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
103
|
+
exports.isPlatformBrowser = exports.checkInitialized = exports.initialize = void 0;
|
|
76
104
|
|
|
77
105
|
let service;
|
|
78
106
|
function initialize(options) {
|
|
@@ -89,7 +117,7 @@ function initialize(options) {
|
|
|
89
117
|
throw new Error("Public url must be provided.");
|
|
90
118
|
}
|
|
91
119
|
if (!service) {
|
|
92
|
-
service = new Axios({ baseURL: publicUrl, headers: { Authorization: authorization } });
|
|
120
|
+
service = new request.Axios({ baseURL: publicUrl, headers: { Authorization: authorization } });
|
|
93
121
|
}
|
|
94
122
|
else {
|
|
95
123
|
service.setBaseUrl(publicUrl);
|
|
@@ -97,29 +125,91 @@ function initialize(options) {
|
|
|
97
125
|
}
|
|
98
126
|
return { authorization, publicUrl, service };
|
|
99
127
|
}
|
|
128
|
+
exports.initialize = initialize;
|
|
100
129
|
function checkInitialized(authorization) {
|
|
101
130
|
if (!authorization) {
|
|
102
131
|
throw new Error("You should call initialize method with a valid apikey or identity token.");
|
|
103
132
|
}
|
|
104
133
|
}
|
|
134
|
+
exports.checkInitialized = checkInitialized;
|
|
105
135
|
function getPublicUrl() {
|
|
106
136
|
return isPlatformBrowser() ? undefined : process.env.__INTERNAL__SPICA__PUBLIC_URL__;
|
|
107
137
|
}
|
|
108
138
|
function isPlatformBrowser() {
|
|
109
139
|
return typeof window !== "undefined";
|
|
110
140
|
}
|
|
141
|
+
exports.isPlatformBrowser = isPlatformBrowser;
|
|
111
142
|
|
|
112
|
-
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
var _interface = createCommonjsModule(function (module, exports) {
|
|
146
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
147
|
+
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
var url = createCommonjsModule(function (module, exports) {
|
|
151
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
152
|
+
exports.buildUrl = void 0;
|
|
153
|
+
function buildUrl(baseUrl, queryParams = {}) {
|
|
154
|
+
const url = new URL(baseUrl);
|
|
155
|
+
for (let [key, value] of Object.entries(queryParams)) {
|
|
156
|
+
if (typeof value != "string") {
|
|
157
|
+
value = JSON.stringify(value);
|
|
158
|
+
}
|
|
159
|
+
url.searchParams.set(key, value);
|
|
160
|
+
}
|
|
161
|
+
return url;
|
|
162
|
+
}
|
|
163
|
+
exports.buildUrl = buildUrl;
|
|
164
|
+
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
var src = createCommonjsModule(function (module, exports) {
|
|
168
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
169
|
+
if (k2 === undefined) k2 = k;
|
|
170
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
171
|
+
}) : (function(o, m, k, k2) {
|
|
172
|
+
if (k2 === undefined) k2 = k;
|
|
173
|
+
o[k2] = m[k];
|
|
174
|
+
}));
|
|
175
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
176
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
177
|
+
};
|
|
178
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
179
|
+
__exportStar(initialize_1, exports);
|
|
180
|
+
__exportStar(_interface, exports);
|
|
181
|
+
__exportStar(request, exports);
|
|
182
|
+
__exportStar(url, exports);
|
|
183
|
+
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
var internal_common = createCommonjsModule(function (module, exports) {
|
|
187
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
188
|
+
if (k2 === undefined) k2 = k;
|
|
189
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
190
|
+
}) : (function(o, m, k, k2) {
|
|
191
|
+
if (k2 === undefined) k2 = k;
|
|
192
|
+
o[k2] = m[k];
|
|
193
|
+
}));
|
|
194
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
195
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
196
|
+
};
|
|
197
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
198
|
+
__exportStar(src, exports);
|
|
199
|
+
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
113
203
|
|
|
114
204
|
function unwrapExports (x) {
|
|
115
205
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
116
206
|
}
|
|
117
207
|
|
|
118
|
-
function createCommonjsModule(fn, module) {
|
|
208
|
+
function createCommonjsModule$1(fn, module) {
|
|
119
209
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
120
210
|
}
|
|
121
211
|
|
|
122
|
-
var ensure_buffer = createCommonjsModule(function (module, exports) {
|
|
212
|
+
var ensure_buffer = createCommonjsModule$1(function (module, exports) {
|
|
123
213
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
124
214
|
exports.ensureBuffer = void 0;
|
|
125
215
|
|
|
@@ -150,7 +240,7 @@ exports.ensureBuffer = ensureBuffer;
|
|
|
150
240
|
unwrapExports(ensure_buffer);
|
|
151
241
|
var ensure_buffer_1 = ensure_buffer.ensureBuffer;
|
|
152
242
|
|
|
153
|
-
var uuid = createCommonjsModule(function (module, exports) {
|
|
243
|
+
var uuid = createCommonjsModule$1(function (module, exports) {
|
|
154
244
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
155
245
|
exports.parseUUID = void 0;
|
|
156
246
|
/**
|
|
@@ -203,7 +293,7 @@ exports.parseUUID = parseUUID;
|
|
|
203
293
|
unwrapExports(uuid);
|
|
204
294
|
var uuid_1 = uuid.parseUUID;
|
|
205
295
|
|
|
206
|
-
var binary = createCommonjsModule(function (module, exports) {
|
|
296
|
+
var binary = createCommonjsModule$1(function (module, exports) {
|
|
207
297
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
208
298
|
exports.Binary = void 0;
|
|
209
299
|
|
|
@@ -426,7 +516,7 @@ Object.defineProperty(Binary.prototype, '_bsontype', { value: 'Binary' });
|
|
|
426
516
|
unwrapExports(binary);
|
|
427
517
|
var binary_1 = binary.Binary;
|
|
428
518
|
|
|
429
|
-
var code = createCommonjsModule(function (module, exports) {
|
|
519
|
+
var code = createCommonjsModule$1(function (module, exports) {
|
|
430
520
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431
521
|
exports.Code = void 0;
|
|
432
522
|
/**
|
|
@@ -1020,7 +1110,7 @@ var require$$1 = {
|
|
|
1020
1110
|
debuglog: debuglog
|
|
1021
1111
|
};
|
|
1022
1112
|
|
|
1023
|
-
var utils = createCommonjsModule(function (module, exports) {
|
|
1113
|
+
var utils = createCommonjsModule$1(function (module, exports) {
|
|
1024
1114
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1025
1115
|
exports.deprecate = exports.isObjectLike = exports.isDate = exports.isBuffer = exports.haveBuffer = exports.isBigUInt64Array = exports.isBigInt64Array = exports.isUint8Array = exports.randomBytes = exports.normalizedFunctionString = void 0;
|
|
1026
1116
|
|
|
@@ -1069,7 +1159,7 @@ function isBigUInt64Array(value) {
|
|
|
1069
1159
|
exports.isBigUInt64Array = isBigUInt64Array;
|
|
1070
1160
|
/** Call to check if your environment has `Buffer` */
|
|
1071
1161
|
function haveBuffer() {
|
|
1072
|
-
return typeof commonjsGlobal !== 'undefined' && typeof commonjsGlobal.Buffer !== 'undefined';
|
|
1162
|
+
return typeof commonjsGlobal$1 !== 'undefined' && typeof commonjsGlobal$1.Buffer !== 'undefined';
|
|
1073
1163
|
}
|
|
1074
1164
|
exports.haveBuffer = haveBuffer;
|
|
1075
1165
|
/** Callable in any environment to check if value is a Buffer */
|
|
@@ -1122,7 +1212,7 @@ var utils_8 = utils.isUint8Array;
|
|
|
1122
1212
|
var utils_9 = utils.randomBytes;
|
|
1123
1213
|
var utils_10 = utils.normalizedFunctionString;
|
|
1124
1214
|
|
|
1125
|
-
var db_ref = createCommonjsModule(function (module, exports) {
|
|
1215
|
+
var db_ref = createCommonjsModule$1(function (module, exports) {
|
|
1126
1216
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1127
1217
|
exports.DBRef = exports.isDBRefLike = void 0;
|
|
1128
1218
|
|
|
@@ -1206,7 +1296,7 @@ unwrapExports(db_ref);
|
|
|
1206
1296
|
var db_ref_1 = db_ref.DBRef;
|
|
1207
1297
|
var db_ref_2 = db_ref.isDBRefLike;
|
|
1208
1298
|
|
|
1209
|
-
var long_1 = createCommonjsModule(function (module, exports) {
|
|
1299
|
+
var long_1 = createCommonjsModule$1(function (module, exports) {
|
|
1210
1300
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1211
1301
|
exports.Long = void 0;
|
|
1212
1302
|
|
|
@@ -2042,7 +2132,7 @@ Object.defineProperty(Long.prototype, '_bsontype', { value: 'Long' });
|
|
|
2042
2132
|
unwrapExports(long_1);
|
|
2043
2133
|
var long_2 = long_1.Long;
|
|
2044
2134
|
|
|
2045
|
-
var decimal128 = createCommonjsModule(function (module, exports) {
|
|
2135
|
+
var decimal128 = createCommonjsModule$1(function (module, exports) {
|
|
2046
2136
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2047
2137
|
exports.Decimal128 = void 0;
|
|
2048
2138
|
|
|
@@ -2734,7 +2824,7 @@ Object.defineProperty(Decimal128.prototype, '_bsontype', { value: 'Decimal128' }
|
|
|
2734
2824
|
unwrapExports(decimal128);
|
|
2735
2825
|
var decimal128_1 = decimal128.Decimal128;
|
|
2736
2826
|
|
|
2737
|
-
var double_1 = createCommonjsModule(function (module, exports) {
|
|
2827
|
+
var double_1 = createCommonjsModule$1(function (module, exports) {
|
|
2738
2828
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2739
2829
|
exports.Double = void 0;
|
|
2740
2830
|
/**
|
|
@@ -2801,7 +2891,7 @@ Object.defineProperty(Double.prototype, '_bsontype', { value: 'Double' });
|
|
|
2801
2891
|
unwrapExports(double_1);
|
|
2802
2892
|
var double_2 = double_1.Double;
|
|
2803
2893
|
|
|
2804
|
-
var int_32 = createCommonjsModule(function (module, exports) {
|
|
2894
|
+
var int_32 = createCommonjsModule$1(function (module, exports) {
|
|
2805
2895
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2806
2896
|
exports.Int32 = void 0;
|
|
2807
2897
|
/**
|
|
@@ -2851,7 +2941,7 @@ Object.defineProperty(Int32.prototype, '_bsontype', { value: 'Int32' });
|
|
|
2851
2941
|
unwrapExports(int_32);
|
|
2852
2942
|
var int_32_1 = int_32.Int32;
|
|
2853
2943
|
|
|
2854
|
-
var map = createCommonjsModule(function (module, exports) {
|
|
2944
|
+
var map = createCommonjsModule$1(function (module, exports) {
|
|
2855
2945
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2856
2946
|
// We have an ES6 Map available, return the native instance
|
|
2857
2947
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2869,7 +2959,7 @@ function getGlobal() {
|
|
|
2869
2959
|
return (check(typeof globalThis === 'object' && globalThis) ||
|
|
2870
2960
|
check(typeof window === 'object' && window) ||
|
|
2871
2961
|
check(typeof self === 'object' && self) ||
|
|
2872
|
-
check(typeof commonjsGlobal === 'object' && commonjsGlobal) ||
|
|
2962
|
+
check(typeof commonjsGlobal$1 === 'object' && commonjsGlobal$1) ||
|
|
2873
2963
|
Function('return this')());
|
|
2874
2964
|
}
|
|
2875
2965
|
const bsonGlobal = getGlobal();
|
|
@@ -2982,7 +3072,7 @@ else {
|
|
|
2982
3072
|
unwrapExports(map);
|
|
2983
3073
|
var map_1 = map.Map;
|
|
2984
3074
|
|
|
2985
|
-
var max_key = createCommonjsModule(function (module, exports) {
|
|
3075
|
+
var max_key = createCommonjsModule$1(function (module, exports) {
|
|
2986
3076
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2987
3077
|
exports.MaxKey = void 0;
|
|
2988
3078
|
/**
|
|
@@ -3007,7 +3097,7 @@ Object.defineProperty(MaxKey.prototype, '_bsontype', { value: 'MaxKey' });
|
|
|
3007
3097
|
unwrapExports(max_key);
|
|
3008
3098
|
var max_key_1 = max_key.MaxKey;
|
|
3009
3099
|
|
|
3010
|
-
var min_key = createCommonjsModule(function (module, exports) {
|
|
3100
|
+
var min_key = createCommonjsModule$1(function (module, exports) {
|
|
3011
3101
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3012
3102
|
exports.MinKey = void 0;
|
|
3013
3103
|
/**
|
|
@@ -3032,7 +3122,7 @@ Object.defineProperty(MinKey.prototype, '_bsontype', { value: 'MinKey' });
|
|
|
3032
3122
|
unwrapExports(min_key);
|
|
3033
3123
|
var min_key_1 = min_key.MinKey;
|
|
3034
3124
|
|
|
3035
|
-
var objectid = createCommonjsModule(function (module, exports) {
|
|
3125
|
+
var objectid = createCommonjsModule$1(function (module, exports) {
|
|
3036
3126
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3037
3127
|
exports.ObjectId = void 0;
|
|
3038
3128
|
|
|
@@ -3335,7 +3425,7 @@ Object.defineProperty(ObjectId.prototype, '_bsontype', { value: 'ObjectID' });
|
|
|
3335
3425
|
unwrapExports(objectid);
|
|
3336
3426
|
var objectid_1 = objectid.ObjectId;
|
|
3337
3427
|
|
|
3338
|
-
var constants = createCommonjsModule(function (module, exports) {
|
|
3428
|
+
var constants = createCommonjsModule$1(function (module, exports) {
|
|
3339
3429
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3340
3430
|
exports.BSON_BINARY_SUBTYPE_USER_DEFINED = exports.BSON_BINARY_SUBTYPE_MD5 = exports.BSON_BINARY_SUBTYPE_UUID_NEW = exports.BSON_BINARY_SUBTYPE_UUID = exports.BSON_BINARY_SUBTYPE_BYTE_ARRAY = exports.BSON_BINARY_SUBTYPE_FUNCTION = exports.BSON_BINARY_SUBTYPE_DEFAULT = exports.BSON_DATA_MAX_KEY = exports.BSON_DATA_MIN_KEY = exports.BSON_DATA_DECIMAL128 = exports.BSON_DATA_LONG = exports.BSON_DATA_TIMESTAMP = exports.BSON_DATA_INT = exports.BSON_DATA_CODE_W_SCOPE = exports.BSON_DATA_SYMBOL = exports.BSON_DATA_CODE = exports.BSON_DATA_DBPOINTER = exports.BSON_DATA_REGEXP = exports.BSON_DATA_NULL = exports.BSON_DATA_DATE = exports.BSON_DATA_BOOLEAN = exports.BSON_DATA_OID = exports.BSON_DATA_UNDEFINED = exports.BSON_DATA_BINARY = exports.BSON_DATA_ARRAY = exports.BSON_DATA_OBJECT = exports.BSON_DATA_STRING = exports.BSON_DATA_NUMBER = exports.JS_INT_MIN = exports.JS_INT_MAX = exports.BSON_INT64_MIN = exports.BSON_INT64_MAX = exports.BSON_INT32_MIN = exports.BSON_INT32_MAX = void 0;
|
|
3341
3431
|
/** @internal */
|
|
@@ -3451,7 +3541,7 @@ var constants_32 = constants.BSON_INT64_MAX;
|
|
|
3451
3541
|
var constants_33 = constants.BSON_INT32_MIN;
|
|
3452
3542
|
var constants_34 = constants.BSON_INT32_MAX;
|
|
3453
3543
|
|
|
3454
|
-
var calculate_size = createCommonjsModule(function (module, exports) {
|
|
3544
|
+
var calculate_size = createCommonjsModule$1(function (module, exports) {
|
|
3455
3545
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3456
3546
|
exports.calculateObjectSize = void 0;
|
|
3457
3547
|
|
|
@@ -3647,7 +3737,7 @@ value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
|
|
|
3647
3737
|
unwrapExports(calculate_size);
|
|
3648
3738
|
var calculate_size_1 = calculate_size.calculateObjectSize;
|
|
3649
3739
|
|
|
3650
|
-
var regexp = createCommonjsModule(function (module, exports) {
|
|
3740
|
+
var regexp = createCommonjsModule$1(function (module, exports) {
|
|
3651
3741
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3652
3742
|
exports.BSONRegExp = void 0;
|
|
3653
3743
|
function alphabetize(str) {
|
|
@@ -3717,7 +3807,7 @@ Object.defineProperty(BSONRegExp.prototype, '_bsontype', { value: 'BSONRegExp' }
|
|
|
3717
3807
|
unwrapExports(regexp);
|
|
3718
3808
|
var regexp_1 = regexp.BSONRegExp;
|
|
3719
3809
|
|
|
3720
|
-
var symbol = createCommonjsModule(function (module, exports) {
|
|
3810
|
+
var symbol = createCommonjsModule$1(function (module, exports) {
|
|
3721
3811
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3722
3812
|
exports.BSONSymbol = void 0;
|
|
3723
3813
|
/**
|
|
@@ -3764,7 +3854,7 @@ Object.defineProperty(BSONSymbol.prototype, '_bsontype', { value: 'Symbol' });
|
|
|
3764
3854
|
unwrapExports(symbol);
|
|
3765
3855
|
var symbol_1 = symbol.BSONSymbol;
|
|
3766
3856
|
|
|
3767
|
-
var timestamp$1 = createCommonjsModule(function (module, exports) {
|
|
3857
|
+
var timestamp$1 = createCommonjsModule$1(function (module, exports) {
|
|
3768
3858
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3769
3859
|
exports.Timestamp = exports.LongWithoutOverridesClass = void 0;
|
|
3770
3860
|
|
|
@@ -3835,7 +3925,7 @@ unwrapExports(timestamp$1);
|
|
|
3835
3925
|
var timestamp_1 = timestamp$1.Timestamp;
|
|
3836
3926
|
var timestamp_2 = timestamp$1.LongWithoutOverridesClass;
|
|
3837
3927
|
|
|
3838
|
-
var validate_utf8 = createCommonjsModule(function (module, exports) {
|
|
3928
|
+
var validate_utf8 = createCommonjsModule$1(function (module, exports) {
|
|
3839
3929
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3840
3930
|
exports.validateUtf8 = void 0;
|
|
3841
3931
|
const FIRST_BIT = 0x80;
|
|
@@ -3887,7 +3977,7 @@ exports.validateUtf8 = validateUtf8;
|
|
|
3887
3977
|
unwrapExports(validate_utf8);
|
|
3888
3978
|
var validate_utf8_1 = validate_utf8.validateUtf8;
|
|
3889
3979
|
|
|
3890
|
-
var deserializer = createCommonjsModule(function (module, exports) {
|
|
3980
|
+
var deserializer = createCommonjsModule$1(function (module, exports) {
|
|
3891
3981
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3892
3982
|
exports.deserialize = void 0;
|
|
3893
3983
|
|
|
@@ -4455,7 +4545,7 @@ function isolateEval(functionString, functionCache, object) {
|
|
|
4455
4545
|
unwrapExports(deserializer);
|
|
4456
4546
|
var deserializer_1 = deserializer.deserialize;
|
|
4457
4547
|
|
|
4458
|
-
var extended_json = createCommonjsModule(function (module, exports) {
|
|
4548
|
+
var extended_json = createCommonjsModule$1(function (module, exports) {
|
|
4459
4549
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4460
4550
|
exports.EJSON = exports.isBSONType = void 0;
|
|
4461
4551
|
|
|
@@ -4768,7 +4858,7 @@ unwrapExports(extended_json);
|
|
|
4768
4858
|
var extended_json_1 = extended_json.EJSON;
|
|
4769
4859
|
var extended_json_2 = extended_json.isBSONType;
|
|
4770
4860
|
|
|
4771
|
-
var float_parser = createCommonjsModule(function (module, exports) {
|
|
4861
|
+
var float_parser = createCommonjsModule$1(function (module, exports) {
|
|
4772
4862
|
// Copyright (c) 2008, Fair Oaks Labs, Inc.
|
|
4773
4863
|
// All rights reserved.
|
|
4774
4864
|
//
|
|
@@ -4911,7 +5001,7 @@ unwrapExports(float_parser);
|
|
|
4911
5001
|
var float_parser_1 = float_parser.writeIEEE754;
|
|
4912
5002
|
var float_parser_2 = float_parser.readIEEE754;
|
|
4913
5003
|
|
|
4914
|
-
var serializer = createCommonjsModule(function (module, exports) {
|
|
5004
|
+
var serializer = createCommonjsModule$1(function (module, exports) {
|
|
4915
5005
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4916
5006
|
exports.serializeInto = void 0;
|
|
4917
5007
|
|
|
@@ -5765,7 +5855,7 @@ exports.serializeInto = serializeInto;
|
|
|
5765
5855
|
unwrapExports(serializer);
|
|
5766
5856
|
var serializer_1 = serializer.serializeInto;
|
|
5767
5857
|
|
|
5768
|
-
var bson = createCommonjsModule(function (module, exports) {
|
|
5858
|
+
var bson = createCommonjsModule$1(function (module, exports) {
|
|
5769
5859
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5770
5860
|
exports.deserializeStream = exports.calculateObjectSize = exports.deserialize = exports.serializeWithBufferAndIndex = exports.serialize = exports.setInternalBufferSize = exports.ObjectID = exports.Decimal128 = exports.BSONRegExp = exports.MaxKey = exports.MinKey = exports.Int32 = exports.Double = exports.Timestamp = exports.Long = exports.ObjectId = exports.Binary = exports.DBRef = exports.BSONSymbol = exports.Map = exports.Code = exports.LongWithoutOverridesClass = exports.EJSON = exports.JS_INT_MIN = exports.JS_INT_MAX = exports.BSON_INT64_MIN = exports.BSON_INT64_MAX = exports.BSON_INT32_MIN = exports.BSON_INT32_MAX = exports.BSON_DATA_UNDEFINED = exports.BSON_DATA_TIMESTAMP = exports.BSON_DATA_SYMBOL = exports.BSON_DATA_STRING = exports.BSON_DATA_REGEXP = exports.BSON_DATA_OID = exports.BSON_DATA_OBJECT = exports.BSON_DATA_NUMBER = exports.BSON_DATA_NULL = exports.BSON_DATA_MIN_KEY = exports.BSON_DATA_MAX_KEY = exports.BSON_DATA_LONG = exports.BSON_DATA_INT = exports.BSON_DATA_DECIMAL128 = exports.BSON_DATA_DBPOINTER = exports.BSON_DATA_DATE = exports.BSON_DATA_CODE_W_SCOPE = exports.BSON_DATA_CODE = exports.BSON_DATA_BOOLEAN = exports.BSON_DATA_BINARY = exports.BSON_DATA_ARRAY = exports.BSON_BINARY_SUBTYPE_UUID_NEW = exports.BSON_BINARY_SUBTYPE_UUID = exports.BSON_BINARY_SUBTYPE_USER_DEFINED = exports.BSON_BINARY_SUBTYPE_MD5 = exports.BSON_BINARY_SUBTYPE_FUNCTION = exports.BSON_BINARY_SUBTYPE_DEFAULT = exports.BSON_BINARY_SUBTYPE_BYTE_ARRAY = void 0;
|
|
5771
5861
|
|
|
@@ -6030,15 +6120,6 @@ var bson_55 = bson.BSON_BINARY_SUBTYPE_FUNCTION;
|
|
|
6030
6120
|
var bson_56 = bson.BSON_BINARY_SUBTYPE_DEFAULT;
|
|
6031
6121
|
var bson_57 = bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY;
|
|
6032
6122
|
|
|
6033
|
-
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6034
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6035
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6036
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6037
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6038
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6039
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6040
|
-
});
|
|
6041
|
-
};
|
|
6042
6123
|
function fileToBuffer(file) {
|
|
6043
6124
|
return new Promise((resolve, reject) => {
|
|
6044
6125
|
const reader = new FileReader();
|
|
@@ -6047,56 +6128,50 @@ function fileToBuffer(file) {
|
|
|
6047
6128
|
reader.onerror = error => reject(error);
|
|
6048
6129
|
});
|
|
6049
6130
|
}
|
|
6050
|
-
function preparePostBody(objects) {
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
return jsonToArrayBuffer(body);
|
|
6069
|
-
});
|
|
6131
|
+
async function preparePostBody(objects) {
|
|
6132
|
+
let files;
|
|
6133
|
+
const contents = [];
|
|
6134
|
+
// FileList to File array
|
|
6135
|
+
if (!Array.isArray(objects)) {
|
|
6136
|
+
files = Array.from(objects);
|
|
6137
|
+
}
|
|
6138
|
+
else {
|
|
6139
|
+
files = objects;
|
|
6140
|
+
}
|
|
6141
|
+
for (const file of files) {
|
|
6142
|
+
const content = await getContent(file);
|
|
6143
|
+
contents.push(content);
|
|
6144
|
+
}
|
|
6145
|
+
const body = {
|
|
6146
|
+
content: contents
|
|
6147
|
+
};
|
|
6148
|
+
return jsonToArrayBuffer(body);
|
|
6070
6149
|
}
|
|
6071
|
-
function preparePutBody(object) {
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
return jsonToArrayBuffer(body);
|
|
6075
|
-
});
|
|
6150
|
+
async function preparePutBody(object) {
|
|
6151
|
+
const body = await getContent(object);
|
|
6152
|
+
return jsonToArrayBuffer(body);
|
|
6076
6153
|
}
|
|
6077
|
-
function getContent(file) {
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6154
|
+
async function getContent(file) {
|
|
6155
|
+
let data;
|
|
6156
|
+
let name;
|
|
6157
|
+
let type;
|
|
6158
|
+
if (instanceOfBufferWithMeta(file)) {
|
|
6159
|
+
data = file.data;
|
|
6160
|
+
name = file.name;
|
|
6161
|
+
type = file.contentType;
|
|
6162
|
+
}
|
|
6163
|
+
else {
|
|
6164
|
+
data = await fileToBuffer(file);
|
|
6165
|
+
name = file.name;
|
|
6166
|
+
type = file.type;
|
|
6167
|
+
}
|
|
6168
|
+
return {
|
|
6169
|
+
name,
|
|
6170
|
+
content: {
|
|
6171
|
+
data: new bson_17(data),
|
|
6172
|
+
type
|
|
6091
6173
|
}
|
|
6092
|
-
|
|
6093
|
-
name,
|
|
6094
|
-
content: {
|
|
6095
|
-
data: new bson_17(data),
|
|
6096
|
-
type
|
|
6097
|
-
}
|
|
6098
|
-
};
|
|
6099
|
-
});
|
|
6174
|
+
};
|
|
6100
6175
|
}
|
|
6101
6176
|
function jsonToArrayBuffer(body) {
|
|
6102
6177
|
const size = bson_2(body);
|
|
@@ -6107,84 +6182,69 @@ function instanceOfBufferWithMeta(value) {
|
|
|
6107
6182
|
return "data" in value && "name" in value && "contentType" in value;
|
|
6108
6183
|
}
|
|
6109
6184
|
|
|
6110
|
-
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6111
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6112
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6113
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6114
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6115
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6116
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6117
|
-
});
|
|
6118
|
-
};
|
|
6119
6185
|
let authorization;
|
|
6120
|
-
let service
|
|
6121
|
-
function initialize
|
|
6122
|
-
const { authorization: _authorization, service: _service } = initialize(options);
|
|
6186
|
+
let service;
|
|
6187
|
+
function initialize(options) {
|
|
6188
|
+
const { authorization: _authorization, service: _service } = internal_common.initialize(options);
|
|
6123
6189
|
authorization = _authorization;
|
|
6124
|
-
service
|
|
6125
|
-
service
|
|
6190
|
+
service = _service;
|
|
6191
|
+
service.setWriteDefaults({
|
|
6126
6192
|
headers: {
|
|
6127
6193
|
"Content-Type": "application/bson"
|
|
6128
6194
|
}
|
|
6129
6195
|
});
|
|
6130
6196
|
}
|
|
6131
|
-
function insert(object, onUploadProgress) {
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
onUploadProgress
|
|
6137
|
-
});
|
|
6197
|
+
async function insert(object, onUploadProgress) {
|
|
6198
|
+
internal_common.checkInitialized(authorization);
|
|
6199
|
+
const body = await preparePostBody([object]);
|
|
6200
|
+
return service.post("storage", body, {
|
|
6201
|
+
onUploadProgress
|
|
6138
6202
|
});
|
|
6139
6203
|
}
|
|
6140
|
-
function insertMany(objects, onUploadProgress) {
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
onUploadProgress
|
|
6146
|
-
});
|
|
6204
|
+
async function insertMany(objects, onUploadProgress) {
|
|
6205
|
+
internal_common.checkInitialized(authorization);
|
|
6206
|
+
const body = await preparePostBody(objects);
|
|
6207
|
+
return service.post("storage", body, {
|
|
6208
|
+
onUploadProgress
|
|
6147
6209
|
});
|
|
6148
6210
|
}
|
|
6149
6211
|
function get(id) {
|
|
6150
|
-
checkInitialized(authorization);
|
|
6151
|
-
return service
|
|
6212
|
+
internal_common.checkInitialized(authorization);
|
|
6213
|
+
return service.get(`storage/${id}`);
|
|
6152
6214
|
}
|
|
6153
6215
|
/**
|
|
6154
6216
|
* Returns Blob for browser environment, ReadableStream for Nodejs environment
|
|
6155
6217
|
*/
|
|
6156
6218
|
function download(id, options = {}) {
|
|
6157
|
-
checkInitialized(authorization);
|
|
6158
|
-
return service
|
|
6219
|
+
internal_common.checkInitialized(authorization);
|
|
6220
|
+
return service.get(`storage/${id}/view`, {
|
|
6159
6221
|
headers: options.headers,
|
|
6160
6222
|
onDownloadProgress: options.onDownloadProgress,
|
|
6161
|
-
responseType: isPlatformBrowser() ? "blob" : "stream"
|
|
6223
|
+
responseType: internal_common.isPlatformBrowser() ? "blob" : "stream"
|
|
6162
6224
|
});
|
|
6163
6225
|
}
|
|
6164
6226
|
function getAll(queryParams) {
|
|
6165
|
-
checkInitialized(authorization);
|
|
6166
|
-
return service
|
|
6227
|
+
internal_common.checkInitialized(authorization);
|
|
6228
|
+
return service.get(`storage`, {
|
|
6167
6229
|
params: queryParams
|
|
6168
6230
|
});
|
|
6169
6231
|
}
|
|
6170
|
-
function update(id, object, onUploadProgress) {
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
onUploadProgress
|
|
6176
|
-
});
|
|
6232
|
+
async function update(id, object, onUploadProgress) {
|
|
6233
|
+
internal_common.checkInitialized(authorization);
|
|
6234
|
+
const body = await preparePutBody(object);
|
|
6235
|
+
return service.put(`storage/${id}`, body, {
|
|
6236
|
+
onUploadProgress
|
|
6177
6237
|
});
|
|
6178
6238
|
}
|
|
6179
6239
|
function remove(id) {
|
|
6180
|
-
checkInitialized(authorization);
|
|
6181
|
-
return service
|
|
6240
|
+
internal_common.checkInitialized(authorization);
|
|
6241
|
+
return service.delete(`storage/${id}`);
|
|
6182
6242
|
}
|
|
6183
6243
|
|
|
6184
6244
|
exports.download = download;
|
|
6185
6245
|
exports.get = get;
|
|
6186
6246
|
exports.getAll = getAll;
|
|
6187
|
-
exports.initialize = initialize
|
|
6247
|
+
exports.initialize = initialize;
|
|
6188
6248
|
exports.insert = insert;
|
|
6189
6249
|
exports.insertMany = insertMany;
|
|
6190
6250
|
exports.remove = remove;
|