@peerbit/document-interface 1.0.0-1d1274c

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.
@@ -0,0 +1,3 @@
1
+ export * from "./query.js";
2
+ export * from "./store.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./query.js";
2
+ export * from "./store.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type AbstractType } from "@dao-xyz/borsh";
2
+ export declare abstract class Result {
3
+ }
4
+ export declare class Context {
5
+ created: bigint;
6
+ modified: bigint;
7
+ head: string;
8
+ gid: string;
9
+ size: number;
10
+ constructor(properties: {
11
+ created: bigint;
12
+ modified: bigint;
13
+ head: string;
14
+ gid: string;
15
+ size: number;
16
+ });
17
+ }
18
+ export declare class ResultWithSource<T> extends Result {
19
+ _source: Uint8Array;
20
+ context: Context;
21
+ _type: AbstractType<T>;
22
+ constructor(opts: {
23
+ source: Uint8Array;
24
+ context: Context;
25
+ value?: T;
26
+ indexed?: Record<string, any>;
27
+ });
28
+ init(type: AbstractType<T>): void;
29
+ _value?: T;
30
+ get value(): T;
31
+ indexed?: Record<string, any>;
32
+ }
33
+ export declare abstract class AbstractSearchResult<T> {
34
+ }
35
+ export declare class Results<T> extends AbstractSearchResult<T> {
36
+ results: ResultWithSource<T>[];
37
+ kept: bigint;
38
+ constructor(properties: {
39
+ results: ResultWithSource<T>[];
40
+ kept: bigint;
41
+ });
42
+ }
43
+ export declare class NoAccess extends AbstractSearchResult<any> {
44
+ }
45
+ /**
46
+ * Find logs that can be decrypted by certain keys
47
+ */
48
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EAKjB,MAAM,gBAAgB,CAAC;AAIxB,8BAAsB,MAAM;CAAG;AAE/B,qBACa,OAAO;IAEnB,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC;IAGjB,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,CAAC;IAGZ,IAAI,EAAE,MAAM,CAAC;gBAED,UAAU,EAAE;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACb;CAOD;AAED,qBACa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,MAAM;IAE9C,OAAO,EAAE,UAAU,CAAC;IAGpB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;gBACX,IAAI,EAAE;QACjB,MAAM,EAAE,UAAU,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B;IAQD,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAI1B,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,IAAI,KAAK,IAAI,CAAC,CASb;IAGD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAGD,8BAAsB,oBAAoB,CAAC,CAAC;CAAI;AAEhD,qBACa,OAAO,CAAC,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAEtD,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAG/B,IAAI,EAAE,MAAM,CAAC;gBAED,UAAU,EAAE;QAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;CAKxE;AAED,qBACa,QAAS,SAAQ,oBAAoB,CAAC,GAAG,CAAC;CAAG;AAK1D;;GAEG"}
@@ -0,0 +1,187 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { deserialize, field, variant, vec, } from "@dao-xyz/borsh";
11
+ /// ----- RESULTS -----
12
+ export class Result {
13
+ }
14
+ let Context = class Context {
15
+ created;
16
+ modified;
17
+ head;
18
+ gid;
19
+ size; // bytes
20
+ constructor(properties) {
21
+ this.created = properties.created;
22
+ this.modified = properties.modified;
23
+ this.head = properties.head;
24
+ this.gid = properties.gid;
25
+ this.size = properties.size;
26
+ }
27
+ };
28
+ __decorate([
29
+ field({ type: "u64" }),
30
+ __metadata("design:type", BigInt)
31
+ ], Context.prototype, "created", void 0);
32
+ __decorate([
33
+ field({ type: "u64" }),
34
+ __metadata("design:type", BigInt)
35
+ ], Context.prototype, "modified", void 0);
36
+ __decorate([
37
+ field({ type: "string" }),
38
+ __metadata("design:type", String)
39
+ ], Context.prototype, "head", void 0);
40
+ __decorate([
41
+ field({ type: "string" }),
42
+ __metadata("design:type", String)
43
+ ], Context.prototype, "gid", void 0);
44
+ __decorate([
45
+ field({ type: "u32" }),
46
+ __metadata("design:type", Number)
47
+ ], Context.prototype, "size", void 0);
48
+ Context = __decorate([
49
+ variant(0),
50
+ __metadata("design:paramtypes", [Object])
51
+ ], Context);
52
+ export { Context };
53
+ let ResultWithSource = class ResultWithSource extends Result {
54
+ _source;
55
+ context;
56
+ _type;
57
+ constructor(opts) {
58
+ super();
59
+ this._source = opts.source;
60
+ this.context = opts.context;
61
+ this._value = opts.value;
62
+ this.indexed = opts.indexed;
63
+ }
64
+ init(type) {
65
+ this._type = type;
66
+ }
67
+ _value;
68
+ get value() {
69
+ if (this._value) {
70
+ return this._value;
71
+ }
72
+ if (!this._source) {
73
+ throw new Error("Missing source binary");
74
+ }
75
+ this._value = deserialize(this._source, this._type);
76
+ return this._value;
77
+ }
78
+ // we never send this over the wire since we can always reconstruct it from value
79
+ indexed;
80
+ };
81
+ __decorate([
82
+ field({ type: Uint8Array }),
83
+ __metadata("design:type", Uint8Array)
84
+ ], ResultWithSource.prototype, "_source", void 0);
85
+ __decorate([
86
+ field({ type: Context }),
87
+ __metadata("design:type", Context)
88
+ ], ResultWithSource.prototype, "context", void 0);
89
+ ResultWithSource = __decorate([
90
+ variant(0),
91
+ __metadata("design:paramtypes", [Object])
92
+ ], ResultWithSource);
93
+ export { ResultWithSource };
94
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
95
+ export class AbstractSearchResult {
96
+ }
97
+ let Results = class Results extends AbstractSearchResult {
98
+ results;
99
+ kept; // how many results that were not sent, but can be collected later
100
+ constructor(properties) {
101
+ super();
102
+ this.kept = properties.kept;
103
+ this.results = properties.results;
104
+ }
105
+ };
106
+ __decorate([
107
+ field({ type: vec(ResultWithSource) }),
108
+ __metadata("design:type", Array)
109
+ ], Results.prototype, "results", void 0);
110
+ __decorate([
111
+ field({ type: "u64" }),
112
+ __metadata("design:type", BigInt)
113
+ ], Results.prototype, "kept", void 0);
114
+ Results = __decorate([
115
+ variant(0),
116
+ __metadata("design:paramtypes", [Object])
117
+ ], Results);
118
+ export { Results };
119
+ let NoAccess = class NoAccess extends AbstractSearchResult {
120
+ };
121
+ NoAccess = __decorate([
122
+ variant(1)
123
+ ], NoAccess);
124
+ export { NoAccess };
125
+ /* @variant(5)
126
+ export class LogQuery extends Query { } */
127
+ /**
128
+ * Find logs that can be decrypted by certain keys
129
+ */
130
+ /*
131
+ @variant(0)
132
+ export class EntryEncryptedByQuery
133
+ extends LogQuery
134
+ implements
135
+ EntryEncryptionTemplate<
136
+ X25519PublicKey[],
137
+ X25519PublicKey[],
138
+ X25519PublicKey[],
139
+ X25519PublicKey[]
140
+ >
141
+ {
142
+ @field({ type: vec(X25519PublicKey) })
143
+ meta: X25519PublicKey[];
144
+
145
+ @field({ type: vec(X25519PublicKey) })
146
+ payload: X25519PublicKey[];
147
+
148
+ @field({ type: vec(X25519PublicKey) })
149
+ next: X25519PublicKey[];
150
+
151
+ @field({ type: vec(X25519PublicKey) })
152
+ signatures: X25519PublicKey[];
153
+
154
+ constructor(properties?: {
155
+ meta: X25519PublicKey[];
156
+ next: X25519PublicKey[];
157
+ payload: X25519PublicKey[];
158
+ signatures: X25519PublicKey[];
159
+ }) {
160
+ super();
161
+ if (properties) {
162
+ this.metadata = properties.metadata;
163
+ this.payload = properties.payload;
164
+ this.next = properties.next;
165
+ this.signatures = properties.signatures;
166
+ }
167
+ }
168
+ }
169
+
170
+ @variant(1)
171
+ export class SignedByQuery extends LogQuery {
172
+ @field({ type: vec(PublicSignKey) })
173
+ _publicKeys: PublicSignKey[];
174
+
175
+ constructor(properties: { publicKeys: PublicSignKey[] }) {
176
+ super();
177
+ if (properties) {
178
+ this._publicKeys = properties.publicKeys;
179
+ }
180
+ }
181
+
182
+ get publicKeys() {
183
+ return this._publicKeys;
184
+ }
185
+ }
186
+ */
187
+ //# sourceMappingUR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C5B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACnC,CAAC;CACD,CAAA;AAVA;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;;wCACR;AAG/B;IADC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;qCACV;AALD,OAAO;IADnB,OAAO,CAAC,CAAC,CAAC;;GACE,OAAO,CAYnB;;AAGM,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,oBAAyB;CAAG,CAAA;AAA7C,QAAQ;IADpB,OAAO,CAAC,CAAC,CAAC;GACE,QAAQ,CAAqC;;AAE1D;0CAC0C;AAE1C;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG"}
@@ -0,0 +1,6 @@
1
+ export type IDocumentStore<T> = {
2
+ index: {
3
+ search: (query: any) => Promise<T[]>;
4
+ };
5
+ };
6
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC/B,KAAK,EAAE;QAAE,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;KAAE,CAAC;CAChD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@peerbit/document-interface",
3
+ "version": "1.0.0-1d1274c",
4
+ "description": "Document store interface",
5
+ "sideEffects": false,
6
+ "type": "module",
7
+ "types": "./dist/src/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "*": [
11
+ "*",
12
+ "dist/*",
13
+ "dist/src/*",
14
+ "dist/src/*/index"
15
+ ],
16
+ "src/*": [
17
+ "*",
18
+ "dist/*",
19
+ "dist/src/*",
20
+ "dist/src/*/index"
21
+ ]
22
+ }
23
+ },
24
+ "files": [
25
+ "src",
26
+ "dist",
27
+ "!dist/e2e",
28
+ "!dist/test",
29
+ "!**/*.tsbuildinfo"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/src/index.d.ts",
34
+ "import": "./dist/src/index.js"
35
+ }
36
+ },
37
+ "eslintConfig": {
38
+ "extends": "peerbit",
39
+ "parserOptions": {
40
+ "project": true,
41
+ "sourceType": "module"
42
+ },
43
+ "ignorePatterns": [
44
+ "!.aegir.js",
45
+ "test/ts-use",
46
+ "*.d.ts"
47
+ ]
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "clean": "aegir clean",
54
+ "build": "aegir build --no-bundle",
55
+ "test": "",
56
+ "lint": "aegir lint"
57
+ },
58
+ "author": "dao.xyz",
59
+ "license": "MIT",
60
+ "dependencies": {
61
+ "@dao-xyz/borsh": "^5.2.3",
62
+ "@peerbit/crypto": "2.3.0-1d1274c",
63
+ "@peerbit/indexer-interface": "1.0.0-1d1274c"
64
+ }
65
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./query.js";
2
+ export * from "./store.js";
package/src/query.ts ADDED
@@ -0,0 +1,170 @@
1
+ import {
2
+ type AbstractType,
3
+ deserialize,
4
+ field,
5
+ variant,
6
+ vec,
7
+ } from "@dao-xyz/borsh";
8
+
9
+ /// ----- RESULTS -----
10
+
11
+ export abstract class Result {}
12
+
13
+ @variant(0)
14
+ export class Context {
15
+ @field({ type: "u64" })
16
+ created: bigint;
17
+
18
+ @field({ type: "u64" })
19
+ modified: bigint;
20
+
21
+ @field({ type: "string" })
22
+ head: string;
23
+
24
+ @field({ type: "string" })
25
+ gid: string;
26
+
27
+ @field({ type: "u32" })
28
+ size: number; // bytes
29
+
30
+ constructor(properties: {
31
+ created: bigint;
32
+ modified: bigint;
33
+ head: string;
34
+ gid: string;
35
+ size: number;
36
+ }) {
37
+ this.created = properties.created;
38
+ this.modified = properties.modified;
39
+ this.head = properties.head;
40
+ this.gid = properties.gid;
41
+ this.size = properties.size;
42
+ }
43
+ }
44
+
45
+ @variant(0)
46
+ export class ResultWithSource<T> extends Result {
47
+ @field({ type: Uint8Array })
48
+ _source: Uint8Array;
49
+
50
+ @field({ type: Context })
51
+ context: Context;
52
+
53
+ _type: AbstractType<T>;
54
+ constructor(opts: {
55
+ source: Uint8Array;
56
+ context: Context;
57
+ value?: T;
58
+ indexed?: Record<string, any>;
59
+ }) {
60
+ super();
61
+ this._source = opts.source;
62
+ this.context = opts.context;
63
+ this._value = opts.value;
64
+ this.indexed = opts.indexed;
65
+ }
66
+
67
+ init(type: AbstractType<T>) {
68
+ this._type = type;
69
+ }
70
+
71
+ _value?: T;
72
+ get value(): T {
73
+ if (this._value) {
74
+ return this._value;
75
+ }
76
+ if (!this._source) {
77
+ throw new Error("Missing source binary");
78
+ }
79
+ this._value = deserialize(this._source, this._type);
80
+ return this._value;
81
+ }
82
+
83
+ // we never send this over the wire since we can always reconstruct it from value
84
+ indexed?: Record<string, any>;
85
+ }
86
+
87
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
88
+ export abstract class AbstractSearchResult<T> {}
89
+
90
+ @variant(0)
91
+ export class Results<T> extends AbstractSearchResult<T> {
92
+ @field({ type: vec(ResultWithSource) })
93
+ results: ResultWithSource<T>[];
94
+
95
+ @field({ type: "u64" })
96
+ kept: bigint; // how many results that were not sent, but can be collected later
97
+
98
+ constructor(properties: { results: ResultWithSource<T>[]; kept: bigint }) {
99
+ super();
100
+ this.kept = properties.kept;
101
+ this.results = properties.results;
102
+ }
103
+ }
104
+
105
+ @variant(1)
106
+ export class NoAccess extends AbstractSearchResult<any> {}
107
+
108
+ /* @variant(5)
109
+ export class LogQuery extends Query { } */
110
+
111
+ /**
112
+ * Find logs that can be decrypted by certain keys
113
+ */
114
+ /*
115
+ @variant(0)
116
+ export class EntryEncryptedByQuery
117
+ extends LogQuery
118
+ implements
119
+ EntryEncryptionTemplate<
120
+ X25519PublicKey[],
121
+ X25519PublicKey[],
122
+ X25519PublicKey[],
123
+ X25519PublicKey[]
124
+ >
125
+ {
126
+ @field({ type: vec(X25519PublicKey) })
127
+ meta: X25519PublicKey[];
128
+
129
+ @field({ type: vec(X25519PublicKey) })
130
+ payload: X25519PublicKey[];
131
+
132
+ @field({ type: vec(X25519PublicKey) })
133
+ next: X25519PublicKey[];
134
+
135
+ @field({ type: vec(X25519PublicKey) })
136
+ signatures: X25519PublicKey[];
137
+
138
+ constructor(properties?: {
139
+ meta: X25519PublicKey[];
140
+ next: X25519PublicKey[];
141
+ payload: X25519PublicKey[];
142
+ signatures: X25519PublicKey[];
143
+ }) {
144
+ super();
145
+ if (properties) {
146
+ this.metadata = properties.metadata;
147
+ this.payload = properties.payload;
148
+ this.next = properties.next;
149
+ this.signatures = properties.signatures;
150
+ }
151
+ }
152
+ }
153
+
154
+ @variant(1)
155
+ export class SignedByQuery extends LogQuery {
156
+ @field({ type: vec(PublicSignKey) })
157
+ _publicKeys: PublicSignKey[];
158
+
159
+ constructor(properties: { publicKeys: PublicSignKey[] }) {
160
+ super();
161
+ if (properties) {
162
+ this._publicKeys = properties.publicKeys;
163
+ }
164
+ }
165
+
166
+ get publicKeys() {
167
+ return this._publicKeys;
168
+ }
169
+ }
170
+ */
package/src/store.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type IDocumentStore<T> = {
2
+ index: { search: (query: any) => Promise<T[]> };
3
+ };