@directus/composables 10.1.7 → 10.1.9

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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AppCollection, Field, Item, Query, RefRecord } from '@directus/types';
2
2
  import { ComputedRef, Ref, WritableComputedRef, Component } from 'vue';
3
3
  import { AppExtensionConfigs } from '@directus/extensions';
4
+ import { DirectusClient, RestClient } from '@directus/sdk';
4
5
  import { AxiosInstance } from 'axios';
5
6
 
6
7
  type UsableCollection = {
@@ -151,6 +152,7 @@ declare function useSync<T, K extends keyof T & string, E extends (event: `updat
151
152
 
152
153
  declare function useStores(): Record<string, any>;
153
154
  declare function useApi(): AxiosInstance;
155
+ declare function useSdk<Schema extends object = any>(): DirectusClient<Schema> & RestClient<Schema>;
154
156
  declare function useExtensions(): RefRecord<AppExtensionConfigs>;
155
157
 
156
- export { type ComputedQuery, type GroupableInstance, type GroupableOptions, type ManualSortData, type UsableCollection, type UsableCustomSelection, type UsableGroupable, type UsableItems, sizeProps, useApi, useCollection, useCustomSelection, useCustomSelectionMultiple, useElementSize, useExtensions, useFilterFields, useGroupable, useGroupableParent, useItems, useLayout, useSizeClass, useStores, useSync };
158
+ export { type ComputedQuery, type GroupableInstance, type GroupableOptions, type ManualSortData, type UsableCollection, type UsableCustomSelection, type UsableGroupable, type UsableItems, sizeProps, useApi, useCollection, useCustomSelection, useCustomSelectionMultiple, useElementSize, useExtensions, useFilterFields, useGroupable, useGroupableParent, useItems, useLayout, useSdk, useSizeClass, useStores, useSync };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { computed, ref } from "vue";
3
3
 
4
4
  // src/use-system.ts
5
- import { API_INJECT, EXTENSIONS_INJECT, STORES_INJECT } from "@directus/constants";
5
+ import { API_INJECT, EXTENSIONS_INJECT, SDK_INJECT, STORES_INJECT } from "@directus/constants";
6
6
  import { inject } from "vue";
7
7
  function useStores() {
8
8
  const stores = inject(STORES_INJECT);
@@ -16,6 +16,12 @@ function useApi() {
16
16
  throw new Error("[useApi]: The api could not be found.");
17
17
  return api;
18
18
  }
19
+ function useSdk() {
20
+ const sdk = inject(SDK_INJECT);
21
+ if (!sdk)
22
+ throw new Error("[useSdk]: The sdk could not be found.");
23
+ return sdk;
24
+ }
19
25
  function useExtensions() {
20
26
  const extensions = inject(EXTENSIONS_INJECT);
21
27
  if (!extensions)
@@ -727,6 +733,7 @@ export {
727
733
  useGroupableParent,
728
734
  useItems,
729
735
  useLayout,
736
+ useSdk,
730
737
  useSizeClass,
731
738
  useStores,
732
739
  useSync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/composables",
3
- "version": "10.1.7",
3
+ "version": "10.1.9",
4
4
  "description": "Shared Vue composables for Directus use",
5
5
  "homepage": "https://directus.io",
6
6
  "repository": {
@@ -22,25 +22,27 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "axios": "1.6.2",
25
+ "axios": "1.6.7",
26
26
  "lodash-es": "4.17.21",
27
- "nanoid": "5.0.4",
28
- "@directus/constants": "11.0.2",
29
- "@directus/utils": "11.0.3"
27
+ "nanoid": "5.0.5",
28
+ "@directus/utils": "11.0.5",
29
+ "@directus/constants": "11.0.3"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/lodash-es": "4.17.12",
33
- "@vitest/coverage-v8": "1.1.0",
34
- "@vue/test-utils": "2.4.3",
35
- "tsup": "8.0.1",
33
+ "@vitest/coverage-v8": "1.2.2",
34
+ "@vue/test-utils": "2.4.4",
35
+ "tsup": "8.0.2",
36
36
  "typescript": "5.3.3",
37
- "vitest": "1.1.0",
38
- "@directus/types": "11.0.3",
39
- "@directus/extensions": "0.2.1",
40
- "@directus/tsconfig": "1.0.1"
37
+ "vitest": "1.2.2",
38
+ "vue": "3.4.19",
39
+ "@directus/extensions": "0.3.2",
40
+ "@directus/tsconfig": "1.0.1",
41
+ "@directus/sdk": "15.0.1",
42
+ "@directus/types": "11.0.6"
41
43
  },
42
44
  "peerDependencies": {
43
- "vue": "3.3.13"
45
+ "vue": "^3.4"
44
46
  },
45
47
  "scripts": {
46
48
  "build": "tsup src/index.ts --format=esm --dts",