@seedprotocol/react 0.7.5 → 0.7.6-next.957.g6bb7768

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 { default as React, ReactNode } from 'react';
2
- import { SeedConstructorOptions, SchemaFileFormat } from '@seedprotocol/sdk';
3
- /** Schema input: path string or SchemaFileFormat object. Merged into config.schema at init. */
4
- type SchemaInput = string | SchemaFileFormat;
2
+ import { SeedConstructorOptions, SchemaFileInput } from '@seedprotocol/sdk';
3
+ /** Schema input: path string or schema object. Merged into config.schema at init. */
4
+ type SchemaInput = string | SchemaFileInput;
5
5
  export type SeedClientGateProps = {
6
6
  /** Seed client init options (config + addresses). Required. */
7
7
  initConfig: SeedConstructorOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"SeedClientGate.d.ts","sourceRoot":"","sources":["../src/SeedClientGate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAc,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG7F,+FAA+F;AAC/F,KAAK,WAAW,GAAG,MAAM,GAAG,gBAAgB,CAAA;AAkB5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,+DAA+D;IAC/D,UAAU,EAAE,sBAAsB,CAAA;IAClC,mHAAmH;IACnH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,gJAAgJ;IAChJ,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+GAA+G;IAC/G,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACT,EAAE,mBAAmB,qBA8DrB"}
1
+ {"version":3,"file":"SeedClientGate.d.ts","sourceRoot":"","sources":["../src/SeedClientGate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAG5F,qFAAqF;AACrF,KAAK,WAAW,GAAG,MAAM,GAAG,eAAe,CAAA;AAkB3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,+DAA+D;IAC/D,UAAU,EAAE,sBAAsB,CAAA;IAClC,mHAAmH;IACnH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,gJAAgJ;IAChJ,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+GAA+G;IAC/G,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACT,EAAE,mBAAmB,qBA8DrB"}
@@ -1,7 +1,22 @@
1
1
  import { default as React, ReactNode } from 'react';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
+ import { SeedConfig, SeedConstructorOptions } from '@seedprotocol/sdk';
3
4
  export type SeedProviderProps = {
4
5
  children: ReactNode;
6
+ /**
7
+ * Starts the Seed client with this config (`client.init`) when the provider mounts. Children
8
+ * render straight away; the hooks report loading until the client is ready. Leave it out when you
9
+ * call `client.init` yourself or start the client with `SeedClientGate`. Init runs again when
10
+ * the config object changes, so define it outside the component.
11
+ */
12
+ config?: SeedConfig;
13
+ /** Addresses passed to `client.init` with `config`. See `SeedConstructorOptions.addresses`. */
14
+ addresses?: SeedConstructorOptions['addresses'];
15
+ /**
16
+ * Called when `client.init` fails, e.g. with `DatabaseNotPersistentError` (`DB_NOT_PERSISTENT`)
17
+ * or `FileSystemLockedError` (`OPFS_LOCKED`). Without it the error is logged.
18
+ */
19
+ onInitError?: (err: unknown) => void;
5
20
  /** Optional: use your own QueryClient. If not provided, a default client with Seed options is created. */
6
21
  queryClient?: QueryClient;
7
22
  /** Optional: ref to receive the QueryClient instance (e.g. for tests). */
@@ -20,11 +35,11 @@ declare global {
20
35
  export declare function invalidateItemPropertiesForItem(canonicalId: string): Promise<void>;
21
36
  /**
22
37
  * Provider that supplies a React Query client to Seed list hooks (useSchemas, useItems, useModels, etc.)
23
- * so results are cached and shared across components. Wrap your app (or the subtree that uses Seed hooks)
24
- * after calling client.init().
38
+ * so results are cached and shared across components. Wrap your app (or the subtree that uses Seed hooks).
25
39
  *
26
- * - No props: uses an internal QueryClient with Seed defaults.
40
+ * - config prop: starts the client with `client.init({ config, addresses })`.
41
+ * - No queryClient prop: uses an internal QueryClient with Seed defaults.
27
42
  * - queryClient prop: use your own client (e.g. merge getSeedQueryDefaultOptions when creating it).
28
43
  */
29
- export declare function SeedProvider({ children, queryClient: queryClientProp, queryClientRef }: SeedProviderProps): React.JSX.Element;
44
+ export declare function SeedProvider({ children, config, addresses, onInitError, queryClient: queryClientProp, queryClientRef, }: SeedProviderProps): React.JSX.Element;
30
45
  //# sourceMappingURL=SeedProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeedProvider.d.ts","sourceRoot":"","sources":["../src/SeedProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAKxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB,0GAA0G;IAC1G,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAC5D,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,mCAAmC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;KAC7E;CACF;AAKD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlF;AAoCD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,iBAAiB,qBAyBzG"}
1
+ {"version":3,"file":"SeedProvider.d.ts","sourceRoot":"","sources":["../src/SeedProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAA8B,MAAM,OAAO,CAAA;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAG3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;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