@tanglemedia/svelte-starter-directus-api 6.0.0 → 6.0.1

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.
@@ -32,7 +32,7 @@ export declare class DirectusApiAdapter<Schema extends SchemaShape = SchemaShape
32
32
  patch<T>(collection: Path, key: ApiId, query?: Record<string, unknown>): Promise<ApiResponse<T>>;
33
33
  post<T>(collection: Path, data: AnyObject, query?: Record<string, unknown>): Promise<ApiResponse<T>>;
34
34
  delete<T>(collection: Path, key?: ApiId): Promise<ApiResponse<T>>;
35
- put<T extends object, R = T>(collection: Path, key?: ApiId, payload?: AnyObject): Promise<ApiResponse<R>>;
35
+ put<T extends object, R = T>(collection: Path, key?: ApiId, payload?: AnyObject, query?: Record<string, unknown>): Promise<ApiResponse<R>>;
36
36
  upload<T>(path: string | undefined, data: FormData): Promise<ApiResponse<T>>;
37
37
  createMany<T, R = T>(path: Path, body: ApiCreateManyQuery<T>): Promise<ApiResponse<R[], Response, AnyObject>>;
38
38
  updateMany<T, R = T>(path: Path, body: ApiUpdateManyQuery<T>): Promise<ApiResponse<R[], Response, AnyObject>>;
@@ -128,9 +128,9 @@ export class DirectusApiAdapter extends ApiAdapterAbstract {
128
128
  const data = await this.directus.request(deleteItem(collection, key));
129
129
  return this.transformResponse({ data }, 202);
130
130
  }
131
- async put(collection, key, payload) {
131
+ async put(collection, key, payload, query) {
132
132
  if (key) {
133
- const data = (await this.directus.request(updateItem(collection, key, payload)));
133
+ const data = (await this.directus.request(updateItem(collection, key, payload, query)));
134
134
  return this.transformResponse({ data }, 201);
135
135
  }
136
136
  else {
@@ -144,14 +144,14 @@ export class DirectusApiAdapter extends ApiAdapterAbstract {
144
144
  return this.transformResponse({ data: response }, 201);
145
145
  }
146
146
  async createMany(path, body) {
147
- const data = await this.directus.request(createItems(path, body.data));
147
+ const data = await this.directus.request(createItems(path, body.data, body?.query));
148
148
  return this.transformResponse({ data }, 200);
149
149
  }
150
150
  async updateMany(path, body) {
151
151
  if (!body.ids) {
152
152
  throw Error('You must provide an array of keys to update');
153
153
  }
154
- const data = await this.directus.request(updateItems(path, body.ids || [], body.data));
154
+ const data = await this.directus.request(updateItems(path, body.ids || [], body.data, body?.query));
155
155
  return this.transformResponse({ data }, 200);
156
156
  }
157
157
  async deleteMany(path, body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanglemedia/svelte-starter-directus-api",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "description": "directus API wrapper for all the directus sdk functionality",
@@ -35,8 +35,8 @@
35
35
  "svelte-check": "^4.1.5",
36
36
  "vite": "^6.2.1",
37
37
  "vitest": "^3.0.8",
38
- "@tanglemedia/svelte-starter-core": "2.0.0",
39
- "@internal/eslint-config": "0.0.0"
38
+ "@internal/eslint-config": "0.0.0",
39
+ "@tanglemedia/svelte-starter-core": "2.0.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "@directus/sdk": "19.0.1",
@@ -93,7 +93,6 @@ export {
93
93
  updateOperations,
94
94
  deleteOperation,
95
95
  deleteOperations,
96
- triggerOperation,
97
96
  readPanels,
98
97
  readPanel,
99
98
  createPanel,