@settlemint/sdk-ipfs 2.3.2-prc0433625 → 2.3.2-prf63bb3f0
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/ipfs.cjs.map +1 -1
- package/dist/ipfs.d.cts +2 -2
- package/dist/ipfs.d.ts +2 -2
- package/dist/ipfs.mjs.map +1 -1
- package/package.json +2 -2
package/dist/ipfs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ipfs.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { type KuboRPCClient, create } from \"kubo-rpc-client\";\nimport {\n type ClientOptions,\n ClientOptionsSchema,\n type ServerClientOptions,\n ServerClientOptionsSchema,\n} from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates an IPFS client for client-side use\n *\n * @param options - Configuration options for the client\n * @returns An object containing the configured IPFS client instance\n * @throws Will throw an error if the options fail validation\n * @example\n * ```ts\n * import { createIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createIpfsClient({\n * instance: 'https://ipfs.settlemint.com'\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n * ```\n */\nexport function createIpfsClient(options: ClientOptions): { client: KuboRPCClient } {\n const validatedOptions = validate(ClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n }),\n };\n}\n\n/**\n * Creates an IPFS client for server-side use with authentication\n *\n * @param options - Configuration options for the client including authentication\n * @returns An object containing the authenticated IPFS client instance\n * @throws Will throw an error if called on the client side or if options validation fails\n * @example\n * import { createServerIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createServerIpfsClient({\n * instance: process.env.SETTLEMINT_IPFS_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n */\nexport function createServerIpfsClient(options: ServerClientOptions): { client: KuboRPCClient } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n headers: {\n \"x-auth-token\": validatedOptions.accessToken,\n },\n }),\n };\n}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod/v4\";\n\n/**\n * Schema for validating client options for the
|
|
1
|
+
{"version":3,"sources":["../src/ipfs.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { type KuboRPCClient, create } from \"kubo-rpc-client\";\nimport {\n type ClientOptions,\n ClientOptionsSchema,\n type ServerClientOptions,\n ServerClientOptionsSchema,\n} from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates an IPFS client for client-side use\n *\n * @param options - Configuration options for the client\n * @returns An object containing the configured IPFS client instance\n * @throws Will throw an error if the options fail validation\n * @example\n * ```ts\n * import { createIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createIpfsClient({\n * instance: 'https://ipfs.settlemint.com'\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n * ```\n */\nexport function createIpfsClient(options: ClientOptions): { client: KuboRPCClient } {\n const validatedOptions = validate(ClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n }),\n };\n}\n\n/**\n * Creates an IPFS client for server-side use with authentication\n *\n * @param options - Configuration options for the client including authentication\n * @returns An object containing the authenticated IPFS client instance\n * @throws Will throw an error if called on the client side or if options validation fails\n * @example\n * import { createServerIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createServerIpfsClient({\n * instance: process.env.SETTLEMINT_IPFS_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n */\nexport function createServerIpfsClient(options: ServerClientOptions): { client: KuboRPCClient } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n headers: {\n \"x-auth-token\": validatedOptions.accessToken,\n },\n }),\n };\n}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod/v4\";\n\n/**\n * Schema for validating client options for the IPFS client.\n */\nexport const ClientOptionsSchema = z.object({\n /** The URL of the IPFS 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 IPFS client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = ClientOptionsSchema.extend({\n /** The access token used to authenticate with the SettleMint platform */\n accessToken: ApplicationAccessTokenSchema,\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;AAAA,qBAA6B;AAC7B,IAAAA,qBAAyB;AACzB,6BAA2C;;;ACF3C,wBAAwD;AACxD,gBAAkB;AAKX,IAAM,sBAAsB,YAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,oBAAoB,OAAO;AAAA;AAAA,EAElE,aAAa;AACf,CAAC;;;ADOM,SAAS,iBAAiB,SAAmD;AAClF,QAAM,uBAAmB,6BAAS,qBAAqB,OAAO;AAE9D,SAAO;AAAA,IACL,YAAQ,+BAAO;AAAA,MACb,KAAK,iBAAiB;AAAA,IACxB,CAAC;AAAA,EACH;AACF;AAqBO,SAAS,uBAAuB,SAAyD;AAC9F,mCAAa;AACb,QAAM,uBAAmB,6BAAS,2BAA2B,OAAO;AAEpE,SAAO;AAAA,IACL,YAAQ,+BAAO;AAAA,MACb,KAAK,iBAAiB;AAAA,MACtB,SAAS;AAAA,QACP,gBAAgB,iBAAiB;AAAA,MACnC;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["import_validation"]}
|
package/dist/ipfs.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { KuboRPCClient } from 'kubo-rpc-client';
|
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Schema for validating client options for the
|
|
5
|
+
* Schema for validating client options for the IPFS client.
|
|
6
6
|
*/
|
|
7
7
|
declare const ClientOptionsSchema: z.ZodObject<{
|
|
8
8
|
instance: z.ZodString;
|
|
@@ -12,7 +12,7 @@ declare const ClientOptionsSchema: z.ZodObject<{
|
|
|
12
12
|
*/
|
|
13
13
|
type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
14
14
|
/**
|
|
15
|
-
* Schema for validating server client options for the
|
|
15
|
+
* Schema for validating server client options for the IPFS client.
|
|
16
16
|
* Extends the ClientOptionsSchema with additional server-specific fields.
|
|
17
17
|
*/
|
|
18
18
|
declare const ServerClientOptionsSchema: z.ZodObject<{
|
package/dist/ipfs.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { KuboRPCClient } from 'kubo-rpc-client';
|
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Schema for validating client options for the
|
|
5
|
+
* Schema for validating client options for the IPFS client.
|
|
6
6
|
*/
|
|
7
7
|
declare const ClientOptionsSchema: z.ZodObject<{
|
|
8
8
|
instance: z.ZodString;
|
|
@@ -12,7 +12,7 @@ declare const ClientOptionsSchema: z.ZodObject<{
|
|
|
12
12
|
*/
|
|
13
13
|
type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
14
14
|
/**
|
|
15
|
-
* Schema for validating server client options for the
|
|
15
|
+
* Schema for validating server client options for the IPFS client.
|
|
16
16
|
* Extends the ClientOptionsSchema with additional server-specific fields.
|
|
17
17
|
*/
|
|
18
18
|
declare const ServerClientOptionsSchema: z.ZodObject<{
|
package/dist/ipfs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ipfs.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { type KuboRPCClient, create } from \"kubo-rpc-client\";\nimport {\n type ClientOptions,\n ClientOptionsSchema,\n type ServerClientOptions,\n ServerClientOptionsSchema,\n} from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates an IPFS client for client-side use\n *\n * @param options - Configuration options for the client\n * @returns An object containing the configured IPFS client instance\n * @throws Will throw an error if the options fail validation\n * @example\n * ```ts\n * import { createIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createIpfsClient({\n * instance: 'https://ipfs.settlemint.com'\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n * ```\n */\nexport function createIpfsClient(options: ClientOptions): { client: KuboRPCClient } {\n const validatedOptions = validate(ClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n }),\n };\n}\n\n/**\n * Creates an IPFS client for server-side use with authentication\n *\n * @param options - Configuration options for the client including authentication\n * @returns An object containing the authenticated IPFS client instance\n * @throws Will throw an error if called on the client side or if options validation fails\n * @example\n * import { createServerIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createServerIpfsClient({\n * instance: process.env.SETTLEMINT_IPFS_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n */\nexport function createServerIpfsClient(options: ServerClientOptions): { client: KuboRPCClient } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n headers: {\n \"x-auth-token\": validatedOptions.accessToken,\n },\n }),\n };\n}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod/v4\";\n\n/**\n * Schema for validating client options for the
|
|
1
|
+
{"version":3,"sources":["../src/ipfs.ts","../src/helpers/client-options.schema.ts"],"sourcesContent":["import { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport { type KuboRPCClient, create } from \"kubo-rpc-client\";\nimport {\n type ClientOptions,\n ClientOptionsSchema,\n type ServerClientOptions,\n ServerClientOptionsSchema,\n} from \"./helpers/client-options.schema.js\";\n\n/**\n * Creates an IPFS client for client-side use\n *\n * @param options - Configuration options for the client\n * @returns An object containing the configured IPFS client instance\n * @throws Will throw an error if the options fail validation\n * @example\n * ```ts\n * import { createIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createIpfsClient({\n * instance: 'https://ipfs.settlemint.com'\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n * ```\n */\nexport function createIpfsClient(options: ClientOptions): { client: KuboRPCClient } {\n const validatedOptions = validate(ClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n }),\n };\n}\n\n/**\n * Creates an IPFS client for server-side use with authentication\n *\n * @param options - Configuration options for the client including authentication\n * @returns An object containing the authenticated IPFS client instance\n * @throws Will throw an error if called on the client side or if options validation fails\n * @example\n * import { createServerIpfsClient } from '@settlemint/sdk-ipfs';\n *\n * const { client } = createServerIpfsClient({\n * instance: process.env.SETTLEMINT_IPFS_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * });\n *\n * // Upload a file using Blob\n * const blob = new Blob(['Hello, world!'], { type: 'text/plain' });\n * const result = await client.add(blob);\n * console.log(result.cid.toString());\n */\nexport function createServerIpfsClient(options: ServerClientOptions): { client: KuboRPCClient } {\n ensureServer();\n const validatedOptions = validate(ServerClientOptionsSchema, options);\n\n return {\n client: create({\n url: validatedOptions.instance,\n headers: {\n \"x-auth-token\": validatedOptions.accessToken,\n },\n }),\n };\n}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { z } from \"zod/v4\";\n\n/**\n * Schema for validating client options for the IPFS client.\n */\nexport const ClientOptionsSchema = z.object({\n /** The URL of the IPFS 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 IPFS client.\n * Extends the ClientOptionsSchema with additional server-specific fields.\n */\nexport const ServerClientOptionsSchema = ClientOptionsSchema.extend({\n /** The access token used to authenticate with the SettleMint platform */\n accessToken: ApplicationAccessTokenSchema,\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,SAA6B,cAAc;;;ACF3C,SAAS,8BAA8B,iBAAiB;AACxD,SAAS,SAAS;AAKX,IAAM,sBAAsB,EAAE,OAAO;AAAA;AAAA,EAE1C,UAAU;AACZ,CAAC;AAWM,IAAM,4BAA4B,oBAAoB,OAAO;AAAA;AAAA,EAElE,aAAa;AACf,CAAC;;;ADOM,SAAS,iBAAiB,SAAmD;AAClF,QAAM,mBAAmB,SAAS,qBAAqB,OAAO;AAE9D,SAAO;AAAA,IACL,QAAQ,OAAO;AAAA,MACb,KAAK,iBAAiB;AAAA,IACxB,CAAC;AAAA,EACH;AACF;AAqBO,SAAS,uBAAuB,SAAyD;AAC9F,eAAa;AACb,QAAM,mBAAmB,SAAS,2BAA2B,OAAO;AAEpE,SAAO;AAAA,IACL,QAAQ,OAAO;AAAA,MACb,KAAK,iBAAiB;AAAA,MACtB,SAAS;AAAA,QACP,gBAAgB,iBAAiB;AAAA,MACnC;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlemint/sdk-ipfs",
|
|
3
3
|
"description": "IPFS integration module for SettleMint SDK, enabling decentralized storage and content addressing",
|
|
4
|
-
"version": "2.3.2-
|
|
4
|
+
"version": "2.3.2-prf63bb3f0",
|
|
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.3.2-
|
|
54
|
+
"@settlemint/sdk-utils": "2.3.2-prf63bb3f0",
|
|
55
55
|
"kubo-rpc-client": "^5",
|
|
56
56
|
"zod": "^3.25.0"
|
|
57
57
|
},
|