@settlemint/sdk-minio 2.1.4-prc6365e9d → 2.1.4-prcda675ba

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 CHANGED
@@ -23,8 +23,6 @@ __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");
28
26
  var import_minio = require("minio");
29
27
 
30
28
  // src/helpers/client-options.schema.ts
@@ -34,17 +32,26 @@ var ClientOptionsSchema = import_zod.z.object({
34
32
  /** The URL of the MinIO instance to connect to */
35
33
  instance: import_validation.UrlSchema
36
34
  });
37
- var ServerClientOptionsSchema = ClientOptionsSchema.extend({
35
+ var ServerClientOptionsSchema = import_zod.z.object({
36
+ /** The URL of the MinIO instance to connect to */
37
+ instance: import_validation.UrlSchema,
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
+
44
51
  // src/minio.ts
45
52
  function createServerMinioClient(options) {
46
- (0, import_runtime.ensureServer)();
47
- const validatedOptions = (0, import_validation2.validate)(ServerClientOptionsSchema, options);
53
+ ensureServer();
54
+ const validatedOptions = ServerClientOptionsSchema.parse(options);
48
55
  const url = new URL(validatedOptions.instance);
49
56
  return {
50
57
  client: new import_minio.Client({
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts","../src/helpers/runtime.ts"],"sourcesContent":["import { Client } from \"minio\";\nimport { type ServerClientOptions, ServerClientOptionsSchema } from \"./helpers/client-options.schema.js\";\nimport { ensureServer } from \"./helpers/runtime.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\n // Validate the options with Zod\n const validatedOptions = ServerClientOptionsSchema.parse(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 MinIO 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 MinIO client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = z.object({\n /** The URL of the MinIO instance to connect to */\n instance: UrlSchema,\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","/**\n * Runtime utilities for checking execution environment\n */\n\n/**\n * Ensures the current code is running on the server\n * @throws Will throw an error if called on the client\n */\nexport function ensureServer(): void {\n if (typeof window !== \"undefined\") {\n throw new Error(\"This function can only be called on the server.\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;;;ACAvB,wBAA0B;AAC1B,iBAAkB;AAKX,IAAM,sBAAsB,aAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,aAAE,OAAO;AAAA;AAAA,EAEhD,UAAU;AAAA;AAAA,EAEV,WAAW,aAAE,OAAO;AAAA;AAAA,EAEpB,WAAW,aAAE,OAAO;AACtB,CAAC;;;ACnBM,SAAS,eAAqB;AACnC,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACnE;AACF;;;AFSO,SAAS,wBAAwB,SAAkD;AACxF,eAAa;AAGb,QAAM,mBAAmB,0BAA0B,MAAM,OAAO;AAEhE,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":[]}
package/dist/minio.d.cts CHANGED
@@ -2,18 +2,17 @@ import { Client } from 'minio';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
5
- * Schema for validating server client options for the Portal client.
5
+ * Schema for validating server client options for the MinIO client.
6
6
  * Extends the ClientOptionsSchema with additional server-specific fields.
7
7
  */
8
- declare const ServerClientOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
8
+ declare const ServerClientOptionsSchema: z.ZodObject<{
9
9
  /** The URL of the MinIO instance to connect to */
10
10
  instance: z.ZodString;
11
- }, {
12
11
  /** The MinIO access key used to authenticate with the MinIO server */
13
12
  accessKey: z.ZodString;
14
13
  /** The MinIO secret key used to authenticate with the MinIO server */
15
14
  secretKey: z.ZodString;
16
- }>, "strip", z.ZodTypeAny, {
15
+ }, "strip", z.ZodTypeAny, {
17
16
  instance: string;
18
17
  accessKey: string;
19
18
  secretKey: string;
package/dist/minio.d.ts CHANGED
@@ -2,18 +2,17 @@ import { Client } from 'minio';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
5
- * Schema for validating server client options for the Portal client.
5
+ * Schema for validating server client options for the MinIO client.
6
6
  * Extends the ClientOptionsSchema with additional server-specific fields.
7
7
  */
8
- declare const ServerClientOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
8
+ declare const ServerClientOptionsSchema: z.ZodObject<{
9
9
  /** The URL of the MinIO instance to connect to */
10
10
  instance: z.ZodString;
11
- }, {
12
11
  /** The MinIO access key used to authenticate with the MinIO server */
13
12
  accessKey: z.ZodString;
14
13
  /** The MinIO secret key used to authenticate with the MinIO server */
15
14
  secretKey: z.ZodString;
16
- }>, "strip", z.ZodTypeAny, {
15
+ }, "strip", z.ZodTypeAny, {
17
16
  instance: string;
18
17
  accessKey: string;
19
18
  secretKey: string;
package/dist/minio.mjs CHANGED
@@ -1,6 +1,4 @@
1
1
  // src/minio.ts
2
- import { ensureServer } from "@settlemint/sdk-utils/runtime";
3
- import { validate } from "@settlemint/sdk-utils/validation";
4
2
  import { Client } from "minio";
5
3
 
6
4
  // src/helpers/client-options.schema.ts
@@ -10,17 +8,26 @@ var ClientOptionsSchema = z.object({
10
8
  /** The URL of the MinIO instance to connect to */
11
9
  instance: UrlSchema
12
10
  });
13
- var ServerClientOptionsSchema = ClientOptionsSchema.extend({
11
+ var ServerClientOptionsSchema = z.object({
12
+ /** The URL of the MinIO instance to connect to */
13
+ instance: UrlSchema,
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
+
20
27
  // src/minio.ts
21
28
  function createServerMinioClient(options) {
22
29
  ensureServer();
23
- const validatedOptions = validate(ServerClientOptionsSchema, options);
30
+ const validatedOptions = ServerClientOptionsSchema.parse(options);
24
31
  const url = new URL(validatedOptions.instance);
25
32
  return {
26
33
  client: new Client({
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"sources":["../src/minio.ts","../src/helpers/client-options.schema.ts","../src/helpers/runtime.ts"],"sourcesContent":["import { Client } from \"minio\";\nimport { type ServerClientOptions, ServerClientOptionsSchema } from \"./helpers/client-options.schema.js\";\nimport { ensureServer } from \"./helpers/runtime.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\n // Validate the options with Zod\n const validatedOptions = ServerClientOptionsSchema.parse(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 MinIO 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 MinIO client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = z.object({\n /** The URL of the MinIO instance to connect to */\n instance: UrlSchema,\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","/**\n * Runtime utilities for checking execution environment\n */\n\n/**\n * Ensures the current code is running on the server\n * @throws Will throw an error if called on the client\n */\nexport function ensureServer(): void {\n if (typeof window !== \"undefined\") {\n throw new Error(\"This function can only be called on the server.\");\n }\n}\n"],"mappings":";AAAA,SAAS,cAAc;;;ACAvB,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAKX,IAAM,sBAAsB,EAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,EAAE,OAAO;AAAA;AAAA,EAEhD,UAAU;AAAA;AAAA,EAEV,WAAW,EAAE,OAAO;AAAA;AAAA,EAEpB,WAAW,EAAE,OAAO;AACtB,CAAC;;;ACnBM,SAAS,eAAqB;AACnC,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACnE;AACF;;;AFSO,SAAS,wBAAwB,SAAkD;AACxF,eAAa;AAGb,QAAM,mBAAmB,0BAA0B,MAAM,OAAO;AAEhE,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-prc6365e9d",
4
+ "version": "2.1.4-prcda675ba",
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-prc6365e9d",
54
+ "@settlemint/sdk-utils": "2.1.4-prcda675ba",
55
55
  "minio": "^8",
56
56
  "zod": "^3"
57
57
  },