@arcote.tech/arc 0.0.8 → 0.0.10
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/collection/collection.d.ts +2 -2
- package/dist/elements/array.d.ts +3 -2
- package/dist/elements/index.d.ts +1 -0
- package/dist/index.js +31 -22
- package/dist/model/model.d.ts +1 -1
- package/dist/utils.d.ts +3 -0
- package/package.json +6 -4
|
@@ -31,8 +31,8 @@ declare class ArcCollection<Name extends string, Id extends ArcIdAny, Schema ext
|
|
|
31
31
|
commandContext(transaction: ReadTransaction, changes: CollectionChange[], getDraft: GetDraft<any>): {
|
|
32
32
|
one: (id: util.GetType<Id>) => Deserialize<Id, Schema>;
|
|
33
33
|
remove: (id: util.GetType<Id>) => Promise<any>;
|
|
34
|
-
add: (data: util.FirstArgument<Schema["
|
|
35
|
-
set: (id: util.GetType<Id>, data: util.FirstArgument<Schema["
|
|
34
|
+
add: (data: objectUtil.addQuestionMarks<util.FirstArgument<Schema["serialize"]>>) => Promise<any>;
|
|
35
|
+
set: (id: util.GetType<Id>, data: util.FirstArgument<Schema["serialize"]>) => Promise<any>;
|
|
36
36
|
};
|
|
37
37
|
applyChange(transaction: ReadWriteTransaction, change: CollectionChange, events: CollectionChange[]): Promise<void>;
|
|
38
38
|
indexBy<Indexes extends keyof ReturnType<Schema["deserialize"]>, const I extends {
|
package/dist/elements/array.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type util } from "../utils";
|
|
2
2
|
import { ArcAbstract } from "./abstract";
|
|
3
|
-
|
|
3
|
+
import type { ArcElement } from "./element";
|
|
4
|
+
export declare class ArcArray<E extends ArcElement> extends ArcAbstract {
|
|
4
5
|
private parent;
|
|
5
6
|
constructor(parent: E);
|
|
6
7
|
parse(value: util.FirstArgument<E["deserialize"]>[]): ReturnType<E["parse"]>[];
|
|
@@ -9,4 +10,4 @@ export declare class ArcArray<E extends ArcAbstract> extends ArcAbstract {
|
|
|
9
10
|
deserializePath(path: string[], value: any): any;
|
|
10
11
|
}
|
|
11
12
|
export type ArcArrayAny = ArcArray<any>;
|
|
12
|
-
export declare function array<E extends
|
|
13
|
+
export declare function array<E extends ArcElement>(element: E): ArcArray<E>;
|
package/dist/elements/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// collection/collection.ts
|
|
2
|
-
import {apply} from "mutative";
|
|
2
|
+
import { apply } from "mutative";
|
|
3
3
|
|
|
4
4
|
// collection/queries/abstract-collection-query.ts
|
|
5
|
-
import {BehaviorSubject, debounceTime, Subject} from "rxjs";
|
|
5
|
+
import { BehaviorSubject, debounceTime, Subject } from "rxjs";
|
|
6
6
|
|
|
7
7
|
class ArcCollectionQuery {
|
|
8
8
|
collection;
|
|
@@ -329,7 +329,7 @@ class ArcIndexedCollection extends ArcCollection {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
// context/context.ts
|
|
332
|
-
import {create} from "mutative";
|
|
332
|
+
import { create } from "mutative";
|
|
333
333
|
function context(...collections) {
|
|
334
334
|
return new ArcContext(collections);
|
|
335
335
|
}
|
|
@@ -540,7 +540,7 @@ class ArcObject extends ArcAbstract {
|
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
// elements/array.ts
|
|
543
|
-
function
|
|
543
|
+
function array(element) {
|
|
544
544
|
return new ArcArray(element);
|
|
545
545
|
}
|
|
546
546
|
|
|
@@ -569,6 +569,29 @@ class ArcArray extends ArcAbstract {
|
|
|
569
569
|
return this.parent.deserialize(value);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
+
// elements/abstract-primitive.ts
|
|
573
|
+
class ArcPrimitive extends ArcAbstract {
|
|
574
|
+
constructor() {
|
|
575
|
+
super();
|
|
576
|
+
}
|
|
577
|
+
serialize(value) {
|
|
578
|
+
return value;
|
|
579
|
+
}
|
|
580
|
+
parse(value) {
|
|
581
|
+
return value;
|
|
582
|
+
}
|
|
583
|
+
deserialize(value) {
|
|
584
|
+
return value;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// elements/boolean.ts
|
|
589
|
+
function boolean() {
|
|
590
|
+
return new ArcBoolean;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
class ArcBoolean extends ArcPrimitive {
|
|
594
|
+
}
|
|
572
595
|
// elements/date.ts
|
|
573
596
|
function date() {
|
|
574
597
|
return new ArcDate;
|
|
@@ -588,22 +611,6 @@ class ArcDate extends ArcAbstract {
|
|
|
588
611
|
return new Date(value);
|
|
589
612
|
}
|
|
590
613
|
}
|
|
591
|
-
// elements/abstract-primitive.ts
|
|
592
|
-
class ArcPrimitive extends ArcAbstract {
|
|
593
|
-
constructor() {
|
|
594
|
-
super();
|
|
595
|
-
}
|
|
596
|
-
serialize(value) {
|
|
597
|
-
return value;
|
|
598
|
-
}
|
|
599
|
-
parse(value) {
|
|
600
|
-
return value;
|
|
601
|
-
}
|
|
602
|
-
deserialize(value) {
|
|
603
|
-
return value;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
614
|
// elements/string.ts
|
|
608
615
|
function string() {
|
|
609
616
|
return new ArcString;
|
|
@@ -660,7 +667,7 @@ class ArcStringEnum extends ArcAbstract {
|
|
|
660
667
|
}
|
|
661
668
|
}
|
|
662
669
|
// model/model.ts
|
|
663
|
-
import {Subject as Subject2} from "rxjs";
|
|
670
|
+
import { Subject as Subject2 } from "rxjs";
|
|
664
671
|
function model(context3, dependencies) {
|
|
665
672
|
return new ArcModel(context3, dependencies.dbAdapterFactory, dependencies.rtcAdapterFactory);
|
|
666
673
|
}
|
|
@@ -865,7 +872,8 @@ export {
|
|
|
865
872
|
date,
|
|
866
873
|
context,
|
|
867
874
|
collection,
|
|
868
|
-
|
|
875
|
+
boolean,
|
|
876
|
+
array,
|
|
869
877
|
ArcStringEnum,
|
|
870
878
|
ArcString,
|
|
871
879
|
ArcOptional,
|
|
@@ -877,5 +885,6 @@ export {
|
|
|
877
885
|
ArcDate,
|
|
878
886
|
ArcCollectionQuery,
|
|
879
887
|
ArcBranded,
|
|
888
|
+
ArcBoolean,
|
|
880
889
|
ArcArray
|
|
881
890
|
};
|
package/dist/model/model.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { ArcQuery } from "../context/query";
|
|
|
8
8
|
import type { QueryFactoryFunction } from "./query-builder";
|
|
9
9
|
import type { RealTimeCommunicationAdapterFactory } from "./rtc";
|
|
10
10
|
export declare class ArcModel<C extends ArcContextWithCommandsAny> {
|
|
11
|
-
|
|
11
|
+
readonly context: C;
|
|
12
12
|
private rtc;
|
|
13
13
|
private dbAdapterPromise;
|
|
14
14
|
changes$: Subject<CollectionChange>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -57,3 +57,6 @@ export type ContextTypes<Ctx extends {
|
|
|
57
57
|
} & {
|
|
58
58
|
[Collection in Ctx["collections"][number] as `${Collection["name"]}.queryCollectionResult`]: Omit<QueryCollectionResult<Collection>, "result">;
|
|
59
59
|
} : never;
|
|
60
|
+
export type infer<E extends {
|
|
61
|
+
deserialize: (...args: any) => any;
|
|
62
|
+
}> = ReturnType<E["deserialize"]>;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.10",
|
|
8
8
|
"private": false,
|
|
9
9
|
"author": "Przemysław Krasiński [arcote.tech]",
|
|
10
10
|
"description": "Arc is a framework designed to align code closely with business logic, streamlining development and enhancing productivity.",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json",
|
|
14
14
|
"postbuild": "rimraf tsconfig.types.tsbuildinfo",
|
|
15
15
|
"type-check": "tsc",
|
|
16
|
-
"publish": "bun run build && npm publish --access=public"
|
|
16
|
+
"publish": "bun run build && npm publish --access=public",
|
|
17
|
+
"dev": "nodemon --ignore dist -e ts,tsx --exec 'bun run build'"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"mutative": "^1.0.6",
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
"@types/bun": "latest",
|
|
24
25
|
"prettier": "^3.0.3",
|
|
25
26
|
"rimraf": "^5.0.5",
|
|
26
|
-
"typescript": "^5.2.2"
|
|
27
|
+
"typescript": "^5.2.2",
|
|
28
|
+
"nodemon": "^2.0.22"
|
|
27
29
|
},
|
|
28
30
|
"peerDependencies": {
|
|
29
31
|
"typescript": "^5.0.0"
|
|
@@ -32,4 +34,4 @@
|
|
|
32
34
|
"dist/**/*.js",
|
|
33
35
|
"dist/**/*.d.ts"
|
|
34
36
|
]
|
|
35
|
-
}
|
|
37
|
+
}
|