@settlemint/sdk-minio 2.1.4-prcda675ba → 2.1.4-prd4abaa86
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/minio.cjs +5 -12
- package/dist/minio.cjs.map +1 -1
- package/dist/minio.d.cts +2 -1
- package/dist/minio.d.ts +2 -1
- package/dist/minio.mjs +4 -11
- package/dist/minio.mjs.map +1 -1
- package/package.json +2 -2
package/dist/minio.cjs
CHANGED
|
@@ -23,6 +23,8 @@ __export(minio_exports, {
|
|
|
23
23
|
createServerMinioClient: () => createServerMinioClient
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(minio_exports);
|
|
26
|
+
var import_runtime = require("@settlemint/sdk-utils/runtime");
|
|
27
|
+
var import_validation2 = require("@settlemint/sdk-utils/validation");
|
|
26
28
|
var import_minio = require("minio");
|
|
27
29
|
|
|
28
30
|
// src/helpers/client-options.schema.ts
|
|
@@ -32,26 +34,17 @@ var ClientOptionsSchema = import_zod.z.object({
|
|
|
32
34
|
/** The URL of the MinIO instance to connect to */
|
|
33
35
|
instance: import_validation.UrlSchema
|
|
34
36
|
});
|
|
35
|
-
var ServerClientOptionsSchema =
|
|
36
|
-
/** The URL of the MinIO instance to connect to */
|
|
37
|
-
instance: import_validation.UrlSchema,
|
|
37
|
+
var ServerClientOptionsSchema = ClientOptionsSchema.extend({
|
|
38
38
|
/** The MinIO access key used to authenticate with the MinIO server */
|
|
39
39
|
accessKey: import_zod.z.string(),
|
|
40
40
|
/** The MinIO secret key used to authenticate with the MinIO server */
|
|
41
41
|
secretKey: import_zod.z.string()
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
// src/helpers/runtime.ts
|
|
45
|
-
function ensureServer() {
|
|
46
|
-
if (typeof window !== "undefined") {
|
|
47
|
-
throw new Error("This function can only be called on the server.");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
44
|
// src/minio.ts
|
|
52
45
|
function createServerMinioClient(options) {
|
|
53
|
-
ensureServer();
|
|
54
|
-
const validatedOptions =
|
|
46
|
+
(0, import_runtime.ensureServer)();
|
|
47
|
+
const validatedOptions = (0, import_validation2.validate)(ServerClientOptionsSchema, options);
|
|
55
48
|
const url = new URL(validatedOptions.instance);
|
|
56
49
|
return {
|
|
57
50
|
client: new import_minio.Client({
|
package/dist/minio.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts"
|
|
1
|
+
{"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { Client } from \"minio\";\nimport { type ServerClientOptions, ServerClientOptionsSchema } from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates a MinIO client for server-side use with authentication.\n *\n * @param options - The server client options for configuring the MinIO client\n * @returns An object containing the initialized MinIO client\n * @throws Will throw an error if not called on the server or if the options fail validation\n *\n * @example\n * import { createServerMinioClient } from \"@settlemint/sdk-minio\";\n *\n * const { client } = createServerMinioClient({\n * instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,\n * accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,\n * secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!\n * });\n * client.listBuckets();\n */\nexport function createServerMinioClient(options: ServerClientOptions): { client: Client } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n const url = new URL(validatedOptions.instance);\n return {\n client: new Client({\n endPoint: url.hostname,\n accessKey: validatedOptions.accessKey,\n secretKey: validatedOptions.secretKey,\n useSSL: url.protocol !== \"http:\",\n port: url.port ? Number(url.port) : undefined,\n region: \"eu-central-1\",\n }),\n };\n}\n","import { UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod\";\n\n/**\n * Schema for validating client options for the Portal client.\n */\nexport const ClientOptionsSchema = z.object({\n /** The URL of the MinIO instance to connect to */\n instance: UrlSchema,\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Schema for validating server client options for the Portal client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = ClientOptionsSchema.extend({\n /** The MinIO access key used to authenticate with the MinIO server */\n accessKey: z.string(),\n /** The MinIO secret key used to authenticate with the MinIO server */\n secretKey: z.string(),\n});\n\n/**\n * Type definition for server client options derived from the ServerClientOptionsSchema.\n */\nexport type ServerClientOptions = z.infer<typeof ServerClientOptionsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6B;AAC7B,IAAAA,qBAAyB;AACzB,mBAAuB;;;ACFvB,wBAA0B;AAC1B,iBAAkB;AAKX,IAAM,sBAAsB,aAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,oBAAoB,OAAO;AAAA;AAAA,EAElE,WAAW,aAAE,OAAO;AAAA;AAAA,EAEpB,WAAW,aAAE,OAAO;AACtB,CAAC;;;ADHM,SAAS,wBAAwB,SAAkD;AACxF,mCAAa;AACb,QAAM,uBAAmB,6BAAS,2BAA2B,OAAO;AAEpE,QAAM,MAAM,IAAI,IAAI,iBAAiB,QAAQ;AAC7C,SAAO;AAAA,IACL,QAAQ,IAAI,oBAAO;AAAA,MACjB,UAAU,IAAI;AAAA,MACd,WAAW,iBAAiB;AAAA,MAC5B,WAAW,iBAAiB;AAAA,MAC5B,QAAQ,IAAI,aAAa;AAAA,MACzB,MAAM,IAAI,OAAO,OAAO,IAAI,IAAI,IAAI;AAAA,MACpC,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;","names":["import_validation"]}
|
package/dist/minio.d.cts
CHANGED
|
@@ -2,12 +2,13 @@ import { Client } from 'minio';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Schema for validating server client options for the
|
|
5
|
+
* Schema for validating server client options for the Portal client.
|
|
6
6
|
* Extends the ClientOptionsSchema with additional server-specific fields.
|
|
7
7
|
*/
|
|
8
8
|
declare const ServerClientOptionsSchema: z.ZodObject<{
|
|
9
9
|
/** The URL of the MinIO instance to connect to */
|
|
10
10
|
instance: z.ZodString;
|
|
11
|
+
} & {
|
|
11
12
|
/** The MinIO access key used to authenticate with the MinIO server */
|
|
12
13
|
accessKey: z.ZodString;
|
|
13
14
|
/** The MinIO secret key used to authenticate with the MinIO server */
|
package/dist/minio.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { Client } from 'minio';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Schema for validating server client options for the
|
|
5
|
+
* Schema for validating server client options for the Portal client.
|
|
6
6
|
* Extends the ClientOptionsSchema with additional server-specific fields.
|
|
7
7
|
*/
|
|
8
8
|
declare const ServerClientOptionsSchema: z.ZodObject<{
|
|
9
9
|
/** The URL of the MinIO instance to connect to */
|
|
10
10
|
instance: z.ZodString;
|
|
11
|
+
} & {
|
|
11
12
|
/** The MinIO access key used to authenticate with the MinIO server */
|
|
12
13
|
accessKey: z.ZodString;
|
|
13
14
|
/** The MinIO secret key used to authenticate with the MinIO server */
|
package/dist/minio.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// src/minio.ts
|
|
2
|
+
import { ensureServer } from "@settlemint/sdk-utils/runtime";
|
|
3
|
+
import { validate } from "@settlemint/sdk-utils/validation";
|
|
2
4
|
import { Client } from "minio";
|
|
3
5
|
|
|
4
6
|
// src/helpers/client-options.schema.ts
|
|
@@ -8,26 +10,17 @@ var ClientOptionsSchema = z.object({
|
|
|
8
10
|
/** The URL of the MinIO instance to connect to */
|
|
9
11
|
instance: UrlSchema
|
|
10
12
|
});
|
|
11
|
-
var ServerClientOptionsSchema =
|
|
12
|
-
/** The URL of the MinIO instance to connect to */
|
|
13
|
-
instance: UrlSchema,
|
|
13
|
+
var ServerClientOptionsSchema = ClientOptionsSchema.extend({
|
|
14
14
|
/** The MinIO access key used to authenticate with the MinIO server */
|
|
15
15
|
accessKey: z.string(),
|
|
16
16
|
/** The MinIO secret key used to authenticate with the MinIO server */
|
|
17
17
|
secretKey: z.string()
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
// src/helpers/runtime.ts
|
|
21
|
-
function ensureServer() {
|
|
22
|
-
if (typeof window !== "undefined") {
|
|
23
|
-
throw new Error("This function can only be called on the server.");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
// src/minio.ts
|
|
28
21
|
function createServerMinioClient(options) {
|
|
29
22
|
ensureServer();
|
|
30
|
-
const validatedOptions = ServerClientOptionsSchema
|
|
23
|
+
const validatedOptions = validate(ServerClientOptionsSchema, options);
|
|
31
24
|
const url = new URL(validatedOptions.instance);
|
|
32
25
|
return {
|
|
33
26
|
client: new Client({
|
package/dist/minio.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts"
|
|
1
|
+
{"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { Client } from \"minio\";\nimport { type ServerClientOptions, ServerClientOptionsSchema } from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates a MinIO client for server-side use with authentication.\n *\n * @param options - The server client options for configuring the MinIO client\n * @returns An object containing the initialized MinIO client\n * @throws Will throw an error if not called on the server or if the options fail validation\n *\n * @example\n * import { createServerMinioClient } from \"@settlemint/sdk-minio\";\n *\n * const { client } = createServerMinioClient({\n * instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,\n * accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,\n * secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!\n * });\n * client.listBuckets();\n */\nexport function createServerMinioClient(options: ServerClientOptions): { client: Client } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n const url = new URL(validatedOptions.instance);\n return {\n client: new Client({\n endPoint: url.hostname,\n accessKey: validatedOptions.accessKey,\n secretKey: validatedOptions.secretKey,\n useSSL: url.protocol !== \"http:\",\n port: url.port ? Number(url.port) : undefined,\n region: \"eu-central-1\",\n }),\n };\n}\n","import { UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod\";\n\n/**\n * Schema for validating client options for the Portal client.\n */\nexport const ClientOptionsSchema = z.object({\n /** The URL of the MinIO instance to connect to */\n instance: UrlSchema,\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Schema for validating server client options for the Portal client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = ClientOptionsSchema.extend({\n /** The MinIO access key used to authenticate with the MinIO server */\n accessKey: z.string(),\n /** The MinIO secret key used to authenticate with the MinIO server */\n secretKey: z.string(),\n});\n\n/**\n * Type definition for server client options derived from the ServerClientOptionsSchema.\n */\nexport type ServerClientOptions = z.infer<typeof ServerClientOptionsSchema>;\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,cAAc;;;ACFvB,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAKX,IAAM,sBAAsB,EAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,oBAAoB,OAAO;AAAA;AAAA,EAElE,WAAW,EAAE,OAAO;AAAA;AAAA,EAEpB,WAAW,EAAE,OAAO;AACtB,CAAC;;;ADHM,SAAS,wBAAwB,SAAkD;AACxF,eAAa;AACb,QAAM,mBAAmB,SAAS,2BAA2B,OAAO;AAEpE,QAAM,MAAM,IAAI,IAAI,iBAAiB,QAAQ;AAC7C,SAAO;AAAA,IACL,QAAQ,IAAI,OAAO;AAAA,MACjB,UAAU,IAAI;AAAA,MACd,WAAW,iBAAiB;AAAA,MAC5B,WAAW,iBAAiB;AAAA,MAC5B,QAAQ,IAAI,aAAa;AAAA,MACzB,MAAM,IAAI,OAAO,OAAO,IAAI,IAAI,IAAI;AAAA,MACpC,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlemint/sdk-minio",
|
|
3
3
|
"description": "MinIO integration module for SettleMint SDK, providing S3-compatible object storage capabilities",
|
|
4
|
-
"version": "2.1.4-
|
|
4
|
+
"version": "2.1.4-prd4abaa86",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "FSL-1.1-MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@settlemint/sdk-utils": "2.1.4-
|
|
54
|
+
"@settlemint/sdk-utils": "2.1.4-prd4abaa86",
|
|
55
55
|
"minio": "^8",
|
|
56
56
|
"zod": "^3"
|
|
57
57
|
},
|