@tanglemedia/svelte-starter-directus-api 5.0.1 → 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/adapter/api-adapter.d.ts +1 -1
- package/dist/adapter/api-adapter.js +4 -4
- package/dist/app.html +13 -0
- package/package.json +20 -20
- package/src/app.html +13 -0
|
@@ -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
|
|
35
|
+
put<T extends object, R = T>(collection: Path, key?: ApiId, payload?: AnyObject): 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) {
|
|
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)));
|
|
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));
|
|
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));
|
|
155
155
|
return this.transformResponse({ data }, 200);
|
|
156
156
|
}
|
|
157
157
|
async deleteMany(path, body) {
|
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": "
|
|
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": "
|
|
26
|
-
"@sveltejs/adapter-auto": "^
|
|
27
|
-
"@sveltejs/package": "^2.3.
|
|
28
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
29
|
-
"@testing-library/jest-dom": "^6.
|
|
30
|
-
"@testing-library/svelte": "^5.2.
|
|
31
|
-
"@vitest/coverage-v8": "^
|
|
32
|
-
"jsdom": "^
|
|
33
|
-
"msw": "^2.
|
|
34
|
-
"svelte": "^
|
|
35
|
-
"svelte-check": "^4.
|
|
36
|
-
"vite": "^
|
|
37
|
-
"vitest": "^
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
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": "
|
|
42
|
+
"@directus/sdk": "19.0.1",
|
|
43
43
|
"@types/js-cookie": "^3.0.6",
|
|
44
|
-
"esm-env": "^1.
|
|
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": ">=
|
|
50
|
-
"svelte": "
|
|
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",
|
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>
|