resourcerer 2.2.0 → 2.2.2

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.
@@ -33,7 +33,7 @@ export default class Collection<T extends Record<string, any> = object, O extend
33
33
  static cacheTimeout: number;
34
34
  static comparator: comparator;
35
35
  static measure: boolean | ((config: ResourceConfigObj) => boolean);
36
- url: (options: typeof this.urlOptions) => string;
36
+ url(options: typeof this.urlOptions): string;
37
37
  toJSON(): T[];
38
38
  sync(...args: Parameters<typeof sync>): Promise<[any, Response]>;
39
39
  add(models: ModelArg<T, O> | ModelArg<T, O>[], options?: CSetOptions): this;
@@ -6,11 +6,11 @@ declare const ModelCache: {
6
6
  get(cacheKey: string): Model<Record<string, any>, Record<string, any>> | Collection<object, object, {
7
7
  new (attributes?: object | undefined, options?: object & import("./model.js").SetOptions & import("./model.js").ConstructorOptions): Model<object, object>;
8
8
  idAttribute: string;
9
- dependencies: (string | ((attrs: Record<string, any>) => Record<string, any>))[];
9
+ dependencies: Array<string | ((attrs: Record<string, any>) => Record<string, any>)>;
10
10
  cacheTimeout: number;
11
11
  defaults: {};
12
12
  measure: boolean | ((config: import("./types.js").ResourceConfigObj) => boolean);
13
- subscriptions: import("./model.js").CanonicalModelSubscription<Record<string, any>, Record<string, any>>[];
13
+ subscriptions: import("./model.js").CanonicalModelSubscription[];
14
14
  CanonicalModel: (new (...args: any[]) => import("./canonical-model.js").default<any>) | null;
15
15
  }> | undefined;
16
16
  put(cacheKey: string, model: Model | Collection, component?: Component): void;
@@ -13,11 +13,11 @@ interface RequestOptions extends Pick<SyncOptions, "params"> {
13
13
  export declare const getFromCache: (key: string) => Model<Record<string, any>, Record<string, any>> | Collection<object, object, {
14
14
  new (attributes?: object | undefined, options?: object & import("./model.js").SetOptions & import("./model.js").ConstructorOptions): Model<object, object>;
15
15
  idAttribute: string;
16
- dependencies: (string | ((attrs: Record<string, any>) => Record<string, any>))[];
16
+ dependencies: Array<string | ((attrs: Record<string, any>) => Record<string, any>)>;
17
17
  cacheTimeout: number;
18
18
  defaults: {};
19
19
  measure: boolean | ((config: import("./types.js").ResourceConfigObj) => boolean);
20
- subscriptions: import("./model.js").CanonicalModelSubscription<Record<string, any>, Record<string, any>>[];
20
+ subscriptions: import("./model.js").CanonicalModelSubscription[];
21
21
  CanonicalModel: (new (...args: any[]) => import("./canonical-model.js").default<any>) | null;
22
22
  }> | undefined;
23
23
  export declare const existsInCache: (key: string) => boolean;
@@ -12,6 +12,6 @@ export declare function useResources<T extends ResourceKeys, O extends Record<st
12
12
  [Key in T as `${T}Status`]: number;
13
13
  };
14
14
  export declare const withResources: (getResources: ExecutorFunction) => (Component: ComponentClass<Record<string, any>>) => (props: Record<string, any>) => React.CElement<{
15
- children: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
15
+ children: React.ReactElement;
16
16
  }, ErrorBoundary>;
17
17
  export declare function getCacheKey({ resourceKey, params, path, data, }: InternalResourceConfigObj): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resourcerer",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "github.com/noahgrant/resourcerer"
@@ -32,7 +32,12 @@
32
32
  "test:coverage": "vitest run --coverage",
33
33
  "test:debug": "vitest --inspect-brk --pool threads --poolOptions.threads.singleThread run"
34
34
  },
35
- "exports": "./build/index.js",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./resourcerer.d.ts",
38
+ "import": "./build/index.js"
39
+ }
40
+ },
36
41
  "devDependencies": {
37
42
  "@eslint/eslintrc": "^3.3.5",
38
43
  "@eslint/js": "^10.0.1",