@withstudiocms/sdk 0.1.0-beta.1 → 0.1.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.
- package/dist/consts.d.ts +10 -1
- package/dist/consts.js +12 -3
- package/dist/context.d.ts +36 -16
- package/dist/context.js +8 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +341 -453
- package/dist/lib/pluginUtils.d.ts +4 -3
- package/dist/lib/pluginUtils.js +17 -10
- package/dist/lib/storage-manager.d.ts +10 -0
- package/dist/lib/storage-manager.js +17 -0
- package/dist/migrations/20251025T040912_init.d.ts +17 -0
- package/dist/migrations/20251025T040912_init.js +260 -0
- package/dist/migrations/20251130T150847_drop_deprecated.d.ts +13 -0
- package/dist/migrations/20251130T150847_drop_deprecated.js +262 -0
- package/dist/migrations/20251221T002125_url-mapping.d.ts +13 -0
- package/dist/migrations/20251221T002125_url-mapping.js +228 -0
- package/dist/migrator.d.ts +25 -0
- package/dist/migrator.js +21 -0
- package/dist/modules/auth/index.d.ts +60 -104
- package/dist/modules/auth/index.js +33 -9
- package/dist/modules/config/index.d.ts +5 -5
- package/dist/modules/config/index.js +26 -7
- package/dist/modules/delete/index.d.ts +2 -1
- package/dist/modules/delete/index.js +7 -2
- package/dist/modules/diffTracking/index.d.ts +8 -8
- package/dist/modules/diffTracking/index.js +7 -6
- package/dist/modules/get/index.d.ts +116 -16
- package/dist/modules/get/index.js +135 -22
- package/dist/modules/index.d.ts +326 -446
- package/dist/modules/init/index.d.ts +9 -9
- package/dist/modules/middleware/index.d.ts +2 -2
- package/dist/modules/notificationSettings/index.d.ts +3 -3
- package/dist/modules/plugins/index.d.ts +9 -8
- package/dist/modules/plugins/index.js +17 -6
- package/dist/modules/post/index.d.ts +29 -28
- package/dist/modules/post/index.js +47 -15
- package/dist/modules/resetTokenBucket/index.d.ts +1 -1
- package/dist/modules/resetTokenBucket/index.js +5 -2
- package/dist/modules/rest_api/index.d.ts +8 -8
- package/dist/modules/rest_api/index.js +7 -3
- package/dist/modules/update/index.d.ts +25 -25
- package/dist/modules/update/index.js +28 -10
- package/dist/modules/util/collectors.d.ts +14 -150
- package/dist/modules/util/collectors.js +41 -14
- package/dist/modules/util/folderTree.d.ts +4 -4
- package/dist/modules/util/folderTree.js +1 -1
- package/dist/modules/util/getFromNPM.d.ts +13 -5
- package/dist/modules/util/getFromNPM.js +8 -2
- package/dist/modules/util/index.d.ts +30 -166
- package/dist/modules/util/users.d.ts +7 -7
- package/dist/tables.d.ts +433 -0
- package/dist/tables.js +169 -0
- package/dist/types.d.ts +6 -7
- package/package.json +17 -5
package/dist/consts.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare const cacheTags: {
|
|
|
11
11
|
pages: string[];
|
|
12
12
|
pageFolderTree: string[];
|
|
13
13
|
middleware: string[];
|
|
14
|
+
taxonomy: string[];
|
|
15
|
+
tags: string[];
|
|
16
|
+
categories: string[];
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
16
19
|
* Functions to generate cache keys for various SDK operations.
|
|
@@ -23,6 +26,12 @@ export declare const cacheKeyGetters: {
|
|
|
23
26
|
folderTree: () => string;
|
|
24
27
|
folderList: () => string;
|
|
25
28
|
page: (pageId: string) => string;
|
|
26
|
-
pageFolderTree: (
|
|
29
|
+
pageFolderTree: () => string;
|
|
27
30
|
middleware: () => string;
|
|
31
|
+
tags: () => string;
|
|
32
|
+
categories: () => string;
|
|
33
|
+
categoryById: (categoryId: number) => string;
|
|
34
|
+
categoryBySlug: (slug: string) => string;
|
|
35
|
+
tagById: (tagId: number) => string;
|
|
36
|
+
tagBySlug: (slug: string) => string;
|
|
28
37
|
};
|
package/dist/consts.js
CHANGED
|
@@ -7,7 +7,10 @@ const cacheTags = {
|
|
|
7
7
|
folderList: ["folder-list"],
|
|
8
8
|
pages: ["pages"],
|
|
9
9
|
pageFolderTree: ["page-folder-tree"],
|
|
10
|
-
middleware: ["middleware"]
|
|
10
|
+
middleware: ["middleware"],
|
|
11
|
+
taxonomy: ["taxonomy"],
|
|
12
|
+
tags: ["tags"],
|
|
13
|
+
categories: ["categories"]
|
|
11
14
|
};
|
|
12
15
|
const cacheKeyGetters = {
|
|
13
16
|
dynamicConfig: (id) => `dynamic-config:${id}`,
|
|
@@ -17,8 +20,14 @@ const cacheKeyGetters = {
|
|
|
17
20
|
folderTree: () => "folder-tree",
|
|
18
21
|
folderList: () => "folder-list",
|
|
19
22
|
page: (pageId) => `page:${pageId}`,
|
|
20
|
-
pageFolderTree: (
|
|
21
|
-
middleware: () => "middleware"
|
|
23
|
+
pageFolderTree: () => "page-folder-tree",
|
|
24
|
+
middleware: () => "middleware",
|
|
25
|
+
tags: () => "tags",
|
|
26
|
+
categories: () => "categories",
|
|
27
|
+
categoryById: (categoryId) => `category:${categoryId}`,
|
|
28
|
+
categoryBySlug: (slug) => `category-slug:${slug}`,
|
|
29
|
+
tagById: (tagId) => `tag:${tagId}`,
|
|
30
|
+
tagBySlug: (slug) => `tag-slug:${slug}`
|
|
22
31
|
};
|
|
23
32
|
export {
|
|
24
33
|
cacheKeyGetters,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Context, Layer } from '@withstudiocms/effect';
|
|
2
|
-
import type { DBClientInterface
|
|
2
|
+
import type { DBClientInterface } from '@withstudiocms/kysely/client';
|
|
3
3
|
import type { CacheEntry } from './cache.js';
|
|
4
|
+
import type { StudioCMSDatabaseSchema } from './tables.js';
|
|
4
5
|
declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/sdk/context/DBClientLive", DBClientInterface<{
|
|
5
6
|
readonly StudioCMSUsersTable: {
|
|
6
7
|
readonly id: string;
|
|
7
|
-
readonly url: string | null | undefined;
|
|
8
8
|
readonly name: string;
|
|
9
|
-
readonly email: string | null | undefined;
|
|
10
|
-
readonly avatar: string | null | undefined;
|
|
11
9
|
readonly username: string;
|
|
12
|
-
readonly password: string | null | undefined;
|
|
13
10
|
readonly updatedAt: import("kysely").ColumnType<string, string, string>;
|
|
14
|
-
readonly createdAt: import("kysely").ColumnType<string, string | undefined,
|
|
11
|
+
readonly createdAt: import("kysely").ColumnType<string, string | undefined, undefined>;
|
|
15
12
|
readonly emailVerified: number;
|
|
16
|
-
readonly
|
|
13
|
+
readonly url?: string | null | undefined;
|
|
14
|
+
readonly email?: string | null | undefined;
|
|
15
|
+
readonly avatar?: string | null | undefined;
|
|
16
|
+
readonly password?: string | null | undefined;
|
|
17
|
+
readonly notifications?: string | null | undefined;
|
|
17
18
|
};
|
|
18
19
|
readonly StudioCMSOAuthAccounts: {
|
|
19
20
|
readonly providerUserId: string;
|
|
@@ -29,8 +30,8 @@ declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/
|
|
|
29
30
|
readonly id: string;
|
|
30
31
|
readonly userId: string;
|
|
31
32
|
readonly key: string;
|
|
32
|
-
readonly creationDate: import("kysely").ColumnType<string, string | undefined,
|
|
33
|
-
readonly description
|
|
33
|
+
readonly creationDate: import("kysely").ColumnType<string, string | undefined, undefined>;
|
|
34
|
+
readonly description?: string | null | undefined;
|
|
34
35
|
};
|
|
35
36
|
readonly StudioCMSUserResetTokens: {
|
|
36
37
|
readonly id: string;
|
|
@@ -44,7 +45,7 @@ declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/
|
|
|
44
45
|
readonly StudioCMSPageFolderStructure: {
|
|
45
46
|
readonly id: string;
|
|
46
47
|
readonly name: string;
|
|
47
|
-
readonly parent
|
|
48
|
+
readonly parent?: string | null | undefined;
|
|
48
49
|
};
|
|
49
50
|
readonly StudioCMSPageData: {
|
|
50
51
|
readonly id: string;
|
|
@@ -56,25 +57,25 @@ declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/
|
|
|
56
57
|
readonly publishedAt: import("kysely").ColumnType<string, string, string>;
|
|
57
58
|
readonly slug: string;
|
|
58
59
|
readonly contentLang: string;
|
|
59
|
-
readonly heroImage: string | null | undefined;
|
|
60
60
|
readonly categories: import("kysely").ColumnType<string, string, string>;
|
|
61
61
|
readonly tags: import("kysely").ColumnType<string, string, string>;
|
|
62
62
|
readonly authorId: string;
|
|
63
63
|
readonly contributorIds: import("kysely").ColumnType<string, string, string>;
|
|
64
64
|
readonly showAuthor: number;
|
|
65
65
|
readonly showContributors: number;
|
|
66
|
-
readonly parentFolder: string | null | undefined;
|
|
67
66
|
readonly draft: number;
|
|
68
67
|
readonly augments: import("kysely").ColumnType<string, string, string>;
|
|
68
|
+
readonly heroImage?: string | null | undefined;
|
|
69
|
+
readonly parentFolder?: string | null | undefined;
|
|
69
70
|
};
|
|
70
71
|
readonly StudioCMSDiffTracking: {
|
|
71
72
|
readonly id: string;
|
|
72
73
|
readonly userId: string;
|
|
73
74
|
readonly pageId: string;
|
|
74
|
-
readonly timestamp: import("kysely").ColumnType<string, string | undefined,
|
|
75
|
+
readonly timestamp: import("kysely").ColumnType<string, string | undefined, undefined>;
|
|
75
76
|
readonly pageMetaData: import("kysely").ColumnType<string, string, string>;
|
|
76
77
|
readonly pageContentStart: string;
|
|
77
|
-
readonly diff
|
|
78
|
+
readonly diff?: string | null | undefined;
|
|
78
79
|
};
|
|
79
80
|
readonly StudioCMSPageDataTags: {
|
|
80
81
|
readonly id: number;
|
|
@@ -87,9 +88,9 @@ declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/
|
|
|
87
88
|
readonly id: number;
|
|
88
89
|
readonly name: string;
|
|
89
90
|
readonly description: string;
|
|
90
|
-
readonly parent: number | null | undefined;
|
|
91
91
|
readonly slug: string;
|
|
92
92
|
readonly meta: import("kysely").ColumnType<string, string, string>;
|
|
93
|
+
readonly parent?: number | null | undefined;
|
|
93
94
|
};
|
|
94
95
|
readonly StudioCMSPageContent: {
|
|
95
96
|
readonly id: string;
|
|
@@ -111,6 +112,14 @@ declare const DBClientLive_base: Context.TagClass<DBClientLive, "@withstudiocms/
|
|
|
111
112
|
readonly id: string;
|
|
112
113
|
readonly data: import("kysely").ColumnType<string, string, string>;
|
|
113
114
|
};
|
|
115
|
+
readonly StudioCMSStorageManagerUrlMappings: {
|
|
116
|
+
readonly url: string;
|
|
117
|
+
readonly updatedAt: number;
|
|
118
|
+
readonly createdAt: import("kysely").ColumnType<number, number | undefined, undefined>;
|
|
119
|
+
readonly identifier: string;
|
|
120
|
+
readonly isPermanent: import("kysely").ColumnType<number, boolean, boolean>;
|
|
121
|
+
readonly expiresAt?: number | null | undefined;
|
|
122
|
+
};
|
|
114
123
|
}>>;
|
|
115
124
|
/**
|
|
116
125
|
* Context tag representing the database client interface for StudioCMS.
|
|
@@ -170,6 +179,7 @@ export interface SDKContext {
|
|
|
170
179
|
store: Map<string, CacheEntry<unknown>>;
|
|
171
180
|
tagIndex: Map<string, Set<string>>;
|
|
172
181
|
};
|
|
182
|
+
storageManagerResolver: (identifier: string) => Promise<string>;
|
|
173
183
|
}
|
|
174
184
|
declare const CacheStores_base: Context.TagClass<CacheStores, "@withstudiocms/sdk/context/CacheStores", {
|
|
175
185
|
store: Map<string, CacheEntry<unknown>>;
|
|
@@ -178,11 +188,21 @@ declare const CacheStores_base: Context.TagClass<CacheStores, "@withstudiocms/sd
|
|
|
178
188
|
export declare class CacheStores extends CacheStores_base {
|
|
179
189
|
static live: (cache: SDKContext["cache"]) => Layer.Layer<CacheStores, never, never>;
|
|
180
190
|
}
|
|
191
|
+
declare const StorageManagerResolver_base: Context.TagClass<StorageManagerResolver, "@withstudiocms/sdk/context/StorageManagerResolver", (identifier: string) => Promise<string>>;
|
|
192
|
+
/**
|
|
193
|
+
* Context tag representing the storage manager resolver function.
|
|
194
|
+
*
|
|
195
|
+
* This tag can be used to access the function responsible for resolving storage manager URLs
|
|
196
|
+
* based on given identifiers.
|
|
197
|
+
*/
|
|
198
|
+
export declare class StorageManagerResolver extends StorageManagerResolver_base {
|
|
199
|
+
static live: (resolver: SDKContext["storageManagerResolver"]) => Layer.Layer<StorageManagerResolver, never, never>;
|
|
200
|
+
}
|
|
181
201
|
/**
|
|
182
202
|
* Combines the database client and SDK default options into a single SDK context layer.
|
|
183
203
|
*
|
|
184
204
|
* @param context - An object containing the database client and default SDK options.
|
|
185
205
|
* @returns A merged layer that provides both the DBClient and SDKDefaults context tags.
|
|
186
206
|
*/
|
|
187
|
-
export declare const makeSDKContext: (context: SDKContext) => Layer.Layer<DBClientLive | SDKDefaults | CacheStores, never, never>;
|
|
207
|
+
export declare const makeSDKContext: (context: SDKContext) => Layer.Layer<DBClientLive | SDKDefaults | CacheStores | StorageManagerResolver, never, never>;
|
|
188
208
|
export {};
|
package/dist/context.js
CHANGED
|
@@ -20,14 +20,21 @@ class SDKDefaults extends Context.Tag("@withstudiocms/sdk/context/SDKDefaults")(
|
|
|
20
20
|
class CacheStores extends Context.Tag("@withstudiocms/sdk/context/CacheStores")() {
|
|
21
21
|
static live = (cache) => Layer.succeed(this, cache);
|
|
22
22
|
}
|
|
23
|
+
class StorageManagerResolver extends Context.Tag(
|
|
24
|
+
"@withstudiocms/sdk/context/StorageManagerResolver"
|
|
25
|
+
)() {
|
|
26
|
+
static live = (resolver) => Layer.succeed(this, resolver);
|
|
27
|
+
}
|
|
23
28
|
const makeSDKContext = (context) => Layer.mergeAll(
|
|
24
29
|
DBClientLive.Live(context.db),
|
|
25
30
|
SDKDefaults.live(context.defaults),
|
|
26
|
-
CacheStores.live(context.cache)
|
|
31
|
+
CacheStores.live(context.cache),
|
|
32
|
+
StorageManagerResolver.live(context.storageManagerResolver)
|
|
27
33
|
);
|
|
28
34
|
export {
|
|
29
35
|
CacheStores,
|
|
30
36
|
DBClientLive,
|
|
31
37
|
SDKDefaults,
|
|
38
|
+
StorageManagerResolver,
|
|
32
39
|
makeSDKContext
|
|
33
40
|
};
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const StudioCMSSDKError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "StudioCMSSDKError";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
export declare class StudioCMSSDKError extends StudioCMSSDKError_base<{
|
|
5
|
+
message: string;
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
}> {
|
|
8
|
+
}
|
|
9
|
+
export {};
|