@geoprotocol/grc-20 0.1.0
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/builder/edit.d.ts +107 -0
- package/dist/builder/edit.d.ts.map +1 -0
- package/dist/builder/edit.js +221 -0
- package/dist/builder/edit.js.map +1 -0
- package/dist/builder/entity.d.ts +62 -0
- package/dist/builder/entity.d.ts.map +1 -0
- package/dist/builder/entity.js +126 -0
- package/dist/builder/entity.js.map +1 -0
- package/dist/builder/index.d.ts +5 -0
- package/dist/builder/index.d.ts.map +1 -0
- package/dist/builder/index.js +5 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/relation.d.ts +66 -0
- package/dist/builder/relation.d.ts.map +1 -0
- package/dist/builder/relation.js +114 -0
- package/dist/builder/relation.js.map +1 -0
- package/dist/builder/update.d.ts +90 -0
- package/dist/builder/update.d.ts.map +1 -0
- package/dist/builder/update.js +174 -0
- package/dist/builder/update.js.map +1 -0
- package/dist/codec/edit.d.ts +17 -0
- package/dist/codec/edit.d.ts.map +1 -0
- package/dist/codec/edit.js +393 -0
- package/dist/codec/edit.js.map +1 -0
- package/dist/codec/index.d.ts +3 -0
- package/dist/codec/index.d.ts.map +1 -0
- package/dist/codec/index.js +3 -0
- package/dist/codec/index.js.map +1 -0
- package/dist/codec/op.d.ts +27 -0
- package/dist/codec/op.d.ts.map +1 -0
- package/dist/codec/op.js +333 -0
- package/dist/codec/op.js.map +1 -0
- package/dist/codec/primitives.d.ts +138 -0
- package/dist/codec/primitives.d.ts.map +1 -0
- package/dist/codec/primitives.js +285 -0
- package/dist/codec/primitives.js.map +1 -0
- package/dist/codec/value.d.ts +41 -0
- package/dist/codec/value.d.ts.map +1 -0
- package/dist/codec/value.js +202 -0
- package/dist/codec/value.js.map +1 -0
- package/dist/genesis/index.d.ts +109 -0
- package/dist/genesis/index.d.ts.map +1 -0
- package/dist/genesis/index.js +183 -0
- package/dist/genesis/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/test/basic.test.d.ts +2 -0
- package/dist/test/basic.test.d.ts.map +1 -0
- package/dist/test/basic.test.js +270 -0
- package/dist/test/basic.test.js.map +1 -0
- package/dist/types/edit.d.ts +46 -0
- package/dist/types/edit.d.ts.map +1 -0
- package/dist/types/edit.js +13 -0
- package/dist/types/edit.js.map +1 -0
- package/dist/types/id.d.ts +32 -0
- package/dist/types/id.d.ts.map +1 -0
- package/dist/types/id.js +45 -0
- package/dist/types/id.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/op.d.ts +147 -0
- package/dist/types/op.d.ts.map +1 -0
- package/dist/types/op.js +60 -0
- package/dist/types/op.js.map +1 -0
- package/dist/types/value.d.ts +107 -0
- package/dist/types/value.d.ts.map +1 -0
- package/dist/types/value.js +126 -0
- package/dist/types/value.js.map +1 -0
- package/dist/util/id.d.ts +51 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +215 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +2 -0
- package/dist/util/index.js.map +1 -0
- package/package.json +68 -0
- package/readme.md +232 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { Id } from "../types/id.js";
|
|
2
|
+
import type { Edit } from "../types/edit.js";
|
|
3
|
+
import type { CreateRelation, Op } from "../types/op.js";
|
|
4
|
+
import { DataType } from "../types/value.js";
|
|
5
|
+
import { EntityBuilder } from "./entity.js";
|
|
6
|
+
import { UpdateEntityBuilder } from "./update.js";
|
|
7
|
+
import { RelationBuilder } from "./relation.js";
|
|
8
|
+
/**
|
|
9
|
+
* Builder for constructing an Edit with operations.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EditBuilder {
|
|
12
|
+
private readonly _id;
|
|
13
|
+
private name;
|
|
14
|
+
private authors;
|
|
15
|
+
private createdAt;
|
|
16
|
+
private ops;
|
|
17
|
+
constructor(id: Id);
|
|
18
|
+
/**
|
|
19
|
+
* Sets the edit name.
|
|
20
|
+
*/
|
|
21
|
+
setName(name: string): this;
|
|
22
|
+
/**
|
|
23
|
+
* Adds an author to the edit.
|
|
24
|
+
*/
|
|
25
|
+
addAuthor(authorId: Id): this;
|
|
26
|
+
/**
|
|
27
|
+
* Sets multiple authors at once.
|
|
28
|
+
*/
|
|
29
|
+
setAuthors(authorIds: Id[]): this;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the creation timestamp (microseconds since Unix epoch).
|
|
32
|
+
*/
|
|
33
|
+
setCreatedAt(timestamp: bigint): this;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the creation timestamp to now.
|
|
36
|
+
*/
|
|
37
|
+
setCreatedNow(): this;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a CreateProperty operation.
|
|
40
|
+
*/
|
|
41
|
+
createProperty(id: Id, dataType: DataType): this;
|
|
42
|
+
/**
|
|
43
|
+
* Adds a CreateEntity operation using a builder function.
|
|
44
|
+
*/
|
|
45
|
+
createEntity(id: Id, build: (b: EntityBuilder) => EntityBuilder): this;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a CreateEntity operation with no values.
|
|
48
|
+
*/
|
|
49
|
+
createEmptyEntity(id: Id): this;
|
|
50
|
+
/**
|
|
51
|
+
* Adds an UpdateEntity operation using a builder function.
|
|
52
|
+
*/
|
|
53
|
+
updateEntity(id: Id, build: (b: UpdateEntityBuilder) => UpdateEntityBuilder): this;
|
|
54
|
+
/**
|
|
55
|
+
* Adds a DeleteEntity operation.
|
|
56
|
+
*/
|
|
57
|
+
deleteEntity(id: Id): this;
|
|
58
|
+
/**
|
|
59
|
+
* Adds a RestoreEntity operation.
|
|
60
|
+
*/
|
|
61
|
+
restoreEntity(id: Id): this;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a CreateRelation operation in unique mode (ID derived from endpoints + type).
|
|
64
|
+
*/
|
|
65
|
+
createRelationUnique(from: Id, to: Id, relationType: Id): this;
|
|
66
|
+
/**
|
|
67
|
+
* Adds a CreateRelation operation in many mode (explicit ID).
|
|
68
|
+
*/
|
|
69
|
+
createRelationMany(id: Id, from: Id, to: Id, relationType: Id): this;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a CreateRelation operation with full control using a builder.
|
|
72
|
+
*/
|
|
73
|
+
createRelation(build: (b: RelationBuilder) => RelationBuilder): this;
|
|
74
|
+
/**
|
|
75
|
+
* Adds a CreateRelation directly.
|
|
76
|
+
*/
|
|
77
|
+
addRelation(relation: CreateRelation): this;
|
|
78
|
+
/**
|
|
79
|
+
* Adds an UpdateRelation operation (can only update position).
|
|
80
|
+
*/
|
|
81
|
+
updateRelation(id: Id, position?: string): this;
|
|
82
|
+
/**
|
|
83
|
+
* Adds a DeleteRelation operation.
|
|
84
|
+
*/
|
|
85
|
+
deleteRelation(id: Id): this;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a RestoreRelation operation.
|
|
88
|
+
*/
|
|
89
|
+
restoreRelation(id: Id): this;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a raw operation directly.
|
|
92
|
+
*/
|
|
93
|
+
addOp(op: Op): this;
|
|
94
|
+
/**
|
|
95
|
+
* Adds multiple raw operations.
|
|
96
|
+
*/
|
|
97
|
+
addOps(ops: Op[]): this;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the number of operations added so far.
|
|
100
|
+
*/
|
|
101
|
+
opCount(): number;
|
|
102
|
+
/**
|
|
103
|
+
* Builds the final Edit.
|
|
104
|
+
*/
|
|
105
|
+
build(): Edit;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/builder/edit.ts"],"names":[],"mappings":"AA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AAC,EAAE,mBAAmB,KAAK,mBAAmB,GAAG,IAAI;IAWlF;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI;IAK1B;;OAEG;IACH,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI;IAS3B;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,GAAG,IAAI;IAW9D;;OAEG;IACH,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,GAAG,IAAI;IAWpE;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,eAAe,GAAG,IAAI;IASpE;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAK/C;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI;IAK5B;;OAEG;IACH,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI;IAS7B;;OAEG;IACH,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI;IAKnB;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI;IASvB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,KAAK,IAAI,IAAI;CASd"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { EntityBuilder } from "./entity.js";
|
|
2
|
+
import { UpdateEntityBuilder } from "./update.js";
|
|
3
|
+
import { RelationBuilder } from "./relation.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builder for constructing an Edit with operations.
|
|
6
|
+
*/
|
|
7
|
+
export class EditBuilder {
|
|
8
|
+
_id;
|
|
9
|
+
name = "";
|
|
10
|
+
authors = [];
|
|
11
|
+
createdAt = 0n;
|
|
12
|
+
ops = [];
|
|
13
|
+
constructor(id) {
|
|
14
|
+
this._id = id;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the edit name.
|
|
18
|
+
*/
|
|
19
|
+
setName(name) {
|
|
20
|
+
this.name = name;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds an author to the edit.
|
|
25
|
+
*/
|
|
26
|
+
addAuthor(authorId) {
|
|
27
|
+
this.authors.push(authorId);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets multiple authors at once.
|
|
32
|
+
*/
|
|
33
|
+
setAuthors(authorIds) {
|
|
34
|
+
this.authors = [...authorIds];
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sets the creation timestamp (microseconds since Unix epoch).
|
|
39
|
+
*/
|
|
40
|
+
setCreatedAt(timestamp) {
|
|
41
|
+
this.createdAt = timestamp;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets the creation timestamp to now.
|
|
46
|
+
*/
|
|
47
|
+
setCreatedNow() {
|
|
48
|
+
this.createdAt = BigInt(Date.now()) * 1000n;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
// =========================================================================
|
|
52
|
+
// Property Operations
|
|
53
|
+
// =========================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Adds a CreateProperty operation.
|
|
56
|
+
*/
|
|
57
|
+
createProperty(id, dataType) {
|
|
58
|
+
this.ops.push({ type: "createProperty", id, dataType });
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
// =========================================================================
|
|
62
|
+
// Entity Operations
|
|
63
|
+
// =========================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Adds a CreateEntity operation using a builder function.
|
|
66
|
+
*/
|
|
67
|
+
createEntity(id, build) {
|
|
68
|
+
const builder = build(new EntityBuilder());
|
|
69
|
+
this.ops.push({
|
|
70
|
+
type: "createEntity",
|
|
71
|
+
id,
|
|
72
|
+
values: builder.getValues(),
|
|
73
|
+
});
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Adds a CreateEntity operation with no values.
|
|
78
|
+
*/
|
|
79
|
+
createEmptyEntity(id) {
|
|
80
|
+
this.ops.push({
|
|
81
|
+
type: "createEntity",
|
|
82
|
+
id,
|
|
83
|
+
values: [],
|
|
84
|
+
});
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Adds an UpdateEntity operation using a builder function.
|
|
89
|
+
*/
|
|
90
|
+
updateEntity(id, build) {
|
|
91
|
+
const builder = build(new UpdateEntityBuilder(id));
|
|
92
|
+
this.ops.push({
|
|
93
|
+
type: "updateEntity",
|
|
94
|
+
id: builder.id,
|
|
95
|
+
setProperties: builder.getSetProperties(),
|
|
96
|
+
unsetProperties: builder.getUnsetProperties(),
|
|
97
|
+
});
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Adds a DeleteEntity operation.
|
|
102
|
+
*/
|
|
103
|
+
deleteEntity(id) {
|
|
104
|
+
this.ops.push({ type: "deleteEntity", id });
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Adds a RestoreEntity operation.
|
|
109
|
+
*/
|
|
110
|
+
restoreEntity(id) {
|
|
111
|
+
this.ops.push({ type: "restoreEntity", id });
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
// =========================================================================
|
|
115
|
+
// Relation Operations
|
|
116
|
+
// =========================================================================
|
|
117
|
+
/**
|
|
118
|
+
* Adds a CreateRelation operation in unique mode (ID derived from endpoints + type).
|
|
119
|
+
*/
|
|
120
|
+
createRelationUnique(from, to, relationType) {
|
|
121
|
+
this.ops.push({
|
|
122
|
+
type: "createRelation",
|
|
123
|
+
idMode: { type: "unique" },
|
|
124
|
+
relationType,
|
|
125
|
+
from,
|
|
126
|
+
to,
|
|
127
|
+
});
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Adds a CreateRelation operation in many mode (explicit ID).
|
|
132
|
+
*/
|
|
133
|
+
createRelationMany(id, from, to, relationType) {
|
|
134
|
+
this.ops.push({
|
|
135
|
+
type: "createRelation",
|
|
136
|
+
idMode: { type: "many", id },
|
|
137
|
+
relationType,
|
|
138
|
+
from,
|
|
139
|
+
to,
|
|
140
|
+
});
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Adds a CreateRelation operation with full control using a builder.
|
|
145
|
+
*/
|
|
146
|
+
createRelation(build) {
|
|
147
|
+
const builder = build(new RelationBuilder());
|
|
148
|
+
const relation = builder.build();
|
|
149
|
+
if (relation) {
|
|
150
|
+
this.ops.push(relation);
|
|
151
|
+
}
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Adds a CreateRelation directly.
|
|
156
|
+
*/
|
|
157
|
+
addRelation(relation) {
|
|
158
|
+
this.ops.push(relation);
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Adds an UpdateRelation operation (can only update position).
|
|
163
|
+
*/
|
|
164
|
+
updateRelation(id, position) {
|
|
165
|
+
this.ops.push({ type: "updateRelation", id, position });
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Adds a DeleteRelation operation.
|
|
170
|
+
*/
|
|
171
|
+
deleteRelation(id) {
|
|
172
|
+
this.ops.push({ type: "deleteRelation", id });
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Adds a RestoreRelation operation.
|
|
177
|
+
*/
|
|
178
|
+
restoreRelation(id) {
|
|
179
|
+
this.ops.push({ type: "restoreRelation", id });
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
// =========================================================================
|
|
183
|
+
// Raw Operations
|
|
184
|
+
// =========================================================================
|
|
185
|
+
/**
|
|
186
|
+
* Adds a raw operation directly.
|
|
187
|
+
*/
|
|
188
|
+
addOp(op) {
|
|
189
|
+
this.ops.push(op);
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Adds multiple raw operations.
|
|
194
|
+
*/
|
|
195
|
+
addOps(ops) {
|
|
196
|
+
this.ops.push(...ops);
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
// =========================================================================
|
|
200
|
+
// Build
|
|
201
|
+
// =========================================================================
|
|
202
|
+
/**
|
|
203
|
+
* Returns the number of operations added so far.
|
|
204
|
+
*/
|
|
205
|
+
opCount() {
|
|
206
|
+
return this.ops.length;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Builds the final Edit.
|
|
210
|
+
*/
|
|
211
|
+
build() {
|
|
212
|
+
return {
|
|
213
|
+
id: this._id,
|
|
214
|
+
name: this.name,
|
|
215
|
+
authors: this.authors,
|
|
216
|
+
createdAt: this.createdAt,
|
|
217
|
+
ops: this.ops,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/builder/edit.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,WAAW;IACL,GAAG,CAAK;IACjB,IAAI,GAAW,EAAE,CAAC;IAClB,OAAO,GAAS,EAAE,CAAC;IACnB,SAAS,GAAW,EAA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CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,KAAK,CAAC,EAAM;QACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAS;QACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4EAA4E;IAC5E,QAAQ;IACR,4EAA4E;IAE5E;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Id } from "../types/id.js";
|
|
2
|
+
import type { DecimalMantissa, PropertyValue, Value } from "../types/value.js";
|
|
3
|
+
import { EmbeddingSubType } from "../types/value.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builder for entity values (used in CreateEntity).
|
|
6
|
+
*/
|
|
7
|
+
export declare class EntityBuilder {
|
|
8
|
+
private values;
|
|
9
|
+
/**
|
|
10
|
+
* Adds a property value.
|
|
11
|
+
*/
|
|
12
|
+
value(property: Id, value: Value): this;
|
|
13
|
+
/**
|
|
14
|
+
* Adds a TEXT value.
|
|
15
|
+
*/
|
|
16
|
+
text(property: Id, value: string, language?: Id): this;
|
|
17
|
+
/**
|
|
18
|
+
* Adds an INT64 value.
|
|
19
|
+
*/
|
|
20
|
+
int64(property: Id, value: bigint, unit?: Id): this;
|
|
21
|
+
/**
|
|
22
|
+
* Adds a FLOAT64 value.
|
|
23
|
+
*/
|
|
24
|
+
float64(property: Id, value: number, unit?: Id): this;
|
|
25
|
+
/**
|
|
26
|
+
* Adds a BOOL value.
|
|
27
|
+
*/
|
|
28
|
+
bool(property: Id, value: boolean): this;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a BYTES value.
|
|
31
|
+
*/
|
|
32
|
+
bytes(property: Id, value: Uint8Array): this;
|
|
33
|
+
/**
|
|
34
|
+
* Adds a POINT value (latitude, longitude).
|
|
35
|
+
*/
|
|
36
|
+
point(property: Id, lat: number, lon: number): this;
|
|
37
|
+
/**
|
|
38
|
+
* Adds a DATE value (ISO 8601 string like "2024-01-15" or "2024-01" or "2024").
|
|
39
|
+
*/
|
|
40
|
+
date(property: Id, value: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* Adds a TIMESTAMP value (microseconds since Unix epoch).
|
|
43
|
+
*/
|
|
44
|
+
timestamp(property: Id, micros: bigint): this;
|
|
45
|
+
/**
|
|
46
|
+
* Adds a DECIMAL value.
|
|
47
|
+
*/
|
|
48
|
+
decimal(property: Id, exponent: number, mantissa: DecimalMantissa, unit?: Id): this;
|
|
49
|
+
/**
|
|
50
|
+
* Adds a DECIMAL value from a bigint mantissa.
|
|
51
|
+
*/
|
|
52
|
+
decimalI64(property: Id, exponent: number, mantissa: bigint, unit?: Id): this;
|
|
53
|
+
/**
|
|
54
|
+
* Adds an EMBEDDING value.
|
|
55
|
+
*/
|
|
56
|
+
embedding(property: Id, subType: EmbeddingSubType, dims: number, data: Uint8Array): this;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the built values array.
|
|
59
|
+
*/
|
|
60
|
+
getValues(): PropertyValue[];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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EG;IACH,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI;IAQnF;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI;IAI7E;;OAEG;IACH,SAAS,CACP,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,GACf,IAAI;IAQP;;OAEG;IACH,SAAS,IAAI,aAAa,EAAE;CAG7B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder for entity values (used in CreateEntity).
|
|
3
|
+
*/
|
|
4
|
+
export class EntityBuilder {
|
|
5
|
+
values = [];
|
|
6
|
+
/**
|
|
7
|
+
* Adds a property value.
|
|
8
|
+
*/
|
|
9
|
+
value(property, value) {
|
|
10
|
+
this.values.push({ property, value });
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Adds a TEXT value.
|
|
15
|
+
*/
|
|
16
|
+
text(property, value, language) {
|
|
17
|
+
this.values.push({
|
|
18
|
+
property,
|
|
19
|
+
value: { type: "text", value, language },
|
|
20
|
+
});
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds an INT64 value.
|
|
25
|
+
*/
|
|
26
|
+
int64(property, value, unit) {
|
|
27
|
+
this.values.push({
|
|
28
|
+
property,
|
|
29
|
+
value: { type: "int64", value, unit },
|
|
30
|
+
});
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Adds a FLOAT64 value.
|
|
35
|
+
*/
|
|
36
|
+
float64(property, value, unit) {
|
|
37
|
+
this.values.push({
|
|
38
|
+
property,
|
|
39
|
+
value: { type: "float64", value, unit },
|
|
40
|
+
});
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Adds a BOOL value.
|
|
45
|
+
*/
|
|
46
|
+
bool(property, value) {
|
|
47
|
+
this.values.push({
|
|
48
|
+
property,
|
|
49
|
+
value: { type: "bool", value },
|
|
50
|
+
});
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Adds a BYTES value.
|
|
55
|
+
*/
|
|
56
|
+
bytes(property, value) {
|
|
57
|
+
this.values.push({
|
|
58
|
+
property,
|
|
59
|
+
value: { type: "bytes", value },
|
|
60
|
+
});
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Adds a POINT value (latitude, longitude).
|
|
65
|
+
*/
|
|
66
|
+
point(property, lat, lon) {
|
|
67
|
+
this.values.push({
|
|
68
|
+
property,
|
|
69
|
+
value: { type: "point", lat, lon },
|
|
70
|
+
});
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Adds a DATE value (ISO 8601 string like "2024-01-15" or "2024-01" or "2024").
|
|
75
|
+
*/
|
|
76
|
+
date(property, value) {
|
|
77
|
+
this.values.push({
|
|
78
|
+
property,
|
|
79
|
+
value: { type: "date", value },
|
|
80
|
+
});
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Adds a TIMESTAMP value (microseconds since Unix epoch).
|
|
85
|
+
*/
|
|
86
|
+
timestamp(property, micros) {
|
|
87
|
+
this.values.push({
|
|
88
|
+
property,
|
|
89
|
+
value: { type: "timestamp", value: micros },
|
|
90
|
+
});
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Adds a DECIMAL value.
|
|
95
|
+
*/
|
|
96
|
+
decimal(property, exponent, mantissa, unit) {
|
|
97
|
+
this.values.push({
|
|
98
|
+
property,
|
|
99
|
+
value: { type: "decimal", exponent, mantissa, unit },
|
|
100
|
+
});
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Adds a DECIMAL value from a bigint mantissa.
|
|
105
|
+
*/
|
|
106
|
+
decimalI64(property, exponent, mantissa, unit) {
|
|
107
|
+
return this.decimal(property, exponent, { type: "i64", value: mantissa }, unit);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Adds an EMBEDDING value.
|
|
111
|
+
*/
|
|
112
|
+
embedding(property, subType, dims, data) {
|
|
113
|
+
this.values.push({
|
|
114
|
+
property,
|
|
115
|
+
value: { type: "embedding", subType, dims, data },
|
|
116
|
+
});
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Returns the built values array.
|
|
121
|
+
*/
|
|
122
|
+
getValues() {
|
|
123
|
+
return this.values;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/builder/entity.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,GAAoB,EAAE,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,QAAY,EAAE,KAAY;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,QAAY,EAAE,KAAa,EAAE,QAAa;QAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACf,QAAQ;YACR,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE;SACzC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK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/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Id } from "../types/id.js";
|
|
2
|
+
import type { CreateRelation } from "../types/op.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builder for CreateRelation operations with full control.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RelationBuilder {
|
|
7
|
+
private idMode?;
|
|
8
|
+
private relationType?;
|
|
9
|
+
private from?;
|
|
10
|
+
private to?;
|
|
11
|
+
private entity?;
|
|
12
|
+
private position?;
|
|
13
|
+
private fromSpace?;
|
|
14
|
+
private fromVersion?;
|
|
15
|
+
private toSpace?;
|
|
16
|
+
private toVersion?;
|
|
17
|
+
/**
|
|
18
|
+
* Sets unique mode (ID derived from from+to+type).
|
|
19
|
+
*/
|
|
20
|
+
unique(): this;
|
|
21
|
+
/**
|
|
22
|
+
* Sets many mode with an explicit relation ID.
|
|
23
|
+
*/
|
|
24
|
+
many(id: Id): this;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the relation type.
|
|
27
|
+
*/
|
|
28
|
+
type(id: Id): this;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the source entity.
|
|
31
|
+
*/
|
|
32
|
+
fromEntity(id: Id): this;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the target entity.
|
|
35
|
+
*/
|
|
36
|
+
toEntity(id: Id): this;
|
|
37
|
+
/**
|
|
38
|
+
* Sets an explicit reified entity ID (many mode only).
|
|
39
|
+
*/
|
|
40
|
+
reifiedEntity(id: Id): this;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the position string for ordering.
|
|
43
|
+
*/
|
|
44
|
+
atPosition(pos: string): this;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the from_space pin.
|
|
47
|
+
*/
|
|
48
|
+
pinFromSpace(id: Id): this;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the from_version pin.
|
|
51
|
+
*/
|
|
52
|
+
pinFromVersion(id: Id): this;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the to_space pin.
|
|
55
|
+
*/
|
|
56
|
+
pinToSpace(id: Id): this;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the to_version pin.
|
|
59
|
+
*/
|
|
60
|
+
pinToVersion(id: Id): this;
|
|
61
|
+
/**
|
|
62
|
+
* Builds the CreateRelation, returning undefined if required fields are missing.
|
|
63
|
+
*/
|
|
64
|
+
build(): CreateRelation | undefined;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=relation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../src/builder/relation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAErE;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,CAAiB;IAChC,OAAO,CAAC,YAAY,CAAC,CAAK;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAK;IAClB,OAAO,CAAC,EAAE,CAAC,CAAK;IAChB,OAAO,CAAC,MAAM,CAAC,CAAK;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