@graphprotocol/grc-20 0.24.0 → 0.25.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/README.md +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +12 -12
- package/dist/contracts.js.map +1 -1
- package/dist/src/graph/serialize.d.ts +1 -1
- package/dist/src/graph/serialize.d.ts.map +1 -1
- package/dist/src/graph/serialize.js +1 -1
- package/dist/src/graph/serialize.js.map +1 -1
- package/dist/src/graph/serialize.test.js +4 -4
- package/dist/src/graph/serialize.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/constants.d.ts +0 -7
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -8
- package/dist/constants.js.map +0 -1
- package/dist/convert-ids.d.ts +0 -2
- package/dist/convert-ids.d.ts.map +0 -1
- package/dist/convert-ids.js +0 -42
- package/dist/convert-ids.js.map +0 -1
- package/dist/protov2.d.ts +0 -11
- package/dist/protov2.d.ts.map +0 -1
- package/dist/protov2.js +0 -11
- package/dist/protov2.js.map +0 -1
- package/dist/src/core/blocks/image.d.ts +0 -15
- package/dist/src/core/blocks/image.d.ts.map +0 -1
- package/dist/src/core/blocks/image.js +0 -15
- package/dist/src/core/blocks/image.js.map +0 -1
- package/dist/src/core/idsv2/content.d.ts +0 -59
- package/dist/src/core/idsv2/content.d.ts.map +0 -1
- package/dist/src/core/idsv2/content.js +0 -59
- package/dist/src/core/idsv2/content.js.map +0 -1
- package/dist/src/core/idsv2/network.d.ts +0 -5
- package/dist/src/core/idsv2/network.d.ts.map +0 -1
- package/dist/src/core/idsv2/network.js +0 -5
- package/dist/src/core/idsv2/network.js.map +0 -1
- package/dist/src/core/idsv2/system.d.ts +0 -222
- package/dist/src/core/idsv2/system.d.ts.map +0 -1
- package/dist/src/core/idsv2/system.js +0 -230
- package/dist/src/core/idsv2/system.js.map +0 -1
- package/dist/src/core/image.d.ts +0 -40
- package/dist/src/core/image.d.ts.map +0 -1
- package/dist/src/core/image.js +0 -76
- package/dist/src/core/image.js.map +0 -1
- package/dist/src/core/image.test.d.ts +0 -2
- package/dist/src/core/image.test.d.ts.map +0 -1
- package/dist/src/core/image.test.js +0 -52
- package/dist/src/core/image.test.js.map +0 -1
- package/dist/src/core/relation.d.ts +0 -88
- package/dist/src/core/relation.d.ts.map +0 -1
- package/dist/src/core/relation.js +0 -89
- package/dist/src/core/relation.js.map +0 -1
- package/dist/src/core/relation.test.d.ts +0 -2
- package/dist/src/core/relation.test.d.ts.map +0 -1
- package/dist/src/core/relation.test.js +0 -45
- package/dist/src/core/relation.test.js.map +0 -1
- package/dist/src/core/triple.d.ts +0 -50
- package/dist/src/core/triple.d.ts.map +0 -1
- package/dist/src/core/triple.js +0 -56
- package/dist/src/core/triple.js.map +0 -1
- package/dist/src/core/triple.test.d.ts +0 -2
- package/dist/src/core/triple.test.d.ts.map +0 -1
- package/dist/src/core/triple.test.js +0 -37
- package/dist/src/core/triple.test.js.map +0 -1
- package/dist/src/graph/delete-entity.d.ts +0 -14
- package/dist/src/graph/delete-entity.d.ts.map +0 -1
- package/dist/src/graph/delete-entity.js +0 -21
- package/dist/src/graph/delete-entity.js.map +0 -1
- package/dist/src/graph/delete-entity.test.d.ts +0 -2
- package/dist/src/graph/delete-entity.test.d.ts.map +0 -1
- package/dist/src/graph/delete-entity.test.js +0 -23
- package/dist/src/graph/delete-entity.test.js.map +0 -1
- package/dist/src/graph/graph.test.d.ts +0 -2
- package/dist/src/graph/graph.test.d.ts.map +0 -1
- package/dist/src/graph/graph.test.js +0 -46
- package/dist/src/graph/graph.test.js.map +0 -1
- package/dist/src/graph/helpers/create-default-properties.d.ts +0 -5
- package/dist/src/graph/helpers/create-default-properties.d.ts.map +0 -1
- package/dist/src/graph/helpers/create-default-properties.js +0 -44
- package/dist/src/graph/helpers/create-default-properties.js.map +0 -1
- package/dist/src/graph/helpers/create-properties.d.ts +0 -8
- package/dist/src/graph/helpers/create-properties.d.ts.map +0 -1
- package/dist/src/graph/helpers/create-properties.js +0 -53
- package/dist/src/graph/helpers/create-properties.js.map +0 -1
- package/dist/src/graphv2/constants.d.ts +0 -2
- package/dist/src/graphv2/constants.d.ts.map +0 -1
- package/dist/src/graphv2/constants.js +0 -2
- package/dist/src/graphv2/constants.js.map +0 -1
- package/dist/src/graphv2/create-entity.d.ts +0 -52
- package/dist/src/graphv2/create-entity.d.ts.map +0 -1
- package/dist/src/graphv2/create-entity.js +0 -140
- package/dist/src/graphv2/create-entity.js.map +0 -1
- package/dist/src/graphv2/create-entity.test.d.ts +0 -2
- package/dist/src/graphv2/create-entity.test.d.ts.map +0 -1
- package/dist/src/graphv2/create-entity.test.js +0 -158
- package/dist/src/graphv2/create-entity.test.js.map +0 -1
- package/dist/src/graphv2/create-image.d.ts +0 -28
- package/dist/src/graphv2/create-image.d.ts.map +0 -1
- package/dist/src/graphv2/create-image.js +0 -71
- package/dist/src/graphv2/create-image.js.map +0 -1
- package/dist/src/graphv2/create-image.test.d.ts +0 -2
- package/dist/src/graphv2/create-image.test.d.ts.map +0 -1
- package/dist/src/graphv2/create-image.test.js +0 -142
- package/dist/src/graphv2/create-image.test.js.map +0 -1
- package/dist/src/graphv2/create-property.d.ts +0 -22
- package/dist/src/graphv2/create-property.d.ts.map +0 -1
- package/dist/src/graphv2/create-property.js +0 -129
- package/dist/src/graphv2/create-property.js.map +0 -1
- package/dist/src/graphv2/create-property.test.d.ts +0 -2
- package/dist/src/graphv2/create-property.test.d.ts.map +0 -1
- package/dist/src/graphv2/create-property.test.js +0 -82
- package/dist/src/graphv2/create-property.test.js.map +0 -1
- package/dist/src/graphv2/create-relation.d.ts +0 -33
- package/dist/src/graphv2/create-relation.d.ts.map +0 -1
- package/dist/src/graphv2/create-relation.js +0 -66
- package/dist/src/graphv2/create-relation.js.map +0 -1
- package/dist/src/graphv2/create-relation.test.d.ts +0 -2
- package/dist/src/graphv2/create-relation.test.d.ts.map +0 -1
- package/dist/src/graphv2/create-relation.test.js +0 -208
- package/dist/src/graphv2/create-relation.test.js.map +0 -1
- package/dist/src/graphv2/create-space.d.ts +0 -13
- package/dist/src/graphv2/create-space.d.ts.map +0 -1
- package/dist/src/graphv2/create-space.js +0 -21
- package/dist/src/graphv2/create-space.js.map +0 -1
- package/dist/src/graphv2/create-type.d.ts +0 -22
- package/dist/src/graphv2/create-type.d.ts.map +0 -1
- package/dist/src/graphv2/create-type.js +0 -64
- package/dist/src/graphv2/create-type.js.map +0 -1
- package/dist/src/graphv2/create-type.test.d.ts +0 -2
- package/dist/src/graphv2/create-type.test.d.ts.map +0 -1
- package/dist/src/graphv2/create-type.test.js +0 -109
- package/dist/src/graphv2/create-type.test.js.map +0 -1
- package/dist/src/graphv2/delete-entity.d.ts +0 -14
- package/dist/src/graphv2/delete-entity.d.ts.map +0 -1
- package/dist/src/graphv2/delete-entity.js +0 -21
- package/dist/src/graphv2/delete-entity.js.map +0 -1
- package/dist/src/graphv2/delete-entity.test.d.ts +0 -2
- package/dist/src/graphv2/delete-entity.test.d.ts.map +0 -1
- package/dist/src/graphv2/delete-entity.test.js +0 -24
- package/dist/src/graphv2/delete-entity.test.js.map +0 -1
- package/dist/src/graphv2/delete-relation.d.ts +0 -14
- package/dist/src/graphv2/delete-relation.d.ts.map +0 -1
- package/dist/src/graphv2/delete-relation.js +0 -21
- package/dist/src/graphv2/delete-relation.js.map +0 -1
- package/dist/src/graphv2/delete-relation.test.d.ts +0 -2
- package/dist/src/graphv2/delete-relation.test.d.ts.map +0 -1
- package/dist/src/graphv2/delete-relation.test.js +0 -24
- package/dist/src/graphv2/delete-relation.test.js.map +0 -1
- package/dist/src/graphv2/index.d.ts +0 -12
- package/dist/src/graphv2/index.d.ts.map +0 -1
- package/dist/src/graphv2/index.js +0 -12
- package/dist/src/graphv2/index.js.map +0 -1
- package/dist/src/graphv2/remove-entity-properties.d.ts +0 -25
- package/dist/src/graphv2/remove-entity-properties.d.ts.map +0 -1
- package/dist/src/graphv2/remove-entity-properties.js +0 -24
- package/dist/src/graphv2/remove-entity-properties.js.map +0 -1
- package/dist/src/graphv2/unset-entity-values.d.ts +0 -21
- package/dist/src/graphv2/unset-entity-values.d.ts.map +0 -1
- package/dist/src/graphv2/unset-entity-values.js +0 -26
- package/dist/src/graphv2/unset-entity-values.js.map +0 -1
- package/dist/src/graphv2/unset-entity-values.test.d.ts +0 -2
- package/dist/src/graphv2/unset-entity-values.test.d.ts.map +0 -1
- package/dist/src/graphv2/unset-entity-values.test.js +0 -40
- package/dist/src/graphv2/unset-entity-values.test.js.map +0 -1
- package/dist/src/graphv2/unset-relation-fields.d.ts +0 -25
- package/dist/src/graphv2/unset-relation-fields.d.ts.map +0 -1
- package/dist/src/graphv2/unset-relation-fields.js +0 -34
- package/dist/src/graphv2/unset-relation-fields.js.map +0 -1
- package/dist/src/graphv2/unset-relation-fields.test.d.ts +0 -2
- package/dist/src/graphv2/unset-relation-fields.test.d.ts.map +0 -1
- package/dist/src/graphv2/unset-relation-fields.test.js +0 -64
- package/dist/src/graphv2/unset-relation-fields.test.js.map +0 -1
- package/dist/src/graphv2/update-entity.d.ts +0 -28
- package/dist/src/graphv2/update-entity.d.ts.map +0 -1
- package/dist/src/graphv2/update-entity.js +0 -73
- package/dist/src/graphv2/update-entity.js.map +0 -1
- package/dist/src/graphv2/update-entity.test.d.ts +0 -2
- package/dist/src/graphv2/update-entity.test.d.ts.map +0 -1
- package/dist/src/graphv2/update-entity.test.js +0 -116
- package/dist/src/graphv2/update-entity.test.js.map +0 -1
- package/dist/src/graphv2/update-relation.d.ts +0 -21
- package/dist/src/graphv2/update-relation.d.ts.map +0 -1
- package/dist/src/graphv2/update-relation.js +0 -37
- package/dist/src/graphv2/update-relation.js.map +0 -1
- package/dist/src/idv2.d.ts +0 -27
- package/dist/src/idv2.d.ts.map +0 -1
- package/dist/src/idv2.js +0 -88
- package/dist/src/idv2.js.map +0 -1
- package/dist/src/idv2.test.d.ts +0 -2
- package/dist/src/idv2.test.d.ts.map +0 -1
- package/dist/src/idv2.test.js +0 -26
- package/dist/src/idv2.test.js.map +0 -1
- package/dist/src/image.d.ts +0 -8
- package/dist/src/image.d.ts.map +0 -1
- package/dist/src/image.js +0 -8
- package/dist/src/image.js.map +0 -1
- package/dist/src/ipfsv2.d.ts +0 -96
- package/dist/src/ipfsv2.d.ts.map +0 -1
- package/dist/src/ipfsv2.js +0 -163
- package/dist/src/ipfsv2.js.map +0 -1
- package/dist/src/ipfsv2.test.d.ts +0 -2
- package/dist/src/ipfsv2.test.d.ts.map +0 -1
- package/dist/src/ipfsv2.test.js +0 -22
- package/dist/src/ipfsv2.test.js.map +0 -1
- package/dist/src/proto/editv2.d.ts +0 -11
- package/dist/src/proto/editv2.d.ts.map +0 -1
- package/dist/src/proto/editv2.js +0 -81
- package/dist/src/proto/editv2.js.map +0 -1
- package/dist/src/proto/editv2.test.d.ts +0 -2
- package/dist/src/proto/editv2.test.d.ts.map +0 -1
- package/dist/src/proto/editv2.test.js +0 -211
- package/dist/src/proto/editv2.test.js.map +0 -1
- package/dist/src/proto/gen/src/proto/ipfsv2_pb.d.ts +0 -410
- package/dist/src/proto/gen/src/proto/ipfsv2_pb.d.ts.map +0 -1
- package/dist/src/proto/gen/src/proto/ipfsv2_pb.js +0 -536
- package/dist/src/proto/gen/src/proto/ipfsv2_pb.js.map +0 -1
- package/dist/src/relation.d.ts +0 -7
- package/dist/src/relation.d.ts.map +0 -1
- package/dist/src/relation.js +0 -7
- package/dist/src/relation.js.map +0 -1
- package/dist/src/smart-wallet-2.test-invalid.d.ts +0 -2
- package/dist/src/smart-wallet-2.test-invalid.d.ts.map +0 -1
- package/dist/src/smart-wallet-2.test-invalid.js +0 -49
- package/dist/src/smart-wallet-2.test-invalid.js.map +0 -1
- package/dist/src/smart-wallet-2.test.d.ts +0 -2
- package/dist/src/smart-wallet-2.test.d.ts.map +0 -1
- package/dist/src/smart-wallet-2.test.js +0 -49
- package/dist/src/smart-wallet-2.test.js.map +0 -1
- package/dist/src/system-ids-v2.d.ts +0 -7
- package/dist/src/system-ids-v2.d.ts.map +0 -1
- package/dist/src/system-ids-v2.js +0 -7
- package/dist/src/system-ids-v2.js.map +0 -1
- package/dist/src/triple.d.ts +0 -7
- package/dist/src/triple.d.ts.map +0 -1
- package/dist/src/triple.js +0 -7
- package/dist/src/triple.js.map +0 -1
- package/dist/src/types-backup.d.ts +0 -134
- package/dist/src/types-backup.d.ts.map +0 -1
- package/dist/src/types-backup.js +0 -13
- package/dist/src/types-backup.js.map +0 -1
- package/dist/src/typesv2.d.ts +0 -173
- package/dist/src/typesv2.d.ts.map +0 -1
- package/dist/src/typesv2.js +0 -8
- package/dist/src/typesv2.js.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { COVER_PROPERTY, DESCRIPTION_PROPERTY, NAME_PROPERTY } from '../../core/ids/system.js';
|
|
2
|
-
import { assertValid } from '../../id.js';
|
|
3
|
-
import { Relation } from '../../relation.js';
|
|
4
|
-
import { Triple } from '../../triple.js';
|
|
5
|
-
export const createDefaultProperties = (params) => {
|
|
6
|
-
const { entityId, name, description, cover } = params;
|
|
7
|
-
const ops = [];
|
|
8
|
-
if (name) {
|
|
9
|
-
// set property "Name" to the provided name
|
|
10
|
-
const nameTripleOp = Triple.make({
|
|
11
|
-
entityId,
|
|
12
|
-
attributeId: NAME_PROPERTY,
|
|
13
|
-
value: {
|
|
14
|
-
type: 'TEXT',
|
|
15
|
-
value: name,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
ops.push(nameTripleOp);
|
|
19
|
-
}
|
|
20
|
-
if (description) {
|
|
21
|
-
// set property "Description" to the provided description
|
|
22
|
-
const descriptionTripleOp = Triple.make({
|
|
23
|
-
entityId,
|
|
24
|
-
attributeId: DESCRIPTION_PROPERTY,
|
|
25
|
-
value: {
|
|
26
|
-
type: 'TEXT',
|
|
27
|
-
value: description,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
ops.push(descriptionTripleOp);
|
|
31
|
-
}
|
|
32
|
-
if (cover) {
|
|
33
|
-
// add ID of cover "Image" to property "Cover"
|
|
34
|
-
assertValid(cover);
|
|
35
|
-
const relationOp = Relation.make({
|
|
36
|
-
fromId: entityId,
|
|
37
|
-
relationTypeId: COVER_PROPERTY,
|
|
38
|
-
toId: cover,
|
|
39
|
-
});
|
|
40
|
-
ops.push(relationOp);
|
|
41
|
-
}
|
|
42
|
-
return ops;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=create-default-properties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-default-properties.js","sourceRoot":"","sources":["../../../../src/graph/helpers/create-default-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAgD,EAAE,EAAE;IAC1F,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACtD,MAAM,GAAG,GAAS,EAAE,CAAC;IAErB,IAAI,IAAI,EAAE,CAAC;QACT,2CAA2C;QAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC;YAC/B,QAAQ;YACR,WAAW,EAAE,aAAa;YAC1B,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,IAAI;aACZ;SACF,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,yDAAyD;QACzD,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC;YACtC,QAAQ;YACR,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,WAAW;aACnB;SACF,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,8CAA8C;QAC9C,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC;YAC/B,MAAM,EAAE,QAAQ;YAChB,cAAc,EAAE,cAAc;YAC9B,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Op, PropertiesParam } from '../../types.js';
|
|
2
|
-
type CreatePropertiesParams = {
|
|
3
|
-
entityId: string;
|
|
4
|
-
properties: PropertiesParam;
|
|
5
|
-
};
|
|
6
|
-
export declare const createProperties: (params: CreatePropertiesParams) => Op[];
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=create-properties.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-properties.d.ts","sourceRoot":"","sources":["../../../../src/graph/helpers/create-properties.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE1D,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,sBAAsB,SAgD9D,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { assertValid, generate } from '../../id.js';
|
|
2
|
-
import { Relation } from '../../relation.js';
|
|
3
|
-
import { Triple } from '../../triple.js';
|
|
4
|
-
export const createProperties = (params) => {
|
|
5
|
-
const { entityId, properties } = params;
|
|
6
|
-
const ops = [];
|
|
7
|
-
for (const [attributeId, property] of Object.entries(properties)) {
|
|
8
|
-
assertValid(attributeId);
|
|
9
|
-
if ('type' in property) {
|
|
10
|
-
const propertyTripleOp = Triple.make({
|
|
11
|
-
entityId,
|
|
12
|
-
attributeId,
|
|
13
|
-
value: property,
|
|
14
|
-
});
|
|
15
|
-
ops.push(propertyTripleOp);
|
|
16
|
-
}
|
|
17
|
-
else if ('to' in property) {
|
|
18
|
-
const relationId = property.relationId ?? generate();
|
|
19
|
-
assertValid(relationId);
|
|
20
|
-
assertValid(property.to);
|
|
21
|
-
const propertyRelationOp = Relation.make({
|
|
22
|
-
relationId,
|
|
23
|
-
fromId: entityId,
|
|
24
|
-
relationTypeId: attributeId,
|
|
25
|
-
toId: property.to,
|
|
26
|
-
position: property.position,
|
|
27
|
-
});
|
|
28
|
-
ops.push(propertyRelationOp);
|
|
29
|
-
if (property.properties) {
|
|
30
|
-
ops.push(...createProperties({ entityId, properties: property.properties }));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else if (Array.isArray(property)) {
|
|
34
|
-
for (const relation of property) {
|
|
35
|
-
const relationId = relation.relationId ?? generate();
|
|
36
|
-
assertValid(relationId);
|
|
37
|
-
assertValid(relation.to);
|
|
38
|
-
const propertyRelationOp = Relation.make({
|
|
39
|
-
relationId,
|
|
40
|
-
fromId: entityId,
|
|
41
|
-
relationTypeId: attributeId,
|
|
42
|
-
toId: relation.to,
|
|
43
|
-
});
|
|
44
|
-
ops.push(propertyRelationOp);
|
|
45
|
-
if (relation.properties) {
|
|
46
|
-
ops.push(...createProperties({ entityId, properties: relation.properties }));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return ops;
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=create-properties.js.map
|
|
@@ -1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AAC,kBAAkB,CAAC,CAAC;YAC7B,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACxB,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,EAAE,CAAC;gBACrD,WAAW,CAAC,UAAU,CAAC,CAAC;gBACxB,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACzB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC;oBACvC,UAAU;oBACV,MAAM,EAAE,QAAQ;oBAChB,cAAc,EAAE,WAAW;oBAC3B,IAAI,EAAE,QAAQ,CAAC,EAAE;iBAClB,CAAC,CAAC;gBACH,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBAC7B,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;oBACxB,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;gBAC/E,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/graphv2/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,4CAA4C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/graphv2/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,yCAAyC,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { CreateResult, EntityParams } from '../typesv2.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an entity with the given name, description, cover, properties, and types.
|
|
4
|
-
* All IDs passed to this function (cover, types, property IDs, relation IDs, etc.) are validated.
|
|
5
|
-
* If any invalid ID is provided, the function will throw an error.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const { id, ops } = createEntity({
|
|
10
|
-
* id: entityId, // optional and will be generated if not provided
|
|
11
|
-
* name: 'name of the entity',
|
|
12
|
-
* description: 'description of the entity',
|
|
13
|
-
* cover: imageEntityId,
|
|
14
|
-
* types: [typeEntityId1, typeEntityId2],
|
|
15
|
-
* values: {
|
|
16
|
-
* // value property like text, number, url, time, point, checkbox
|
|
17
|
-
* [propertyId]: {
|
|
18
|
-
* value: 'value of the property',
|
|
19
|
-
* }
|
|
20
|
-
* },
|
|
21
|
-
* relations: {
|
|
22
|
-
* [relationId]: {
|
|
23
|
-
* to: 'id of the entity',
|
|
24
|
-
* id: 'id of the relation', // optional
|
|
25
|
-
* toSpace: 'id of the to space', // optional
|
|
26
|
-
* position: positionString, // optional
|
|
27
|
-
* entityId: 'id of the relation entity', // optional and will be generated if not provided
|
|
28
|
-
* entityName: 'name of the relation entity', // optional
|
|
29
|
-
* entityDescription: 'description of the relation entity', // optional
|
|
30
|
-
* entityCover: 'id of the cover', // optional
|
|
31
|
-
* entityValues: { // optional values for the relation entity
|
|
32
|
-
* [propertyId]: {
|
|
33
|
-
* value: 'value of the property',
|
|
34
|
-
* },
|
|
35
|
-
* },
|
|
36
|
-
* entityRelations: {
|
|
37
|
-
* [relationId]: {
|
|
38
|
-
* to: 'id of the entity',
|
|
39
|
-
* id: 'id of the relation', // optional
|
|
40
|
-
* position: positionString, // optional
|
|
41
|
-
* },
|
|
42
|
-
* },
|
|
43
|
-
* },
|
|
44
|
-
* },
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
* @param params – {@link EntityParams}
|
|
48
|
-
* @returns – {@link CreateResult}
|
|
49
|
-
* @throws Will throw an error if any provided ID is invalid
|
|
50
|
-
*/
|
|
51
|
-
export declare const createEntity: ({ id: providedId, name, description, cover, values, relations, types, }: EntityParams) => CreateResult;
|
|
52
|
-
//# sourceMappingURL=create-entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.d.ts","sourceRoot":"","sources":["../../../src/graphv2/create-entity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAA6B,MAAM,eAAe,CAAC;AAG3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,YAAY,GAAI,yEAQ1B,YAAY,KAAG,YA4FjB,CAAC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { COVER_PROPERTY, DESCRIPTION_PROPERTY, NAME_PROPERTY, TYPES_PROPERTY } from '../core/idsv2/system.js';
|
|
2
|
-
import { Id, assertValid, generate, toBase64 } from '../idv2.js';
|
|
3
|
-
import { createRelation } from './create-relation.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates an entity with the given name, description, cover, properties, and types.
|
|
6
|
-
* All IDs passed to this function (cover, types, property IDs, relation IDs, etc.) are validated.
|
|
7
|
-
* If any invalid ID is provided, the function will throw an error.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const { id, ops } = createEntity({
|
|
12
|
-
* id: entityId, // optional and will be generated if not provided
|
|
13
|
-
* name: 'name of the entity',
|
|
14
|
-
* description: 'description of the entity',
|
|
15
|
-
* cover: imageEntityId,
|
|
16
|
-
* types: [typeEntityId1, typeEntityId2],
|
|
17
|
-
* values: {
|
|
18
|
-
* // value property like text, number, url, time, point, checkbox
|
|
19
|
-
* [propertyId]: {
|
|
20
|
-
* value: 'value of the property',
|
|
21
|
-
* }
|
|
22
|
-
* },
|
|
23
|
-
* relations: {
|
|
24
|
-
* [relationId]: {
|
|
25
|
-
* to: 'id of the entity',
|
|
26
|
-
* id: 'id of the relation', // optional
|
|
27
|
-
* toSpace: 'id of the to space', // optional
|
|
28
|
-
* position: positionString, // optional
|
|
29
|
-
* entityId: 'id of the relation entity', // optional and will be generated if not provided
|
|
30
|
-
* entityName: 'name of the relation entity', // optional
|
|
31
|
-
* entityDescription: 'description of the relation entity', // optional
|
|
32
|
-
* entityCover: 'id of the cover', // optional
|
|
33
|
-
* entityValues: { // optional values for the relation entity
|
|
34
|
-
* [propertyId]: {
|
|
35
|
-
* value: 'value of the property',
|
|
36
|
-
* },
|
|
37
|
-
* },
|
|
38
|
-
* entityRelations: {
|
|
39
|
-
* [relationId]: {
|
|
40
|
-
* to: 'id of the entity',
|
|
41
|
-
* id: 'id of the relation', // optional
|
|
42
|
-
* position: positionString, // optional
|
|
43
|
-
* },
|
|
44
|
-
* },
|
|
45
|
-
* },
|
|
46
|
-
* },
|
|
47
|
-
* });
|
|
48
|
-
* ```
|
|
49
|
-
* @param params – {@link EntityParams}
|
|
50
|
-
* @returns – {@link CreateResult}
|
|
51
|
-
* @throws Will throw an error if any provided ID is invalid
|
|
52
|
-
*/
|
|
53
|
-
export const createEntity = ({ id: providedId, name, description, cover, values, relations, types, }) => {
|
|
54
|
-
if (providedId) {
|
|
55
|
-
assertValid(providedId, '`id` in `createEntity`');
|
|
56
|
-
}
|
|
57
|
-
const id = providedId ?? generate();
|
|
58
|
-
let ops = [];
|
|
59
|
-
const newValues = [];
|
|
60
|
-
if (name) {
|
|
61
|
-
newValues.push({
|
|
62
|
-
propertyId: toBase64(NAME_PROPERTY),
|
|
63
|
-
value: name,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (description) {
|
|
67
|
-
newValues.push({
|
|
68
|
-
propertyId: toBase64(DESCRIPTION_PROPERTY),
|
|
69
|
-
value: description,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
for (const [key, value] of Object.entries(values ?? {})) {
|
|
73
|
-
newValues.push({
|
|
74
|
-
propertyId: toBase64(Id(key)),
|
|
75
|
-
value: value.value,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const op = {
|
|
79
|
-
type: 'UPDATE_ENTITY',
|
|
80
|
-
entity: {
|
|
81
|
-
id: toBase64(id),
|
|
82
|
-
values: newValues,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
ops.push(op);
|
|
86
|
-
if (cover) {
|
|
87
|
-
assertValid(cover);
|
|
88
|
-
ops.push({
|
|
89
|
-
type: 'CREATE_RELATION',
|
|
90
|
-
relation: {
|
|
91
|
-
id: toBase64(generate()),
|
|
92
|
-
entity: toBase64(generate()),
|
|
93
|
-
fromEntity: toBase64(id),
|
|
94
|
-
toEntity: toBase64(cover),
|
|
95
|
-
type: toBase64(COVER_PROPERTY),
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (types) {
|
|
100
|
-
for (const typeId of types) {
|
|
101
|
-
assertValid(typeId);
|
|
102
|
-
ops.push({
|
|
103
|
-
type: 'CREATE_RELATION',
|
|
104
|
-
relation: {
|
|
105
|
-
id: toBase64(generate()),
|
|
106
|
-
entity: toBase64(generate()),
|
|
107
|
-
fromEntity: toBase64(id),
|
|
108
|
-
toEntity: toBase64(typeId),
|
|
109
|
-
type: toBase64(TYPES_PROPERTY),
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
for (const [typeId, value] of Object.entries(relations ?? {})) {
|
|
115
|
-
const relationsEntries = Array.isArray(value) ? value : [value];
|
|
116
|
-
for (const relation of relationsEntries) {
|
|
117
|
-
const relationId = relation.relationId ?? generate();
|
|
118
|
-
assertValid(relationId);
|
|
119
|
-
const relationEntityId = relation.id ?? generate();
|
|
120
|
-
assertValid(relationEntityId);
|
|
121
|
-
const { ops: relationOps } = createRelation({
|
|
122
|
-
fromEntity: id,
|
|
123
|
-
toEntity: relation.toEntity,
|
|
124
|
-
type: Id(typeId),
|
|
125
|
-
position: relation.position,
|
|
126
|
-
toSpace: relation.toSpace,
|
|
127
|
-
entityId: relationEntityId,
|
|
128
|
-
entityName: relation.entityName,
|
|
129
|
-
entityDescription: relation.entityDescription,
|
|
130
|
-
entityCover: relation.entityCover,
|
|
131
|
-
entityValues: relation.entityValues,
|
|
132
|
-
entityRelations: relation.entityRelations,
|
|
133
|
-
entityTypes: relation.entityTypes,
|
|
134
|
-
});
|
|
135
|
-
ops = ops.concat(relationOps);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return { id, ops };
|
|
139
|
-
};
|
|
140
|
-
//# sourceMappingURL=create-entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.js","sourceRoot":"","sources":["../../../src/graphv2/create-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9G,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,EAAE,EAAE,UAAU,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,GACQ,EAAgB,EAAE;IAC/B,IAAI,UAAU,EAAE,CAAC;QACf,WAAW,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,EAAE,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;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AC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,QAAQ,EAAE,gBAAgB;gBAC1B,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;gBAC7C,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,WAAW,EAAE,QAAQ,CAAC,WAAW;aAClC,CAAC,CAAC;YACH,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.test.d.ts","sourceRoot":"","sources":["../../../src/graphv2/create-entity.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { CLAIM_TYPE, NEWS_STORY_TYPE } from '../core/idsv2/content.js';
|
|
3
|
-
import { COVER_PROPERTY, DESCRIPTION_PROPERTY, NAME_PROPERTY, TYPES_PROPERTY } from '../core/idsv2/system.js';
|
|
4
|
-
import { Id, toBase64 } from '../idv2.js';
|
|
5
|
-
import { createEntity } from './create-entity.js';
|
|
6
|
-
describe('createEntity', () => {
|
|
7
|
-
const coverId = Id('30145d36-d5a5-4244-be59-3d111d879ba5');
|
|
8
|
-
it('creates a basic entity without properties', async () => {
|
|
9
|
-
const entity = createEntity({});
|
|
10
|
-
expect(entity).toBeDefined();
|
|
11
|
-
expect(typeof entity.id).toBe('string');
|
|
12
|
-
expect(entity.ops).toBeDefined();
|
|
13
|
-
expect(entity.ops).toHaveLength(1); // One UPDATE_ENTITY op
|
|
14
|
-
expect(entity.ops[0]).toMatchObject({
|
|
15
|
-
type: 'UPDATE_ENTITY',
|
|
16
|
-
entity: {
|
|
17
|
-
id: toBase64(entity.id),
|
|
18
|
-
values: [],
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
it('creates an entity with types', async () => {
|
|
23
|
-
const entity = createEntity({
|
|
24
|
-
types: [CLAIM_TYPE, NEWS_STORY_TYPE],
|
|
25
|
-
});
|
|
26
|
-
expect(entity).toBeDefined();
|
|
27
|
-
expect(typeof entity.id).toBe('string');
|
|
28
|
-
expect(entity.ops).toHaveLength(3); // One UPDATE_ENTITY + two CREATE_RELATION ops
|
|
29
|
-
// Check UPDATE_ENTITY op
|
|
30
|
-
expect(entity.ops[0]).toMatchObject({
|
|
31
|
-
type: 'UPDATE_ENTITY',
|
|
32
|
-
entity: {
|
|
33
|
-
id: toBase64(entity.id),
|
|
34
|
-
values: [],
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
// Check first type relation
|
|
38
|
-
expect(entity.ops[1]).toMatchObject({
|
|
39
|
-
type: 'CREATE_RELATION',
|
|
40
|
-
relation: {
|
|
41
|
-
fromEntity: toBase64(entity.id),
|
|
42
|
-
toEntity: toBase64(CLAIM_TYPE),
|
|
43
|
-
type: toBase64(TYPES_PROPERTY),
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
// Check second type relation
|
|
47
|
-
expect(entity.ops[2]).toMatchObject({
|
|
48
|
-
type: 'CREATE_RELATION',
|
|
49
|
-
relation: {
|
|
50
|
-
fromEntity: toBase64(entity.id),
|
|
51
|
-
toEntity: toBase64(NEWS_STORY_TYPE),
|
|
52
|
-
type: toBase64(TYPES_PROPERTY),
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
it('creates an entity with name and description', async () => {
|
|
57
|
-
const entity = createEntity({
|
|
58
|
-
name: 'Test Entity',
|
|
59
|
-
description: 'Test Description',
|
|
60
|
-
});
|
|
61
|
-
expect(entity).toBeDefined();
|
|
62
|
-
expect(typeof entity.id).toBe('string');
|
|
63
|
-
expect(entity.ops).toHaveLength(1);
|
|
64
|
-
expect(entity.ops[0]).toMatchObject({
|
|
65
|
-
type: 'UPDATE_ENTITY',
|
|
66
|
-
entity: {
|
|
67
|
-
id: toBase64(entity.id),
|
|
68
|
-
values: [
|
|
69
|
-
{
|
|
70
|
-
propertyId: toBase64(NAME_PROPERTY),
|
|
71
|
-
value: 'Test Entity',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
propertyId: toBase64(DESCRIPTION_PROPERTY),
|
|
75
|
-
value: 'Test Description',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
it('creates an entity with cover', async () => {
|
|
82
|
-
const entity = createEntity({
|
|
83
|
-
cover: coverId,
|
|
84
|
-
});
|
|
85
|
-
expect(entity).toBeDefined();
|
|
86
|
-
expect(typeof entity.id).toBe('string');
|
|
87
|
-
expect(entity.ops).toHaveLength(2);
|
|
88
|
-
// Check UPDATE_ENTITY op
|
|
89
|
-
expect(entity.ops[0]).toMatchObject({
|
|
90
|
-
type: 'UPDATE_ENTITY',
|
|
91
|
-
entity: {
|
|
92
|
-
id: toBase64(entity.id),
|
|
93
|
-
values: [],
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
// Check cover relation
|
|
97
|
-
expect(entity.ops[1]).toMatchObject({
|
|
98
|
-
type: 'CREATE_RELATION',
|
|
99
|
-
relation: {
|
|
100
|
-
fromEntity: toBase64(entity.id),
|
|
101
|
-
toEntity: toBase64(coverId),
|
|
102
|
-
type: toBase64(COVER_PROPERTY),
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
it('creates an entity with custom values', async () => {
|
|
107
|
-
const customPropertyId = Id('fa269fd3-de98-49cf-90c4-4235d905a67c');
|
|
108
|
-
const entity = createEntity({
|
|
109
|
-
values: {
|
|
110
|
-
[customPropertyId]: {
|
|
111
|
-
value: 'custom value',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
expect(entity).toBeDefined();
|
|
116
|
-
expect(typeof entity.id).toBe('string');
|
|
117
|
-
expect(entity.ops).toHaveLength(1);
|
|
118
|
-
expect(entity.ops[0]).toMatchObject({
|
|
119
|
-
type: 'UPDATE_ENTITY',
|
|
120
|
-
entity: {
|
|
121
|
-
id: toBase64(entity.id),
|
|
122
|
-
values: [
|
|
123
|
-
{
|
|
124
|
-
propertyId: toBase64(customPropertyId),
|
|
125
|
-
value: 'custom value',
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
it('creates an entity with a provided id', async () => {
|
|
132
|
-
const providedId = Id('b1dc6e5c-63e1-43ba-b3d4-755b251a4ea1');
|
|
133
|
-
const entity = createEntity({
|
|
134
|
-
id: providedId,
|
|
135
|
-
name: 'Test Entity',
|
|
136
|
-
});
|
|
137
|
-
expect(entity).toBeDefined();
|
|
138
|
-
expect(entity.id).toBe(providedId);
|
|
139
|
-
expect(entity.ops).toHaveLength(1);
|
|
140
|
-
expect(entity.ops[0]).toMatchObject({
|
|
141
|
-
type: 'UPDATE_ENTITY',
|
|
142
|
-
entity: {
|
|
143
|
-
id: toBase64(providedId),
|
|
144
|
-
values: [
|
|
145
|
-
{
|
|
146
|
-
propertyId: toBase64(NAME_PROPERTY),
|
|
147
|
-
value: 'Test Entity',
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('throws an error if the provided id is invalid', () => {
|
|
154
|
-
// @ts-expect-error - invalid id type
|
|
155
|
-
expect(() => createEntity({ id: 'invalid' })).toThrow('Invalid id: "invalid" for `id` in `createEntity`');
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
//# sourceMappingURL=create-entity.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.test.js","sourceRoot":"","s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,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,UAAU,GAAG,EAAE,CAAC,sCAAsC,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,YAAY,CAAC;YAC1B,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,aAAa;SACpB,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YAClC,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE;gBACN,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC;gBACxB,MAAM,EAAE;oBACN;wBACE,UAAU,EAAE,QAAQ,CAAC,aAAa,CAAC;wBACnC,KAAK,EAAE,aAAa;qBACrB;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,qCAAqC;QACrC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CreateImageParams, CreateResult } from '../typesv2.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an entity with the given name, description, cover, properties, and types.
|
|
4
|
-
* All IDs passed to this function (cover, types, property IDs, relation IDs, etc.) are validated.
|
|
5
|
-
* If any invalid ID is provided, the function will throw an error.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const { id, ops } = createImage({
|
|
10
|
-
* url: 'https://example.com/image.png',
|
|
11
|
-
* name: 'name of the image', // optional
|
|
12
|
-
* description: 'description of the image', // optional
|
|
13
|
-
* id: imageId, // optional and will be generated if not provided
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* const { id, ops } = createImage({
|
|
17
|
-
* blob: new Blob(…),
|
|
18
|
-
* name: 'name of the image', // optional
|
|
19
|
-
* description: 'description of the image', // optional
|
|
20
|
-
* id: imageId, // optional and will be generated if not provided
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
* @param params – {@link CreateImageParams}
|
|
24
|
-
* @returns – {@link CreateResult}
|
|
25
|
-
* @throws Will throw an IpfsUploadError if the image cannot be uploaded to IPFS
|
|
26
|
-
*/
|
|
27
|
-
export declare const createImage: ({ name, description, id: providedId, ...params }: CreateImageParams) => Promise<CreateResult>;
|
|
28
|
-
//# sourceMappingURL=create-image.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-image.d.ts","sourceRoot":"","sources":["../../../src/graphv2/create-image.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAmB,MAAM,eAAe,CAAC;AAGtF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,GAAU,kDAK/B,iBAAiB,KAAG,OAAO,CAAC,YAAY,CA4C1C,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { IMAGE_HEIGHT_PROPERTY, IMAGE_TYPE, IMAGE_URL_PROPERTY, IMAGE_WIDTH_PROPERTY, TYPES_PROPERTY, } from '../core/idsv2/system.js';
|
|
2
|
-
import { assertValid, generate, toBase64 } from '../idv2.js';
|
|
3
|
-
import { uploadImage } from '../ipfsv2.js';
|
|
4
|
-
import { createEntity } from './create-entity.js';
|
|
5
|
-
/**
|
|
6
|
-
* Creates an entity with the given name, description, cover, properties, and types.
|
|
7
|
-
* All IDs passed to this function (cover, types, property IDs, relation IDs, etc.) are validated.
|
|
8
|
-
* If any invalid ID is provided, the function will throw an error.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const { id, ops } = createImage({
|
|
13
|
-
* url: 'https://example.com/image.png',
|
|
14
|
-
* name: 'name of the image', // optional
|
|
15
|
-
* description: 'description of the image', // optional
|
|
16
|
-
* id: imageId, // optional and will be generated if not provided
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* const { id, ops } = createImage({
|
|
20
|
-
* blob: new Blob(…),
|
|
21
|
-
* name: 'name of the image', // optional
|
|
22
|
-
* description: 'description of the image', // optional
|
|
23
|
-
* id: imageId, // optional and will be generated if not provided
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
* @param params – {@link CreateImageParams}
|
|
27
|
-
* @returns – {@link CreateResult}
|
|
28
|
-
* @throws Will throw an IpfsUploadError if the image cannot be uploaded to IPFS
|
|
29
|
-
*/
|
|
30
|
-
export const createImage = async ({ name, description, id: providedId, ...params }) => {
|
|
31
|
-
if (providedId) {
|
|
32
|
-
assertValid(providedId, '`id` in `createImage`');
|
|
33
|
-
}
|
|
34
|
-
const id = providedId ?? generate();
|
|
35
|
-
const { cid, dimensions } = await uploadImage(params);
|
|
36
|
-
const values = {};
|
|
37
|
-
values[IMAGE_URL_PROPERTY] = {
|
|
38
|
-
value: cid,
|
|
39
|
-
};
|
|
40
|
-
if (dimensions?.height) {
|
|
41
|
-
values[IMAGE_HEIGHT_PROPERTY] = {
|
|
42
|
-
value: dimensions.height.toString(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (dimensions?.width) {
|
|
46
|
-
values[IMAGE_WIDTH_PROPERTY] = {
|
|
47
|
-
value: dimensions.width.toString(),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
const { ops } = createEntity({
|
|
51
|
-
id,
|
|
52
|
-
name,
|
|
53
|
-
description,
|
|
54
|
-
values,
|
|
55
|
-
});
|
|
56
|
-
ops.push({
|
|
57
|
-
type: 'CREATE_RELATION',
|
|
58
|
-
relation: {
|
|
59
|
-
id: toBase64(generate()),
|
|
60
|
-
entity: toBase64(generate()),
|
|
61
|
-
fromEntity: toBase64(id),
|
|
62
|
-
toEntity: toBase64(IMAGE_TYPE),
|
|
63
|
-
type: toBase64(TYPES_PROPERTY),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
id,
|
|
68
|
-
ops,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=create-image.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-image.js","sourceRoot":"","sources":["../../../src/graphv2/create-image.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,EAChC,IAAI,EACJ,WAAW,EACX,EAAE,EAAE,UAAU,EACd,GAAG,MAAM,EACS,EAAyB,EAAE;IAC7C,IAAI,UAAU,EAAE,CAAC;QACf,WAAW,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,EAAE,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;IACpC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAoB,EAAE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