@contember/bindx-uploader 0.1.5 → 0.1.11

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.
@@ -1,7 +1,7 @@
1
1
  import { S3UploadClient, type S3UploadClientOptions } from '../uploadClient/S3UploadClient.js';
2
2
  /**
3
- * Creates an S3 upload client using the current Contember GraphQL client.
4
- * Uses the bindx context to get the GraphQL client for URL signing.
3
+ * Creates an S3 upload client using the GraphQL client from bindx context.
4
+ * Requires ContemberBindxProvider (which provides graphQlClient).
5
5
  */
6
6
  export declare const useS3Client: (options?: Partial<S3UploadClientOptions>) => S3UploadClient;
7
7
  //# sourceMappingURL=useS3Client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useS3Client.d.ts","sourceRoot":"","sources":["../../src/hooks/useS3Client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAG9F;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,OAAO,CAAC,qBAAqB,CAAM,KAAG,cAgB1E,CAAA"}
1
+ {"version":3,"file":"useS3Client.d.ts","sourceRoot":"","sources":["../../src/hooks/useS3Client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAG9F;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,OAAO,CAAC,qBAAqB,CAAM,KAAG,cAa1E,CAAA"}
@@ -1,8 +1,8 @@
1
- import type { GraphQlClient } from '@contember/graphql-client';
1
+ import type { BindxGraphQlClient } from '@contember/bindx-react';
2
2
  import type { S3FileParameters, S3SignedUrlResponse } from '../uploadClient/types.js';
3
3
  /**
4
4
  * Creates an S3 URL signer that batches requests to reduce API calls.
5
5
  * Uses microtask scheduling to batch concurrent signing requests into a single GraphQL mutation.
6
6
  */
7
- export declare const createContentApiS3Signer: (client: GraphQlClient) => ((parameters: S3FileParameters) => Promise<S3SignedUrlResponse>);
7
+ export declare const createContentApiS3Signer: (client: BindxGraphQlClient) => ((parameters: S3FileParameters) => Promise<S3SignedUrlResponse>);
8
8
  //# sourceMappingURL=urlSigner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"urlSigner.d.ts","sourceRoot":"","sources":["../../src/utils/urlSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACpC,QAAQ,aAAa,KACnB,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAiCjE,CAAA"}
1
+ {"version":3,"file":"urlSigner.d.ts","sourceRoot":"","sources":["../../src/utils/urlSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACpC,QAAQ,kBAAkB,KACxB,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAiCjE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/bindx-uploader",
3
- "version": "0.1.5",
3
+ "version": "0.1.11",
4
4
  "description": "File upload components for bindx data binding",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -15,10 +15,9 @@
15
15
  "react": ">=18.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@contember/bindx": "0.1.5",
19
- "@contember/bindx-react": "0.1.5",
20
- "@contember/bindx-repeater": "0.1.5",
21
- "@contember/graphql-client": "*",
18
+ "@contember/bindx": "0.1.11",
19
+ "@contember/bindx-react": "0.1.11",
20
+ "@contember/bindx-repeater": "0.1.11",
22
21
  "@radix-ui/react-slot": "^1.2.3",
23
22
  "react-dropzone": "^14.3.8"
24
23
  },
@@ -4,23 +4,20 @@ import { S3UploadClient, type S3UploadClientOptions } from '../uploadClient/S3Up
4
4
  import { createContentApiS3Signer } from '../utils/urlSigner.js'
5
5
 
6
6
  /**
7
- * Creates an S3 upload client using the current Contember GraphQL client.
8
- * Uses the bindx context to get the GraphQL client for URL signing.
7
+ * Creates an S3 upload client using the GraphQL client from bindx context.
8
+ * Requires ContemberBindxProvider (which provides graphQlClient).
9
9
  */
10
10
  export const useS3Client = (options: Partial<S3UploadClientOptions> = {}): S3UploadClient => {
11
- const { adapter } = useBindxContext()
11
+ const { graphQlClient } = useBindxContext()
12
12
 
13
13
  return useMemo(() => {
14
- // Get the GraphQL client from the adapter
15
- // ContemberAdapter has a graphQlClient property
16
- const graphQlClient = (adapter as { graphQlClient?: { execute: (query: string, options?: unknown) => Promise<unknown> } }).graphQlClient
17
14
  if (!graphQlClient) {
18
- throw new Error('useS3Client requires a Contember adapter with GraphQL client')
15
+ throw new Error('useS3Client requires ContemberBindxProvider (graphQlClient not available in context)')
19
16
  }
20
17
 
21
18
  return new S3UploadClient({
22
- signUrl: createContentApiS3Signer(graphQlClient as Parameters<typeof createContentApiS3Signer>[0]),
19
+ signUrl: createContentApiS3Signer(graphQlClient),
23
20
  ...options,
24
21
  })
25
- }, [adapter, options])
22
+ }, [graphQlClient, options])
26
23
  }
@@ -1,4 +1,4 @@
1
- import type { GraphQlClient } from '@contember/graphql-client'
1
+ import type { BindxGraphQlClient } from '@contember/bindx-react'
2
2
  import type { S3FileParameters, S3SignedUrlResponse } from '../uploadClient/types.js'
3
3
 
4
4
  /**
@@ -6,7 +6,7 @@ import type { S3FileParameters, S3SignedUrlResponse } from '../uploadClient/type
6
6
  * Uses microtask scheduling to batch concurrent signing requests into a single GraphQL mutation.
7
7
  */
8
8
  export const createContentApiS3Signer = (
9
- client: GraphQlClient,
9
+ client: BindxGraphQlClient,
10
10
  ): ((parameters: S3FileParameters) => Promise<S3SignedUrlResponse>) => {
11
11
  let uploadUrlBatchParameters: S3FileParameters[] = []
12
12
  let uploadUrlBatchResult: null | Promise<Record<string, S3SignedUrlResponse>> = null