oksy 0.1.25 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- package/boot.js +20 -20
- package/library.js +1 -1
- package/package.json +1 -1
- package/public/assets/{index.34463231.js → index.5b3ce61c.js} +10 -10
- package/public/assets/{index.45dac613.js → index.a7675a50.js} +10 -10
- package/public/index.html +1 -1
- package/types/src/Bootstrap/TsFilesToBlueprint/BaseFields.d.ts +9 -0
- package/types/src/Bootstrap/TsFilesToBlueprint/Blueprint.d.ts +4 -1
- package/types/src/Helper/Sort.d.ts +1 -1
- package/types/src/ReactiveStore/BaseEntity.d.ts +8 -6
- package/types/src/ReactiveStore/Many.d.ts +5 -4
- package/types/src/ReactiveStore/ReactiveStore.d.ts +1 -1
- package/types/src/library.d.ts +2 -2
- package/types/src/library.pub.d.ts +9 -9
package/public/index.html
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
height: 100% !important;
|
23
23
|
}
|
24
24
|
</style>
|
25
|
-
<script type="module" crossorigin src="/assets/index.
|
25
|
+
<script type="module" crossorigin src="/assets/index.a7675a50.js"></script>
|
26
26
|
<link rel="stylesheet" href="/assets/index.ef68285e.css">
|
27
27
|
</head>
|
28
28
|
<body class="tw-flex tw-flex-col tw-bg-gray-50">
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { BlueprintFieldMany, BlueprintFieldOne, BlueprintFieldSingle } from './Blueprint';
|
2
|
+
type Field = (BlueprintFieldSingle | BlueprintFieldOne | BlueprintFieldMany);
|
3
|
+
export declare const getGlobalEntityFields: () => Field[];
|
4
|
+
export declare const getBaseEntityFields: () => Field[];
|
5
|
+
export declare const getBaseFileFields: () => Field[];
|
6
|
+
export declare const getBaseUserFields: () => Field[];
|
7
|
+
export declare const getBaseWorkspaceFields: () => Field[];
|
8
|
+
export declare const getBaseMembershipFields: () => Field[];
|
9
|
+
export {};
|
@@ -12,6 +12,7 @@ export type BlueprintFieldOne = {
|
|
12
12
|
backrefName: string;
|
13
13
|
backrefField: BlueprintFieldOne | BlueprintFieldMany;
|
14
14
|
backrefBlueprint: Blueprint;
|
15
|
+
draft: boolean;
|
15
16
|
lineNumber: null | number;
|
16
17
|
nullable: boolean;
|
17
18
|
cascade: 'DELETE' | 'SET NULL';
|
@@ -29,10 +30,12 @@ export type BlueprintFieldMany = {
|
|
29
30
|
};
|
30
31
|
export declare class Blueprint {
|
31
32
|
className: string;
|
32
|
-
|
33
|
+
extendsClass: string;
|
33
34
|
filePath: null | string;
|
34
35
|
fileContent: null | string;
|
36
|
+
extendsClasses: string[];
|
35
37
|
fields: (BlueprintFieldSingle | BlueprintFieldOne | BlueprintFieldMany)[];
|
38
|
+
constructor(className: string, extendsClass: string, filePath?: null | string, fileContent?: null | string);
|
36
39
|
getAllOneFields(): BlueprintFieldOne[];
|
37
40
|
getAllSingleFields(): BlueprintFieldSingle[];
|
38
41
|
getAllManyFields(): BlueprintFieldMany[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Many, GlobalEntity } from 'oksy';
|
2
2
|
import { Draft } from 'src/ReactiveStore/BaseEntity';
|
3
3
|
type ValueFields<T1> = {
|
4
|
-
[K in keyof T1]: T1[K] extends GlobalEntity ? never : (T1[K] extends Many
|
4
|
+
[K in keyof T1]: T1[K] extends GlobalEntity ? never : (T1[K] extends Many ? never : K);
|
5
5
|
}[keyof T1];
|
6
6
|
type EntityArray = Array<Draft<GlobalEntity>>;
|
7
7
|
export declare function sort<T extends EntityArray>(items: T, key: ValueFields<T[number]>, order?: 'ASC' | 'DESC'): T;
|
@@ -4,16 +4,19 @@ import { Database } from 'oksy';
|
|
4
4
|
import { Many } from 'oksy';
|
5
5
|
import { EmailValidator } from '../ReactiveStore/Validators/EmailValidator';
|
6
6
|
import { IValidator } from './Validators/IValidator';
|
7
|
-
export type Draft<T> = {
|
8
|
-
[P in keyof T]: T[P] extends Function ? T[P] : (P extends 'id' | 'workspaceId' ? T[P] : null | T[P]);
|
7
|
+
export type Draft<T extends GlobalEntity> = {
|
8
|
+
[P in keyof T]: (T[P] extends Function ? T[P] : (T[P] extends Many ? T[P] : (P extends 'id' | 'workspaceId' | 'isValid' | 'createdAt' | 'updatedAt' ? T[P] : (null | T[P]))));
|
9
9
|
};
|
10
|
-
type
|
11
|
-
|
10
|
+
export type UnDraft<T extends Draft<any>> = T extends Draft<infer U> ? U : never;
|
11
|
+
export type RelationFields<T1> = {
|
12
|
+
[K in keyof T1]: T1[K] extends (null | GlobalEntity | Draft<GlobalEntity>) ? K : (T1[K] extends Many ? K : never);
|
12
13
|
}[keyof T1];
|
13
|
-
export type One<T1 extends GlobalEntity, T2 extends
|
14
|
+
export type One<T1 extends (GlobalEntity | Draft<GlobalEntity>), T2 extends RelationFields<UnDraft<T1>>, T3 extends BlueprintFieldOne['cascade'] = 'DELETE'> = T1;
|
15
|
+
export declare function isValid<T extends Draft<any>>(model: T): model is UnDraft<T>;
|
14
16
|
export declare abstract class GlobalEntity {
|
15
17
|
id: string;
|
16
18
|
isValid: boolean;
|
19
|
+
isBeingDeleted: boolean;
|
17
20
|
createdAt: Dayjs;
|
18
21
|
updatedAt: Dayjs;
|
19
22
|
validators(): {
|
@@ -51,4 +54,3 @@ export declare abstract class BaseFile extends Entity {
|
|
51
54
|
size: number;
|
52
55
|
type: string;
|
53
56
|
}
|
54
|
-
export {};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { SqliteClient } from './../Bootstrap/SqliteClient';
|
2
2
|
import { Blueprint, BlueprintFieldMany } from './../Bootstrap/TsFilesToBlueprint/Blueprint';
|
3
|
-
import { Draft, GlobalEntity } from './BaseEntity';
|
3
|
+
import { Draft, GlobalEntity, RelationFields, UnDraft } from './BaseEntity';
|
4
4
|
import { Storage } from './ReactiveStore';
|
5
|
-
export declare class Many<T1 extends GlobalEntity = any, T2 extends
|
5
|
+
export declare class Many<T1 extends GlobalEntity = any, T2 extends RelationFields<UnDraft<T1>> = any> {
|
6
6
|
private sqliteClient;
|
7
7
|
private model;
|
8
8
|
private blueprint;
|
@@ -17,7 +17,8 @@ export declare class Many<T1 extends GlobalEntity = any, T2 extends keyof T1 = a
|
|
17
17
|
size(): number;
|
18
18
|
removeId(idToRemove: string): void;
|
19
19
|
addId(idToAdd: string): void;
|
20
|
-
|
21
|
-
|
20
|
+
addDraft(modelToAdd: null | undefined | T1 | Draft<T1>): void;
|
21
|
+
add(modelToAdd: null | undefined | T1): void;
|
22
|
+
remove(modelToRemove: null | undefined | T1 | Draft<T1>): void;
|
22
23
|
private getManyToManyRow;
|
23
24
|
}
|
@@ -40,7 +40,7 @@ export declare class Database implements Storage {
|
|
40
40
|
getById(tableName: string, id: undefined | null | string): null | any;
|
41
41
|
getAll(tableName: string): any[];
|
42
42
|
getAllWithDraft(tableName: string): any[];
|
43
|
-
create(moduleName: string):
|
43
|
+
create<T extends GlobalEntity = any>(moduleName: string): Draft<T>;
|
44
44
|
delete(model: null | Draft<InstanceType<typeof GlobalEntity>>): void;
|
45
45
|
}
|
46
46
|
declare class Table {
|
package/types/src/library.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BaseFile, BaseMembership, BaseUser, BaseWorkspace, Entity, One, GlobalEntity } from './ReactiveStore/BaseEntity';
|
1
|
+
import { BaseFile, BaseMembership, BaseUser, BaseWorkspace, Entity, One, GlobalEntity, isValid, Draft } from './ReactiveStore/BaseEntity';
|
2
2
|
import { Config } from './../types/config';
|
3
3
|
import { Many } from './ReactiveStore/Many';
|
4
4
|
import { Database } from './ReactiveStore/ReactiveStore';
|
@@ -8,4 +8,4 @@ import { hash } from './Helper/Hash';
|
|
8
8
|
import { googleIcons, type GoogleIconType } from './Frontend/GoogleIcons';
|
9
9
|
import { IValidator } from './ReactiveStore/Validators/IValidator';
|
10
10
|
import { sort } from './Helper/Sort';
|
11
|
-
export { Config, GlobalEntity, Entity, One, Many, BaseUser, BaseWorkspace, BaseMembership, BaseFile, BasePage, Database, seed, hash, googleIcons, GoogleIconType, IValidator, sort, };
|
11
|
+
export { Config, GlobalEntity, Entity, One, Many, BaseUser, BaseWorkspace, BaseMembership, BaseFile, BasePage, Database, seed, hash, googleIcons, GoogleIconType, IValidator, sort, isValid, Draft, };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BaseFile, BaseMembership, BaseUser, BaseWorkspace, Draft, Entity, One } from './ReactiveStore/BaseEntity';
|
1
|
+
import { BaseFile, BaseMembership, BaseUser, BaseWorkspace, Draft, Entity, isValid, One, UnDraft } from './ReactiveStore/BaseEntity';
|
2
2
|
import { Config } from './../types/config';
|
3
3
|
import { IValidator } from './ReactiveStore/Validators/IValidator';
|
4
4
|
import { UI } from './Frontend/View/UI';
|
@@ -14,15 +14,15 @@ declare abstract class GlobalEntity {
|
|
14
14
|
[key: string]: IValidator[];
|
15
15
|
};
|
16
16
|
}
|
17
|
-
type RelationFields<T1 extends GlobalEntity> = {
|
18
|
-
[K in keyof T1]: T1[K] extends GlobalEntity ? K : (T1[K] extends Many
|
17
|
+
export type RelationFields<T1 extends GlobalEntity> = {
|
18
|
+
[K in keyof T1]: T1[K] extends (null | GlobalEntity) ? K : (T1[K] extends Many ? K : never);
|
19
19
|
}[keyof T1];
|
20
|
-
declare class Many<T1 extends GlobalEntity = any, T2 extends RelationFields<T1
|
20
|
+
declare class Many<T1 extends GlobalEntity = any, T2 extends RelationFields<UnDraft<T1>> = any> {
|
21
21
|
all(): T1[];
|
22
|
-
allWithDraft(): Draft<T1
|
22
|
+
allWithDraft(): Draft<UnDraft<T1>>[];
|
23
23
|
size(): number;
|
24
|
-
add(
|
25
|
-
remove(
|
24
|
+
add(modelToAdd: null | undefined | T1): void;
|
25
|
+
remove(modelToRemove: null | undefined | T1): void;
|
26
26
|
}
|
27
27
|
declare abstract class BasePage {
|
28
28
|
URL: string;
|
@@ -50,7 +50,7 @@ declare class Database {
|
|
50
50
|
getById<T extends MODULE_KEY>(tableName: T, id: undefined | null | string): null | MODEL<T>;
|
51
51
|
getAll<T extends MODULE_KEY>(tableName: T): MODEL<T>[];
|
52
52
|
getAllWithDraft<T extends MODULE_KEY>(tableName: T): Draft<MODEL<T>>[];
|
53
|
-
create<T extends MODULE_KEY>(moduleName: T): MODEL<T
|
53
|
+
create<T extends MODULE_KEY>(moduleName: T): Draft<MODEL<T>>;
|
54
54
|
delete(model: any): void;
|
55
55
|
}
|
56
|
-
export { Config, GlobalEntity, Entity, One, Many, BaseUser, BaseWorkspace, BaseMembership, BaseFile, BasePage, Database, seed, hash, googleIcons, GoogleIconType, IValidator, sort, };
|
56
|
+
export { Config, GlobalEntity, Entity, One, Many, BaseUser, BaseWorkspace, BaseMembership, BaseFile, BasePage, Database, seed, hash, googleIcons, GoogleIconType, IValidator, sort, isValid, Draft, };
|