@deessejs/collections 0.0.3 → 0.0.4
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/collections/define.d.ts +2 -1
- package/dist/collections/define.js +3 -3
- package/dist/collections/types.d.ts +11 -0
- package/dist/collections/types.js +2 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +1 -1
- package/dist/config/types.d.ts +4 -0
- package/dist/config/types.js +2 -0
- package/dist/fields/field.d.ts +4 -1
- package/dist/fields/field.js +26 -2
- package/dist/fields/index.d.ts +1 -0
- package/dist/fields/index.js +1 -0
- package/dist/fields/types.d.ts +36 -0
- package/dist/fields/types.js +2 -0
- package/dist/utils/deep-partial.d.ts +3 -0
- package/dist/utils/deep-partial.js +2 -0
- package/package.json +62 -38
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Collection } from "./types";
|
|
2
|
+
export declare const collection: (config: Collection) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
exports.
|
|
3
|
+
exports.collection = void 0;
|
|
4
|
+
const collection = (config) => { };
|
|
5
|
+
exports.collection = collection;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Config } from "./types";
|
|
2
|
+
export declare const defineConfig: (config: Config) => void;
|
package/dist/config/index.js
CHANGED
package/dist/fields/field.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Field, FieldConfig, FieldTypeConfig, FieldTypeFinal } from "./types";
|
|
3
|
+
export declare const fieldType: <TParams extends z.ZodType>(config: FieldTypeConfig<TParams>) => (params: z.infer<TParams>) => FieldTypeFinal<TParams>;
|
|
4
|
+
export declare const field: <TType extends FieldTypeConfig>(config: FieldConfig<TType>) => Field<TType>;
|
package/dist/fields/field.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.field = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.field = exports.fieldType = void 0;
|
|
4
|
+
const fieldType = (config) => (params) => {
|
|
5
|
+
const validated = config.schema.parse(params);
|
|
6
|
+
return {
|
|
7
|
+
kind: config.dsl.kind,
|
|
8
|
+
params: validated,
|
|
9
|
+
dsl: config.dsl,
|
|
10
|
+
admin: config.admin,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.fieldType = fieldType;
|
|
14
|
+
const defaultPermissions = {
|
|
15
|
+
create: async () => true,
|
|
16
|
+
read: async () => true,
|
|
17
|
+
update: async () => true,
|
|
18
|
+
delete: async () => true,
|
|
19
|
+
};
|
|
20
|
+
const field = (config) => {
|
|
21
|
+
return {
|
|
22
|
+
type: config.type,
|
|
23
|
+
permissions: {
|
|
24
|
+
...defaultPermissions,
|
|
25
|
+
...config.permissions,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
5
29
|
exports.field = field;
|
package/dist/fields/index.d.ts
CHANGED
package/dist/fields/index.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export type FieldTypeConfig<TParams extends z.ZodType = z.ZodType> = {
|
|
3
|
+
schema: TParams;
|
|
4
|
+
dsl: {
|
|
5
|
+
kind: string;
|
|
6
|
+
config?: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
admin: {
|
|
9
|
+
component: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type FieldTypeFinal<TParams extends z.ZodType = z.ZodType> = {
|
|
13
|
+
kind: string;
|
|
14
|
+
params: z.infer<TParams>;
|
|
15
|
+
dsl: {
|
|
16
|
+
kind: string;
|
|
17
|
+
config?: Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
admin: {
|
|
20
|
+
component: any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type FieldPermissions = {
|
|
24
|
+
create: (ctx: any) => Promise<boolean>;
|
|
25
|
+
read: (ctx: any) => Promise<boolean>;
|
|
26
|
+
update: (ctx: any) => Promise<boolean>;
|
|
27
|
+
delete: (ctx: any) => Promise<boolean>;
|
|
28
|
+
};
|
|
29
|
+
export type FieldConfig<TType extends FieldTypeConfig> = {
|
|
30
|
+
type: TType;
|
|
31
|
+
permissions?: Partial<FieldPermissions>;
|
|
32
|
+
};
|
|
33
|
+
export type Field<TType extends FieldTypeConfig = FieldTypeConfig> = {
|
|
34
|
+
type: TType;
|
|
35
|
+
permissions: FieldPermissions;
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@deessejs/collections",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"module": "dist/index.esm.js",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.esm.js",
|
|
11
|
-
"require": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist/**/*",
|
|
17
|
-
"README.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"build:watch": "tsc --watch",
|
|
23
|
-
"prepublishOnly": "npm run build",
|
|
24
|
-
"
|
|
25
|
-
"lint": "eslint src --ext .ts",
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
},
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@deessejs/collections",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**/*",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"build:watch": "tsc --watch",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"lint": "eslint src --ext .ts",
|
|
25
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
26
|
+
"test": "vitest",
|
|
27
|
+
"test:ui": "vitest --ui",
|
|
28
|
+
"test:run": "vitest run",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"test:watch": "vitest watch"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/Developers-Secrets-Inc/collections.git"
|
|
35
|
+
},
|
|
36
|
+
"author": "",
|
|
37
|
+
"license": "ISC",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/Developers-Secrets-Inc/collections/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/Developers-Secrets-Inc/collections#readme",
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"zod": "^4.1.12",
|
|
44
|
+
"@testing-library/dom": "^10.4.1",
|
|
45
|
+
"@testing-library/user-event": "^14.6.1",
|
|
46
|
+
"@types/jsdom": "^27.0.0",
|
|
47
|
+
"@types/node": "^20.0.0",
|
|
48
|
+
"@types/sinon": "^21.0.0",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
50
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
51
|
+
"@vitest/coverage-v8": "^4.0.13",
|
|
52
|
+
"@vitest/ui": "^4.0.13",
|
|
53
|
+
"eslint": "^8.0.0",
|
|
54
|
+
"jsdom": "^27.2.0",
|
|
55
|
+
"sinon": "^21.0.0",
|
|
56
|
+
"typescript": "^5.0.0",
|
|
57
|
+
"vitest": "^4.0.13"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"zod": "^4.1.12"
|
|
61
|
+
}
|
|
62
|
+
}
|