@vestcards/server-types 1.0.0 → 1.0.2

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.
@@ -421,6 +421,7 @@ declare const app: Elysia<"", {
421
421
  query: {
422
422
  sort?: string | undefined;
423
423
  free?: boolean | undefined;
424
+ ownerId?: string | undefined;
424
425
  order?: "asc" | "desc" | undefined;
425
426
  q?: string | undefined;
426
427
  topicIds?: string | undefined;
@@ -6,6 +6,7 @@ declare const PERMISSIONS: {
6
6
  readonly READ_OWN: "deck:read:own";
7
7
  readonly READ_FREE: "deck:read:free";
8
8
  readonly READ_PREMIUM: "deck:read:premium";
9
+ readonly READ_PRIVATE: "deck:read:private";
9
10
  readonly UPDATE_OWN: "deck:update:own";
10
11
  readonly UPDATE_PUBLIC: "deck:update:public";
11
12
  readonly DELETE_OWN: "deck:delete:own";
@@ -53,13 +54,13 @@ declare const PERMISSIONS: {
53
54
  readonly WRITE_PREMIUM: "library:write:premium";
54
55
  };
55
56
  };
56
- declare const ALL_PERMISSIONS: ("deck:create:own" | "deck:create:public" | "deck:read:own" | "deck:read:free" | "deck:read:premium" | "deck:update:own" | "deck:update:public" | "deck:delete:own" | "deck:delete:public" | "card-demand:read" | "card-demand:create" | "card-demand:action" | "user:update:own" | "user:update:*" | "user:delete:own" | "user:delete:*" | "user:read:own" | "user:read:*" | "stats:view" | "membership:manage" | "plan:create" | "plan:update" | "plan:delete" | "blogpost:create" | "blogpost:update" | "blogpost:delete" | "vesty:chat" | "study:read" | "study:write" | "library:read" | "library:write" | "library:write:premium")[];
57
+ declare const ALL_PERMISSIONS: ("deck:create:own" | "deck:create:public" | "deck:read:own" | "deck:read:free" | "deck:read:premium" | "deck:read:private" | "deck:update:own" | "deck:update:public" | "deck:delete:own" | "deck:delete:public" | "card-demand:read" | "card-demand:create" | "card-demand:action" | "user:update:own" | "user:update:*" | "user:delete:own" | "user:delete:*" | "user:read:own" | "user:read:*" | "stats:view" | "membership:manage" | "plan:create" | "plan:update" | "plan:delete" | "blogpost:create" | "blogpost:update" | "blogpost:delete" | "vesty:chat" | "study:read" | "study:write" | "library:read" | "library:write" | "library:write:premium")[];
57
58
  declare const ROLE_PERMISSIONS: Record<UserRole, Permission[]>;
58
59
  declare const ENTITLEMENT_PERMISSIONS: Record<Entitlement, Permission[]>;
59
60
  type ValueOf<T> = T[keyof T];
60
61
  type Permission = ValueOf<{
61
62
  [K in keyof typeof PERMISSIONS]: ValueOf<(typeof PERMISSIONS)[K]>;
62
63
  }>;
63
- declare const hasPermission: (required: Permission, userRole: UserRole, userEntitlements?: Entitlement[]) => boolean;
64
+ declare const hasPermission: (required: Permission, userRole?: UserRole, userEntitlements?: Entitlement[]) => boolean;
64
65
  export { ALL_PERMISSIONS, ENTITLEMENT_PERMISSIONS, hasPermission, PERMISSIONS, ROLE_PERMISSIONS };
65
66
  export type { Permission };
@@ -357,6 +357,7 @@ export declare const deckModule: Elysia<"/v1/decks", {
357
357
  query: {
358
358
  sort?: string | undefined;
359
359
  free?: boolean | undefined;
360
+ ownerId?: string | undefined;
360
361
  order?: "asc" | "desc" | undefined;
361
362
  q?: string | undefined;
362
363
  topicIds?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  import type { Subject } from '@vestcards/shared';
2
2
  import { type Pagination, type Search, type Sort } from '../../utils/api';
3
3
  export declare namespace DeckModel {
4
+ const deckFilter: (ownerId?: string) => import("drizzle-orm").SQL<unknown> | undefined;
4
5
  const listQuery: import("@sinclair/typebox").TObject<{
5
6
  size: import("@sinclair/typebox").TNumber;
6
7
  page: import("@sinclair/typebox").TNumber;
@@ -8,6 +9,7 @@ export declare namespace DeckModel {
8
9
  order: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"asc">, import("@sinclair/typebox").TLiteral<"desc">]>>;
9
10
  q: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
11
  free: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
12
+ ownerId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
13
  topicIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
14
  subjects: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
15
  }>;
@@ -25,8 +27,9 @@ export declare namespace DeckModel {
25
27
  }>;
26
28
  type TopicIdParams = typeof topicIdParams.static;
27
29
  interface DeckListFilters extends Pagination, Sort, Search {
30
+ topicIds?: string[];
28
31
  subjects?: Subject[];
29
32
  free?: boolean;
30
- ownerEntityId?: string;
33
+ ownerId?: string;
31
34
  }
32
35
  }
@@ -1,7 +1,8 @@
1
- import { type IDeck, type IDeckDetail } from '@vestcards/shared';
1
+ import type { IDeck, IDeckDetail, IOwnerInfo } from '@vestcards/shared';
2
2
  import { type Paginated } from '../../utils/api';
3
- import type { DeckModel } from './model';
3
+ import { DeckModel } from './model';
4
4
  export declare abstract class DeckService {
5
- static getAllDecks(filters: DeckModel.DeckListFilters): Promise<Paginated<IDeck>>;
5
+ static getAllDecks(filters: DeckModel.DeckListFilters, loggedUserId?: string): Promise<Paginated<IDeck>>;
6
6
  static getDeck(deckId: string): Promise<IDeckDetail>;
7
+ static getOwnerInfoById(ownerId: string): Promise<IOwnerInfo>;
7
8
  }
@@ -146,3 +146,14 @@ export declare function deleteUserDeckStudy(userDeckStudyId: string): Promise<vo
146
146
  * Delete a card report (card demand)
147
147
  */
148
148
  export declare function deleteCardReport(userId: string, cardId: string): Promise<void>;
149
+ /**
150
+ * Create an official entity with an associated user
151
+ */
152
+ export declare function createOfficialEntity(): Promise<{
153
+ entityId: `${string}-${string}-${string}-${string}-${string}`;
154
+ userId: `${string}-${string}-${string}-${string}-${string}`;
155
+ }>;
156
+ /**
157
+ * Delete an official entity (user deleted via cascade on entity)
158
+ */
159
+ export declare function deleteOfficialEntity(entityId: string): Promise<void>;
@@ -7,3 +7,4 @@ import type { DateValue } from './types';
7
7
  * → "09:00 GMT-03:00"
8
8
  */
9
9
  export declare function formatDateTZ(date: DateValue, pattern: string, timezone?: string): string;
10
+ export declare const formatRelativeReviewDate: (date: Date) => string;
@@ -1,6 +1 @@
1
- export * from './types/deck';
2
- export * from './types/fsrs';
3
- export * from './types/study';
4
- export * from './types/subject';
5
- export * from './types/topic';
6
- export * from './types/user';
1
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ export * from './deck';
2
+ export * from './fsrs';
3
+ export * from './study';
4
+ export * from './subject';
5
+ export * from './topic';
6
+ export * from './user';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestcards/server-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {