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

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/app.html ADDED
@@ -0,0 +1,13 @@
1
+ // src/app.html
2
+ <!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>Directus API</title>
7
+ %sveltekit.head%
8
+ </head>
9
+ <body>
10
+ <!-- your Directus API content here -->
11
+ <div style="display: contents">%sveltekit.body%</div>
12
+ </body>
13
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanglemedia/svelte-starter-directus-api",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "description": "directus API wrapper for all the directus sdk functionality",
@@ -22,32 +22,32 @@
22
22
  }
23
23
  },
24
24
  "devDependencies": {
25
- "@directus/types": "12.2.2",
26
- "@sveltejs/adapter-auto": "^3.2.5",
27
- "@sveltejs/package": "^2.3.5",
28
- "@sveltejs/vite-plugin-svelte": "^3.1.2",
29
- "@testing-library/jest-dom": "^6.5.0",
30
- "@testing-library/svelte": "^5.2.3",
31
- "@vitest/coverage-v8": "^2.1.2",
32
- "jsdom": "^25.0.1",
33
- "msw": "^2.4.9",
34
- "svelte": "^4.2.19",
35
- "svelte-check": "^4.0.4",
36
- "vite": "^5.4.8",
37
- "vitest": "^2.1.2",
38
- "@internal/eslint-config": "0.0.0",
39
- "@tanglemedia/svelte-starter-core": "1.0.0"
25
+ "@directus/types": "13.0.0",
26
+ "@sveltejs/adapter-auto": "^4.0.0",
27
+ "@sveltejs/package": "^2.3.10",
28
+ "@sveltejs/vite-plugin-svelte": "^5.0.3",
29
+ "@testing-library/jest-dom": "^6.6.3",
30
+ "@testing-library/svelte": "^5.2.7",
31
+ "@vitest/coverage-v8": "^3.0.8",
32
+ "jsdom": "^26.0.0",
33
+ "msw": "^2.7.3",
34
+ "svelte": "^5.22.6",
35
+ "svelte-check": "^4.1.5",
36
+ "vite": "^6.2.1",
37
+ "vitest": "^3.0.8",
38
+ "@tanglemedia/svelte-starter-core": "2.0.0",
39
+ "@internal/eslint-config": "0.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@directus/sdk": "18.0.1",
42
+ "@directus/sdk": "19.0.1",
43
43
  "@types/js-cookie": "^3.0.6",
44
- "esm-env": "^1.0.0",
44
+ "esm-env": "^1.2.2",
45
45
  "js-cookie": "^3.0.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@sveltejs/kit": ">=2 <3",
49
- "@tanglemedia/svelte-starter-core": ">=1.0.0",
50
- "svelte": ">=4 <5"
49
+ "@tanglemedia/svelte-starter-core": ">=2.0.0",
50
+ "svelte": "^4.0.0 || >=5.0.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "svelte-package --input ./src --output ./dist",
@@ -232,10 +232,13 @@ export class DirectusApiAdapter<
232
232
  public async put<T extends object, R = T>(
233
233
  collection: Path,
234
234
  key?: ApiId,
235
- payload?: AnyObject
235
+ payload?: AnyObject,
236
+ query?: Record<string, unknown>
236
237
  ): Promise<ApiResponse<R>> {
237
238
  if (key) {
238
- const data = (await this.directus.request<T>(updateItem(collection, key, payload))) as R;
239
+ const data = (await this.directus.request<T>(
240
+ updateItem(collection, key, payload, query)
241
+ )) as R;
239
242
  return this.transformResponse({ data }, 201);
240
243
  } else {
241
244
  console.error(`Error updating all ${collection}: no key specified`);
@@ -250,7 +253,7 @@ export class DirectusApiAdapter<
250
253
  }
251
254
 
252
255
  async createMany<T, R = T>(path: Path, body: ApiCreateManyQuery<T>) {
253
- const data = await this.directus.request<T>(createItems(path, body.data));
256
+ const data = await this.directus.request<T>(createItems(path, body.data, body?.query));
254
257
  return this.transformResponse<R[]>({ data }, 200);
255
258
  }
256
259
 
@@ -258,7 +261,9 @@ export class DirectusApiAdapter<
258
261
  if (!body.ids) {
259
262
  throw Error('You must provide an array of keys to update');
260
263
  }
261
- const data = await this.directus.request<T>(updateItems(path, body.ids || [], body.data));
264
+ const data = await this.directus.request<T>(
265
+ updateItems(path, body.ids || [], body.data, body?.query)
266
+ );
262
267
  return this.transformResponse<R[]>({ data }, 200);
263
268
  }
264
269
 
package/src/app.html ADDED
@@ -0,0 +1,13 @@
1
+ // src/app.html
2
+ <!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>Directus API</title>
7
+ %sveltekit.head%
8
+ </head>
9
+ <body>
10
+ <!-- your Directus API content here -->
11
+ <div style="display: contents">%sveltekit.body%</div>
12
+ </body>
13
+ </html>