@arcote.tech/arc 0.0.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/index.d.ts +6 -0
- package/dist/index.js +11082 -0
- package/dist/utils.d.ts +59 -0
- package/package.json +34 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ArcCollectionAny, ArcIndexedCollectionAny } from "./collection/collection";
|
|
2
|
+
import type { QueryCollectionResult } from "./collection/queries/abstract-many-items";
|
|
3
|
+
import type { ArcElement } from "./elements/element";
|
|
4
|
+
export declare namespace objectUtil {
|
|
5
|
+
export type MergeShapes<U, V> = {
|
|
6
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
7
|
+
} & V;
|
|
8
|
+
type optionalKeys<T extends object> = {
|
|
9
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
10
|
+
}[keyof T];
|
|
11
|
+
type requiredKeys<T extends object> = {
|
|
12
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
13
|
+
}[keyof T];
|
|
14
|
+
export type addQuestionMarks<T extends object> = simplify<{
|
|
15
|
+
[K in requiredKeys<T>]: T[K];
|
|
16
|
+
} & {
|
|
17
|
+
[K in optionalKeys<T>]?: T[K];
|
|
18
|
+
} & {
|
|
19
|
+
[k in keyof T]?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export type identity<T> = T;
|
|
22
|
+
export type flatten<T> = identity<{
|
|
23
|
+
[k in keyof T]: T[k];
|
|
24
|
+
}>;
|
|
25
|
+
export type noNeverKeys<T> = {
|
|
26
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
27
|
+
}[keyof T];
|
|
28
|
+
export type noNever<T> = identity<{
|
|
29
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
30
|
+
}>;
|
|
31
|
+
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
32
|
+
export type extendShape<A extends object, B extends object> = {
|
|
33
|
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
34
|
+
} & {
|
|
35
|
+
[K in keyof B]: B[K];
|
|
36
|
+
};
|
|
37
|
+
export type simplify<T> = {
|
|
38
|
+
[KeyType in keyof T]: T[KeyType];
|
|
39
|
+
} & {};
|
|
40
|
+
export {};
|
|
41
|
+
}
|
|
42
|
+
export declare namespace util {
|
|
43
|
+
type FirstArgument<T> = T extends (arg: infer U, ...args: any[]) => any ? U : never;
|
|
44
|
+
type GetType<Element extends ArcElement> = ReturnType<Element["deserialize"]>;
|
|
45
|
+
type CollectionItemWithId<C extends ArcCollectionAny> = ReturnType<C["deserialize"]>;
|
|
46
|
+
}
|
|
47
|
+
export type ContextTypes<Ctx extends {
|
|
48
|
+
collections: any;
|
|
49
|
+
}> = Ctx["collections"] extends (ArcCollectionAny | ArcIndexedCollectionAny)[] ? {
|
|
50
|
+
[Collection in Ctx["collections"][number] as `${Collection["name"]}.bodyWithoutId`]: util.GetType<Collection["schema"]>;
|
|
51
|
+
} & {
|
|
52
|
+
[Collection in Ctx["collections"][number] as `${Collection["name"]}.setBody`]: util.FirstArgument<Collection["schema"]["parse"]>;
|
|
53
|
+
} & {
|
|
54
|
+
[Collection in Ctx["collections"][number] as `${Collection["name"]}.id`]: util.GetType<Collection["id"]>;
|
|
55
|
+
} & {
|
|
56
|
+
[Collection in Ctx["collections"][number] as `${Collection["name"]}.body`]: util.CollectionItemWithId<Collection>;
|
|
57
|
+
} & {
|
|
58
|
+
[Collection in Ctx["collections"][number] as `${Collection["name"]}.queryCollectionResult`]: QueryCollectionResult<Collection>;
|
|
59
|
+
} : never;
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arcote.tech/arc",
|
|
3
|
+
"module": "index.ts",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"version": "0.0.1",
|
|
8
|
+
"private": false,
|
|
9
|
+
"author": "Przemysław Krasiński [arcote.tech]",
|
|
10
|
+
"description": "Arc is a framework designed to align code closely with business logic, streamlining development and enhancing productivity.",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "bun build --target=node ./index.ts --outfile=dist/index.js && bun run build:declaration",
|
|
13
|
+
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json",
|
|
14
|
+
"postbuild": "rimraf tsconfig.types.tsbuildinfo",
|
|
15
|
+
"type-check": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"mutative": "^1.0.6",
|
|
19
|
+
"rxjs": "^7.8.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/bun": "latest",
|
|
23
|
+
"prettier": "^3.0.3",
|
|
24
|
+
"rimraf": "^5.0.5",
|
|
25
|
+
"typescript": "^5.2.2"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"typescript": "^5.0.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/*.js",
|
|
32
|
+
"dist/*.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|