@graphprotocol/grc-20 0.5.2 → 0.5.4
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/package.json +13 -11
- package/dist/abis.d.ts +0 -7
- package/dist/abis.d.ts.map +0 -1
- package/dist/abis.js +0 -7
- package/dist/abis.js.map +0 -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/contracts.d.ts +0 -29
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -29
- package/dist/contracts.js.map +0 -1
- package/dist/index.d.ts +0 -63
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +0 -1
- package/dist/proto.d.ts +0 -15
- package/dist/proto.d.ts.map +0 -1
- package/dist/proto.js +0 -15
- package/dist/proto.js.map +0 -1
- package/dist/src/abis/dao.d.ts +0 -899
- package/dist/src/abis/dao.d.ts.map +0 -1
- package/dist/src/abis/dao.js +0 -1159
- package/dist/src/abis/dao.js.map +0 -1
- package/dist/src/abis/governance-setup.d.ts +0 -351
- package/dist/src/abis/governance-setup.d.ts.map +0 -1
- package/dist/src/abis/governance-setup.js +0 -461
- package/dist/src/abis/governance-setup.js.map +0 -1
- package/dist/src/abis/index.d.ts +0 -10
- package/dist/src/abis/index.d.ts.map +0 -1
- package/dist/src/abis/index.js +0 -10
- package/dist/src/abis/index.js.map +0 -1
- package/dist/src/abis/main-voting.d.ts +0 -1443
- package/dist/src/abis/main-voting.d.ts.map +0 -1
- package/dist/src/abis/main-voting.js +0 -1866
- package/dist/src/abis/main-voting.js.map +0 -1
- package/dist/src/abis/member-access.d.ts +0 -567
- package/dist/src/abis/member-access.d.ts.map +0 -1
- package/dist/src/abis/member-access.js +0 -735
- package/dist/src/abis/member-access.js.map +0 -1
- package/dist/src/abis/personal-space-admin-setup.d.ts +0 -259
- package/dist/src/abis/personal-space-admin-setup.d.ts.map +0 -1
- package/dist/src/abis/personal-space-admin-setup.js +0 -340
- package/dist/src/abis/personal-space-admin-setup.js.map +0 -1
- package/dist/src/abis/personal-space-admin.d.ts +0 -408
- package/dist/src/abis/personal-space-admin.d.ts.map +0 -1
- package/dist/src/abis/personal-space-admin.js +0 -526
- package/dist/src/abis/personal-space-admin.js.map +0 -1
- package/dist/src/abis/plugin-setup-processor.d.ts +0 -998
- package/dist/src/abis/plugin-setup-processor.d.ts.map +0 -1
- package/dist/src/abis/plugin-setup-processor.js +0 -1293
- package/dist/src/abis/plugin-setup-processor.js.map +0 -1
- package/dist/src/abis/space-setup.d.ts +0 -294
- package/dist/src/abis/space-setup.d.ts.map +0 -1
- package/dist/src/abis/space-setup.js +0 -387
- package/dist/src/abis/space-setup.js.map +0 -1
- package/dist/src/abis/space.d.ts +0 -263
- package/dist/src/abis/space.d.ts.map +0 -1
- package/dist/src/abis/space.js +0 -340
- package/dist/src/abis/space.js.map +0 -1
- package/dist/src/account.d.ts +0 -8
- package/dist/src/account.d.ts.map +0 -1
- package/dist/src/account.js +0 -8
- package/dist/src/account.js.map +0 -1
- package/dist/src/blocks.d.ts +0 -22
- package/dist/src/blocks.d.ts.map +0 -1
- package/dist/src/blocks.js +0 -22
- package/dist/src/blocks.js.map +0 -1
- package/dist/src/core/account.d.ts +0 -28
- package/dist/src/core/account.d.ts.map +0 -1
- package/dist/src/core/account.js +0 -70
- package/dist/src/core/account.js.map +0 -1
- package/dist/src/core/account.test.d.ts +0 -2
- package/dist/src/core/account.test.d.ts.map +0 -1
- package/dist/src/core/account.test.js +0 -25
- package/dist/src/core/account.test.js.map +0 -1
- package/dist/src/core/base58.d.ts +0 -43
- package/dist/src/core/base58.d.ts.map +0 -1
- package/dist/src/core/base58.js +0 -68
- package/dist/src/core/base58.js.map +0 -1
- package/dist/src/core/base58.test.d.ts +0 -2
- package/dist/src/core/base58.test.d.ts.map +0 -1
- package/dist/src/core/base58.test.js +0 -17
- package/dist/src/core/base58.test.js.map +0 -1
- package/dist/src/core/blocks/data.d.ts +0 -34
- package/dist/src/core/blocks/data.d.ts.map +0 -1
- package/dist/src/core/blocks/data.js +0 -71
- package/dist/src/core/blocks/data.js.map +0 -1
- package/dist/src/core/blocks/data.test.d.ts +0 -2
- package/dist/src/core/blocks/data.test.d.ts.map +0 -1
- package/dist/src/core/blocks/data.test.js +0 -58
- package/dist/src/core/blocks/data.test.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/blocks/text.d.ts +0 -31
- package/dist/src/core/blocks/text.d.ts.map +0 -1
- package/dist/src/core/blocks/text.js +0 -52
- package/dist/src/core/blocks/text.js.map +0 -1
- package/dist/src/core/blocks/text.test.d.ts +0 -2
- package/dist/src/core/blocks/text.test.d.ts.map +0 -1
- package/dist/src/core/blocks/text.test.js +0 -29
- package/dist/src/core/blocks/text.test.js.map +0 -1
- package/dist/src/core/get-checksum-address.d.ts +0 -10
- package/dist/src/core/get-checksum-address.d.ts.map +0 -1
- package/dist/src/core/get-checksum-address.js +0 -20
- package/dist/src/core/get-checksum-address.js.map +0 -1
- package/dist/src/core/ids/content.d.ts +0 -59
- package/dist/src/core/ids/content.d.ts.map +0 -1
- package/dist/src/core/ids/content.js +0 -59
- package/dist/src/core/ids/content.js.map +0 -1
- package/dist/src/core/ids/network.d.ts +0 -4
- package/dist/src/core/ids/network.d.ts.map +0 -1
- package/dist/src/core/ids/network.js +0 -4
- package/dist/src/core/ids/network.js.map +0 -1
- package/dist/src/core/ids/system.d.ts +0 -212
- package/dist/src/core/ids/system.d.ts.map +0 -1
- package/dist/src/core/ids/system.js +0 -220
- package/dist/src/core/ids/system.js.map +0 -1
- package/dist/src/core/image.d.ts +0 -27
- package/dist/src/core/image.d.ts.map +0 -1
- package/dist/src/core/image.js +0 -47
- 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 -26
- package/dist/src/core/image.test.js.map +0 -1
- package/dist/src/core/position.d.ts +0 -12
- package/dist/src/core/position.d.ts.map +0 -1
- package/dist/src/core/position.js +0 -12
- package/dist/src/core/position.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/scheme.d.ts +0 -78
- package/dist/src/core/scheme.d.ts.map +0 -1
- package/dist/src/core/scheme.js +0 -99
- package/dist/src/core/scheme.js.map +0 -1
- package/dist/src/core/scheme.test.d.ts +0 -2
- package/dist/src/core/scheme.test.d.ts.map +0 -1
- package/dist/src/core/scheme.test.js +0 -34
- package/dist/src/core/scheme.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/encodings/get-accept-editor-arguments.d.ts +0 -11
- package/dist/src/encodings/get-accept-editor-arguments.d.ts.map +0 -1
- package/dist/src/encodings/get-accept-editor-arguments.js +0 -23
- package/dist/src/encodings/get-accept-editor-arguments.js.map +0 -1
- package/dist/src/encodings/get-accept-subspace-arguments.d.ts +0 -11
- package/dist/src/encodings/get-accept-subspace-arguments.d.ts.map +0 -1
- package/dist/src/encodings/get-accept-subspace-arguments.js +0 -23
- package/dist/src/encodings/get-accept-subspace-arguments.js.map +0 -1
- package/dist/src/encodings/get-calldata-for-space-governance-type.d.ts +0 -8
- package/dist/src/encodings/get-calldata-for-space-governance-type.d.ts.map +0 -1
- package/dist/src/encodings/get-calldata-for-space-governance-type.js +0 -19
- package/dist/src/encodings/get-calldata-for-space-governance-type.js.map +0 -1
- package/dist/src/encodings/get-process-geo-proposal-arguments.d.ts +0 -7
- package/dist/src/encodings/get-process-geo-proposal-arguments.d.ts.map +0 -1
- package/dist/src/encodings/get-process-geo-proposal-arguments.js +0 -23
- package/dist/src/encodings/get-process-geo-proposal-arguments.js.map +0 -1
- package/dist/src/encodings/get-remove-editor-arguments.d.ts +0 -11
- package/dist/src/encodings/get-remove-editor-arguments.d.ts.map +0 -1
- package/dist/src/encodings/get-remove-editor-arguments.js +0 -23
- package/dist/src/encodings/get-remove-editor-arguments.js.map +0 -1
- package/dist/src/encodings/get-remove-subspace-arguments.d.ts +0 -11
- package/dist/src/encodings/get-remove-subspace-arguments.d.ts.map +0 -1
- package/dist/src/encodings/get-remove-subspace-arguments.js +0 -23
- package/dist/src/encodings/get-remove-subspace-arguments.js.map +0 -1
- package/dist/src/encodings/index.d.ts +0 -7
- package/dist/src/encodings/index.d.ts.map +0 -1
- package/dist/src/encodings/index.js +0 -7
- package/dist/src/encodings/index.js.map +0 -1
- package/dist/src/id.d.ts +0 -21
- package/dist/src/id.d.ts.map +0 -1
- package/dist/src/id.js +0 -36
- package/dist/src/id.js.map +0 -1
- package/dist/src/id.test.d.ts +0 -2
- package/dist/src/id.test.d.ts.map +0 -1
- package/dist/src/id.test.js +0 -11
- package/dist/src/id.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/ipfs.d.ts +0 -32
- package/dist/src/ipfs.d.ts.map +0 -1
- package/dist/src/ipfs.js +0 -58
- package/dist/src/ipfs.js.map +0 -1
- package/dist/src/position.d.ts +0 -7
- package/dist/src/position.d.ts.map +0 -1
- package/dist/src/position.js +0 -7
- package/dist/src/position.js.map +0 -1
- package/dist/src/proto/edit.d.ts +0 -9
- package/dist/src/proto/edit.d.ts.map +0 -1
- package/dist/src/proto/edit.js +0 -54
- package/dist/src/proto/edit.js.map +0 -1
- package/dist/src/proto/edit.test.d.ts +0 -2
- package/dist/src/proto/edit.test.d.ts.map +0 -1
- package/dist/src/proto/edit.test.js +0 -140
- package/dist/src/proto/edit.test.js.map +0 -1
- package/dist/src/proto/gen/src/proto/ipfs_pb.d.ts +0 -404
- package/dist/src/proto/gen/src/proto/ipfs_pb.d.ts.map +0 -1
- package/dist/src/proto/gen/src/proto/ipfs_pb.js +0 -602
- package/dist/src/proto/gen/src/proto/ipfs_pb.js.map +0 -1
- package/dist/src/proto/index.d.ts +0 -2
- package/dist/src/proto/index.d.ts.map +0 -1
- package/dist/src/proto/index.js +0 -2
- package/dist/src/proto/index.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/scheme.d.ts +0 -7
- package/dist/src/scheme.d.ts.map +0 -1
- package/dist/src/scheme.js +0 -7
- package/dist/src/scheme.js.map +0 -1
- package/dist/src/system-ids.d.ts +0 -9
- package/dist/src/system-ids.d.ts.map +0 -1
- package/dist/src/system-ids.js +0 -9
- package/dist/src/system-ids.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.d.ts +0 -86
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -13
- package/dist/src/types.js.map +0 -1
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Relations in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
import { SYSTEM_IDS } from '../system-ids.js';
|
|
7
|
-
import type { CreateRelationOp, DeleteRelationOp } from '../types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Arguments for creating a new Relation.
|
|
10
|
-
*
|
|
11
|
-
* @param relationId - optional base58 encoded v4 uuid
|
|
12
|
-
* @param fromId - base58 encoded v4 uuid
|
|
13
|
-
* @param toId - base58 encoded v4 uuid
|
|
14
|
-
* @param relationTypeId - base58 encoded v4 uuid
|
|
15
|
-
* @param position - optional fractional index using position-strings
|
|
16
|
-
*/
|
|
17
|
-
type CreateRelationArgs = {
|
|
18
|
-
relationId?: string;
|
|
19
|
-
fromId: string;
|
|
20
|
-
toId: string;
|
|
21
|
-
relationTypeId: string;
|
|
22
|
-
position?: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Generates ops for a new Relation.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* const ops = Relation.make({
|
|
30
|
-
* fromId: 'from-id',
|
|
31
|
-
* toId: 'to-id',
|
|
32
|
-
* relationTypeId: 'relation-type-id',
|
|
33
|
-
* // optional
|
|
34
|
-
* relationId: 'relation-id',
|
|
35
|
-
* position: 'position-string',
|
|
36
|
-
* });
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @param args {@link CreateRelationArgs}
|
|
40
|
-
* @returns – {@link CreateRelationOp}
|
|
41
|
-
*/
|
|
42
|
-
export declare function make(args: CreateRelationArgs): CreateRelationOp;
|
|
43
|
-
/**
|
|
44
|
-
* Generates ops for deleting a Relation.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const op = Relation.remove('relation-id');
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param relationId – base58 encoded v4 uuid representing the relation's entity id
|
|
52
|
-
* @returns – {@link DeleteRelationOp}
|
|
53
|
-
*/
|
|
54
|
-
export declare function remove(relationId: string): DeleteRelationOp;
|
|
55
|
-
type ReorderRelationArgs = {
|
|
56
|
-
relationId: string;
|
|
57
|
-
beforeIndex?: string;
|
|
58
|
-
afterIndex?: string;
|
|
59
|
-
};
|
|
60
|
-
type ReorderRelationOp = {
|
|
61
|
-
type: 'SET_TRIPLE';
|
|
62
|
-
triple: {
|
|
63
|
-
attribute: typeof SYSTEM_IDS.RELATION_INDEX;
|
|
64
|
-
entity: string;
|
|
65
|
-
value: {
|
|
66
|
-
type: 'TEXT';
|
|
67
|
-
value: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Generates op for reordering a Relation using position-strings
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* const op = Relation.reorder({
|
|
77
|
-
* relationId: 'relation-id',
|
|
78
|
-
* beforeIndex: 'before-position',
|
|
79
|
-
* afterIndex: 'after-position',
|
|
80
|
-
* });
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @param args {@link ReorderRelationArgs}
|
|
84
|
-
* @returns – {@link ReorderRelationOp}
|
|
85
|
-
*/
|
|
86
|
-
export declare function reorder(args: ReorderRelationArgs): ReorderRelationOp;
|
|
87
|
-
export {};
|
|
88
|
-
//# sourceMappingURL=relation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../../src/core/relation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGtE;;;;;;;;GAQG;AACH,KAAK,kBAAkB,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,kBAAkB,GAAG,gBAAgB,CAa/D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAO3D;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,UAAU,CAAC,cAAc,CAAC;QAC5C,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CAcpE"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Relations in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
import { INITIAL_RELATION_INDEX_VALUE } from '../../constants.js';
|
|
7
|
-
import { generate } from '../id.js';
|
|
8
|
-
import { SYSTEM_IDS } from '../system-ids.js';
|
|
9
|
-
import { Position } from './position.js';
|
|
10
|
-
/**
|
|
11
|
-
* Generates ops for a new Relation.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const ops = Relation.make({
|
|
16
|
-
* fromId: 'from-id',
|
|
17
|
-
* toId: 'to-id',
|
|
18
|
-
* relationTypeId: 'relation-type-id',
|
|
19
|
-
* // optional
|
|
20
|
-
* relationId: 'relation-id',
|
|
21
|
-
* position: 'position-string',
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @param args {@link CreateRelationArgs}
|
|
26
|
-
* @returns – {@link CreateRelationOp}
|
|
27
|
-
*/
|
|
28
|
-
export function make(args) {
|
|
29
|
-
const newEntityId = args.relationId ?? generate();
|
|
30
|
-
return {
|
|
31
|
-
type: 'CREATE_RELATION',
|
|
32
|
-
relation: {
|
|
33
|
-
id: newEntityId,
|
|
34
|
-
type: args.relationTypeId,
|
|
35
|
-
fromEntity: args.fromId,
|
|
36
|
-
toEntity: args.toId,
|
|
37
|
-
index: args.position ?? INITIAL_RELATION_INDEX_VALUE,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generates ops for deleting a Relation.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* const op = Relation.remove('relation-id');
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @param relationId – base58 encoded v4 uuid representing the relation's entity id
|
|
50
|
-
* @returns – {@link DeleteRelationOp}
|
|
51
|
-
*/
|
|
52
|
-
export function remove(relationId) {
|
|
53
|
-
return {
|
|
54
|
-
type: 'DELETE_RELATION',
|
|
55
|
-
relation: {
|
|
56
|
-
id: relationId,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Generates op for reordering a Relation using position-strings
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* const op = Relation.reorder({
|
|
66
|
-
* relationId: 'relation-id',
|
|
67
|
-
* beforeIndex: 'before-position',
|
|
68
|
-
* afterIndex: 'after-position',
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @param args {@link ReorderRelationArgs}
|
|
73
|
-
* @returns – {@link ReorderRelationOp}
|
|
74
|
-
*/
|
|
75
|
-
export function reorder(args) {
|
|
76
|
-
const newIndex = Position.createBetween(args.beforeIndex, args.afterIndex);
|
|
77
|
-
return {
|
|
78
|
-
type: 'SET_TRIPLE',
|
|
79
|
-
triple: {
|
|
80
|
-
attribute: SYSTEM_IDS.RELATION_INDEX,
|
|
81
|
-
entity: args.relationId,
|
|
82
|
-
value: {
|
|
83
|
-
type: 'TEXT',
|
|
84
|
-
value: newIndex,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=relation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../../src/core/relation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAmBzC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,IAAI,CAAC,IAAwB;IAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,IAAI,QAAQ,EAAE,CAAC;IAElD,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE;YACR,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,IAAI,CAAC,cAAc;YACzB,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,KAAK,EAAE,IAAI,CAAC,QAAQ,IAAI,4BAA4B;SACrD;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,UAAkB;IACvC,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE;YACR,EAAE,EAAE,UAAU;SACf;KACF,CAAC;AACJ,CAAC;AAoBD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,IAAyB;IAC/C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAE3E,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE;YACN,SAAS,EAAE,UAAU,CAAC,cAAc;YACpC,MAAM,EAAE,IAAI,CAAC,UAAU;YACvB,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,QAAQ;aAChB;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relation.test.d.ts","sourceRoot":"","sources":["../../../src/core/relation.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { expect, it } from 'vitest';
|
|
2
|
-
import { make, remove, reorder } from './relation.js';
|
|
3
|
-
import { Position, PositionRange } from './position.js';
|
|
4
|
-
import { RELATION_INDEX } from './ids/system.js';
|
|
5
|
-
it('should generate CreateRelationOp for CREATE_RELATION', () => {
|
|
6
|
-
const op = make({
|
|
7
|
-
relationId: 'test-relation-id',
|
|
8
|
-
fromId: 'test-entity-id',
|
|
9
|
-
relationTypeId: 'test-relation-type-id',
|
|
10
|
-
toId: 'test-entity-id',
|
|
11
|
-
position: 'test-position',
|
|
12
|
-
});
|
|
13
|
-
expect(op).toEqual({
|
|
14
|
-
type: 'CREATE_RELATION',
|
|
15
|
-
relation: {
|
|
16
|
-
id: 'test-relation-id',
|
|
17
|
-
type: 'test-relation-type-id',
|
|
18
|
-
fromEntity: 'test-entity-id',
|
|
19
|
-
toEntity: 'test-entity-id',
|
|
20
|
-
index: 'test-position',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
it('should generate DeleteRelationOp for DELETE_RELATION', () => {
|
|
25
|
-
const op = remove('test-relation-id');
|
|
26
|
-
expect(op).toEqual({
|
|
27
|
-
type: 'DELETE_RELATION',
|
|
28
|
-
relation: {
|
|
29
|
-
id: 'test-relation-id',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
it('should generate Op that places the fractional indexer between the two provided values', () => {
|
|
34
|
-
const op = reorder({
|
|
35
|
-
relationId: 'test-relation-id',
|
|
36
|
-
beforeIndex: PositionRange.FIRST,
|
|
37
|
-
afterIndex: PositionRange.LAST,
|
|
38
|
-
});
|
|
39
|
-
expect(op.type).toBe('SET_TRIPLE');
|
|
40
|
-
expect(op.triple.attribute).toBe(RELATION_INDEX);
|
|
41
|
-
expect(op.triple.entity).toBe('test-relation-id');
|
|
42
|
-
expect(op.triple.value.type).toBe('TEXT');
|
|
43
|
-
// @TODO how do we test that the resulting value is in-between the two indexes?
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=relation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relation.test.js","sourceRoot":"","sources":["../../../src/core/relation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAC9D,MAAM,EAAE,GAAG,IAAI,CAAC;QACd,UAAU,EAAE,kBAAkB;QAC9B,MAAM,EAAE,gBAAgB;QACxB,cAAc,EAAE,uBAAuB;QACvC,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,eAAe;KAC1B,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE;YACR,EAAE,EAAE,kBAAkB;YACtB,IAAI,EAAE,uBAAuB;YAC7B,UAAU,EAAE,gBAAgB;YAC5B,QAAQ,EAAE,gBAAgB;YAC1B,KAAK,EAAE,eAAe;SACvB;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAC9D,MAAM,EAAE,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEtC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE;YACR,EAAE,EAAE,kBAAkB;SACvB;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE;IAC/F,MAAM,EAAE,GAAG,OAAO,CAAC;QACjB,UAAU,EAAE,kBAAkB;QAC9B,WAAW,EAAE,aAAa,CAAC,KAAK;QAChC,UAAU,EAAE,aAAa,CAAC,IAAI;KAC/B,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,+EAA+E;AACjF,CAAC,CAAC,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Graph URIs in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
type GraphUri = `graph://${string}`;
|
|
7
|
-
type SchemeQueryParams = {
|
|
8
|
-
spaceId?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Encodes an entity id into a Graph URI. Optionally, you can specify a space id to be included in the URI.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const uri = GraphUrl.fromEntityId('entity-id');
|
|
16
|
-
* console.log(uri); // graph://entity-id
|
|
17
|
-
*
|
|
18
|
-
* const uriWithSpaceId = GraphUrl.fromEntityId('entity-id', { spaceId: 'space-id' });
|
|
19
|
-
* console.log(uriWithSpaceId); // graph://entity-id?s=space-id
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @param entityId base58 encoded v4 uuid
|
|
23
|
-
* @param params optional params: {@link SchemeQueryParams}
|
|
24
|
-
* @returns Graph URI: {@link GraphUri}
|
|
25
|
-
*/
|
|
26
|
-
export declare function fromEntityId(entityId: string, params?: SchemeQueryParams): GraphUri;
|
|
27
|
-
/**
|
|
28
|
-
* Returns true if the provided value is a valid Graph URI.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const shouldBeTrue = GraphUrl.isValid('graph://entity-id');
|
|
33
|
-
* console.log(shouldBeTrue); // true
|
|
34
|
-
*
|
|
35
|
-
* const shouldBeFalse = GraphUrl.isValid('entity-id');
|
|
36
|
-
* console.log(shouldBeFalse); // false
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @param value – Graph URI: {@link GraphUri}
|
|
40
|
-
* @returns – `true` if the value is a valid Graph URI, `false` otherwise
|
|
41
|
-
*/
|
|
42
|
-
export declare function isValid(value: string): value is GraphUri;
|
|
43
|
-
/**
|
|
44
|
-
* Decodes the entity id from a Graph URI. Throws an error if the URI is not valid.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const entityId = GraphUrl.toEntityId('graph://entity-id');
|
|
49
|
-
* console.log(entityId); // entity-id
|
|
50
|
-
*
|
|
51
|
-
* const entityIdWithSpaceId = GraphUrl.toEntityId('graph://entity-id?s=space-id');
|
|
52
|
-
* console.log(entityIdWithSpaceId); // entity-id
|
|
53
|
-
*
|
|
54
|
-
* const entityId = GraphUrl.toEntityId('invalid-uri'); // throws
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @param uri – Graph URI: {@link GraphUri}
|
|
58
|
-
* @returns – base58 encoded v4 uuid representing an entity
|
|
59
|
-
* @throws Error if the URI is not valid
|
|
60
|
-
*/
|
|
61
|
-
export declare function toEntityId(uri: GraphUri): string;
|
|
62
|
-
/**
|
|
63
|
-
* Decodes the space id from a Graph URI. Throws an error if the URI is not valid.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* const spaceId = GraphUrl.toSpaceId('graph://entity-id?s=space-id');
|
|
68
|
-
* console.log(spaceId); // space-id
|
|
69
|
-
*
|
|
70
|
-
* const spaceId = GraphUrl.toSpaceId('graph://entity-id'); // throws
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @param uri – Graph URI: {@link GraphUri}
|
|
74
|
-
* @returns – base58 encoded v4 uuid representing a space
|
|
75
|
-
*/
|
|
76
|
-
export declare function toSpaceId(uri: GraphUri): string | null;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=scheme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.d.ts","sourceRoot":"","sources":["../../../src/core/scheme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,QAAQ,GAAG,WAAW,MAAM,EAAE,CAAC;AAEpC,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,iBAAsB,GAAG,QAAQ,CAYvF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAExD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAQhD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAStD"}
|
package/dist/src/core/scheme.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Graph URIs in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
const SPACE_SEARCH_PARAM = 's';
|
|
7
|
-
const SCHEME_PREFIX = 'graph';
|
|
8
|
-
/**
|
|
9
|
-
* Encodes an entity id into a Graph URI. Optionally, you can specify a space id to be included in the URI.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const uri = GraphUrl.fromEntityId('entity-id');
|
|
14
|
-
* console.log(uri); // graph://entity-id
|
|
15
|
-
*
|
|
16
|
-
* const uriWithSpaceId = GraphUrl.fromEntityId('entity-id', { spaceId: 'space-id' });
|
|
17
|
-
* console.log(uriWithSpaceId); // graph://entity-id?s=space-id
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @param entityId base58 encoded v4 uuid
|
|
21
|
-
* @param params optional params: {@link SchemeQueryParams}
|
|
22
|
-
* @returns Graph URI: {@link GraphUri}
|
|
23
|
-
*/
|
|
24
|
-
export function fromEntityId(entityId, params = {}) {
|
|
25
|
-
if (isValid(entityId)) {
|
|
26
|
-
throw new Error(`The passed in entityId should not start with ${SCHEME_PREFIX}://`);
|
|
27
|
-
}
|
|
28
|
-
let uri = `${SCHEME_PREFIX}://${entityId}`;
|
|
29
|
-
if (params.spaceId) {
|
|
30
|
-
uri = `${uri}?${SPACE_SEARCH_PARAM}=${params.spaceId}`;
|
|
31
|
-
}
|
|
32
|
-
return uri;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns true if the provided value is a valid Graph URI.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* const shouldBeTrue = GraphUrl.isValid('graph://entity-id');
|
|
40
|
-
* console.log(shouldBeTrue); // true
|
|
41
|
-
*
|
|
42
|
-
* const shouldBeFalse = GraphUrl.isValid('entity-id');
|
|
43
|
-
* console.log(shouldBeFalse); // false
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @param value – Graph URI: {@link GraphUri}
|
|
47
|
-
* @returns – `true` if the value is a valid Graph URI, `false` otherwise
|
|
48
|
-
*/
|
|
49
|
-
export function isValid(value) {
|
|
50
|
-
return value.startsWith(`${SCHEME_PREFIX}://`);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Decodes the entity id from a Graph URI. Throws an error if the URI is not valid.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* const entityId = GraphUrl.toEntityId('graph://entity-id');
|
|
58
|
-
* console.log(entityId); // entity-id
|
|
59
|
-
*
|
|
60
|
-
* const entityIdWithSpaceId = GraphUrl.toEntityId('graph://entity-id?s=space-id');
|
|
61
|
-
* console.log(entityIdWithSpaceId); // entity-id
|
|
62
|
-
*
|
|
63
|
-
* const entityId = GraphUrl.toEntityId('invalid-uri'); // throws
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @param uri – Graph URI: {@link GraphUri}
|
|
67
|
-
* @returns – base58 encoded v4 uuid representing an entity
|
|
68
|
-
* @throws Error if the URI is not valid
|
|
69
|
-
*/
|
|
70
|
-
export function toEntityId(uri) {
|
|
71
|
-
const entity = uri.split(`${SCHEME_PREFIX}://`)?.[1]?.split('?')[0];
|
|
72
|
-
if (!entity) {
|
|
73
|
-
throw new Error(`Could not parse entity id from provided URI: ${uri}`);
|
|
74
|
-
}
|
|
75
|
-
return entity;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Decodes the space id from a Graph URI. Throws an error if the URI is not valid.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* const spaceId = GraphUrl.toSpaceId('graph://entity-id?s=space-id');
|
|
83
|
-
* console.log(spaceId); // space-id
|
|
84
|
-
*
|
|
85
|
-
* const spaceId = GraphUrl.toSpaceId('graph://entity-id'); // throws
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* @param uri – Graph URI: {@link GraphUri}
|
|
89
|
-
* @returns – base58 encoded v4 uuid representing a space
|
|
90
|
-
*/
|
|
91
|
-
export function toSpaceId(uri) {
|
|
92
|
-
const url = new URL(uri);
|
|
93
|
-
const searchParams = url.searchParams;
|
|
94
|
-
if (!searchParams.has(SPACE_SEARCH_PARAM)) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return searchParams.get(SPACE_SEARCH_PARAM);
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=scheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.js","sourceRoot":"","sources":["../../../src/core/scheme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,SAA4B,EAAE;IAC3E,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gDAAgD,aAAa,KAAK,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,GAAG,GAAa,GAAG,aAAa,MAAM,QAAQ,EAAE,CAAC;IAErD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,GAAG,GAAG,GAAG,GAAG,IAAI,kBAAkB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,aAAa,KAAK,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAa;IACtC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,gDAAgD,GAAG,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,GAAa;IACrC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAEtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAW,CAAC;AACxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.test.d.ts","sourceRoot":"","sources":["../../../src/core/scheme.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { fromEntityId, toEntityId, toSpaceId } from './scheme.js';
|
|
3
|
-
describe('fromEntityId', () => {
|
|
4
|
-
it('should return a valid graph uri', () => {
|
|
5
|
-
const uri = fromEntityId('test-entity-id');
|
|
6
|
-
expect(uri).toBe('graph://test-entity-id');
|
|
7
|
-
});
|
|
8
|
-
it('should return a valid graph uri with space id', () => {
|
|
9
|
-
const uri = fromEntityId('test-entity-id', { spaceId: 'test-space-id' });
|
|
10
|
-
expect(uri).toBe('graph://test-entity-id?s=test-space-id');
|
|
11
|
-
});
|
|
12
|
-
it('should throw error if entity id starts with graph://', () => {
|
|
13
|
-
expect(() => fromEntityId('graph://test-entity-id')).toThrowError();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
describe('toEntityId', () => {
|
|
17
|
-
it('should return the entity id', () => {
|
|
18
|
-
const entityId = toEntityId('graph://test-entity-id');
|
|
19
|
-
expect(entityId).toBe('test-entity-id');
|
|
20
|
-
});
|
|
21
|
-
it('should throw error if entity id is not valid', () => {
|
|
22
|
-
expect(() => toEntityId('invalid id')).toThrowError();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
describe('toSpaceId', () => {
|
|
26
|
-
it('should return the space id', () => {
|
|
27
|
-
const spaceId = toSpaceId('graph://test-entity-id?s=test-space-id');
|
|
28
|
-
expect(spaceId).toBe('test-space-id');
|
|
29
|
-
});
|
|
30
|
-
it('should return null if space id is not present', () => {
|
|
31
|
-
expect(toSpaceId('graph://test-entity-id')).toBe(null);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=scheme.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.test.js","sourceRoot":"","sources":["../../../src/core/scheme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGlE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,GAAG,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,GAAG,YAAY,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;QACzE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,QAAQ,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAC;QACtD,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,YAAwB,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,SAAS,CAAC,wCAAwC,CAAC,CAAC;QACpE,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Triples in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
import type { DeleteTripleOp, SetTripleOp, Value } from '../types.js';
|
|
7
|
-
type CreateTripleArgs = {
|
|
8
|
-
attributeId: string;
|
|
9
|
-
entityId: string;
|
|
10
|
-
value: Value;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Generates op for creating a new Triple.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const op = Triple.make({
|
|
18
|
-
* attributeId: 'attribute-id',
|
|
19
|
-
* entityId: 'entity-id',
|
|
20
|
-
* value: {
|
|
21
|
-
* type: 'TEXT',
|
|
22
|
-
* value: 'value',
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
* @param args – {@link CreateTripleArgs}
|
|
27
|
-
* @returns – {@link SetTripleOp}
|
|
28
|
-
*/
|
|
29
|
-
export declare function make(args: CreateTripleArgs): SetTripleOp;
|
|
30
|
-
type DeleteTripleArgs = {
|
|
31
|
-
attributeId: string;
|
|
32
|
-
entityId: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Generates op for deleting a Triple.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* const op = Triple.remove({
|
|
40
|
-
* attributeId: 'attribute-id',
|
|
41
|
-
* entityId: 'entity-id',
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @param args – {@link DeleteTripleArgs}
|
|
46
|
-
* @returns – {@link DeleteTripleOp}
|
|
47
|
-
*/
|
|
48
|
-
export declare function remove(args: DeleteTripleArgs): DeleteTripleOp;
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=triple.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triple.d.ts","sourceRoot":"","sources":["../../../src/core/triple.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEtE,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,CASxD;AAED,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,cAAc,CAQ7D"}
|
package/dist/src/core/triple.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides utility functions for working with Triples in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* @since 0.0.6
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Generates op for creating a new Triple.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const op = Triple.make({
|
|
12
|
-
* attributeId: 'attribute-id',
|
|
13
|
-
* entityId: 'entity-id',
|
|
14
|
-
* value: {
|
|
15
|
-
* type: 'TEXT',
|
|
16
|
-
* value: 'value',
|
|
17
|
-
* },
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
* @param args – {@link CreateTripleArgs}
|
|
21
|
-
* @returns – {@link SetTripleOp}
|
|
22
|
-
*/
|
|
23
|
-
export function make(args) {
|
|
24
|
-
return {
|
|
25
|
-
type: 'SET_TRIPLE',
|
|
26
|
-
triple: {
|
|
27
|
-
attribute: args.attributeId,
|
|
28
|
-
entity: args.entityId,
|
|
29
|
-
value: args.value,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Generates op for deleting a Triple.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* const op = Triple.remove({
|
|
39
|
-
* attributeId: 'attribute-id',
|
|
40
|
-
* entityId: 'entity-id',
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @param args – {@link DeleteTripleArgs}
|
|
45
|
-
* @returns – {@link DeleteTripleOp}
|
|
46
|
-
*/
|
|
47
|
-
export function remove(args) {
|
|
48
|
-
return {
|
|
49
|
-
type: 'DELETE_TRIPLE',
|
|
50
|
-
triple: {
|
|
51
|
-
attribute: args.attributeId,
|
|
52
|
-
entity: args.entityId,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=triple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triple.js","sourceRoot":"","sources":["../../../src/core/triple.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,IAAI,CAAC,IAAsB;IACzC,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE;YACN,SAAS,EAAE,IAAI,CAAC,WAAW;YAC3B,MAAM,EAAE,IAAI,CAAC,QAAQ;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC;AACJ,CAAC;AAOD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAAC,IAAsB;IAC3C,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE;YACN,SAAS,EAAE,IAAI,CAAC,WAAW;YAC3B,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triple.test.d.ts","sourceRoot":"","sources":["../../../src/core/triple.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { expect, it } from 'vitest';
|
|
2
|
-
import { make, remove } from './triple.js';
|
|
3
|
-
it('should generate SetTripleOp for SET_TRIPLE', () => {
|
|
4
|
-
const op = make({
|
|
5
|
-
attributeId: 'test-attribute-id',
|
|
6
|
-
entityId: 'test-entity-id',
|
|
7
|
-
value: {
|
|
8
|
-
type: 'TEXT',
|
|
9
|
-
value: 'test value',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
expect(op).toEqual({
|
|
13
|
-
type: 'SET_TRIPLE',
|
|
14
|
-
triple: {
|
|
15
|
-
attribute: 'test-attribute-id',
|
|
16
|
-
entity: 'test-entity-id',
|
|
17
|
-
value: {
|
|
18
|
-
type: 'TEXT',
|
|
19
|
-
value: 'test value',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
it('should generate DeleteTripleOp for DELETE_TRIPLE', () => {
|
|
25
|
-
const op = remove({
|
|
26
|
-
attributeId: 'test-attribute-id',
|
|
27
|
-
entityId: 'test-entity-id',
|
|
28
|
-
});
|
|
29
|
-
expect(op).toEqual({
|
|
30
|
-
type: 'DELETE_TRIPLE',
|
|
31
|
-
triple: {
|
|
32
|
-
attribute: 'test-attribute-id',
|
|
33
|
-
entity: 'test-entity-id',
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=triple.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triple.test.js","sourceRoot":"","sources":["../../../src/core/triple.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE3C,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACpD,MAAM,EAAE,GAAG,IAAI,CAAC;QACd,WAAW,EAAE,mBAAmB;QAChC,QAAQ,EAAE,gBAAgB;QAC1B,KAAK,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,YAAY;SACpB;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE;YACN,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,gBAAgB;YACxB,KAAK,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,YAAY;aACpB;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC1D,MAAM,EAAE,GAAG,MAAM,CAAC;QAChB,WAAW,EAAE,mBAAmB;QAChC,QAAQ,EAAE,gBAAgB;KAC3B,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE;YACN,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,gBAAgB;SACzB;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VoteOption } from '../types.js';
|
|
2
|
-
export declare function getAcceptEditorArguments({ votingPluginAddress, ipfsUri, editorAddress, }: {
|
|
3
|
-
votingPluginAddress: `0x${string}`;
|
|
4
|
-
ipfsUri: `ipfs://${string}`;
|
|
5
|
-
editorAddress: `0x${string}`;
|
|
6
|
-
}): readonly [`0x${string}`, readonly [{
|
|
7
|
-
readonly to: `0x${string}`;
|
|
8
|
-
readonly value: bigint;
|
|
9
|
-
readonly data: `0x${string}`;
|
|
10
|
-
}], bigint, VoteOption.None, true];
|
|
11
|
-
//# sourceMappingURL=get-accept-editor-arguments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-accept-editor-arguments.d.ts","sourceRoot":"","sources":["../../../src/encodings/get-accept-editor-arguments.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,wBAAgB,wBAAwB,CAAC,EACvC,mBAAmB,EACnB,OAAO,EACP,aAAa,GACd,EAAE;IACD,mBAAmB,EAAE,KAAK,MAAM,EAAE,CAAC;IACnC,OAAO,EAAE,UAAU,MAAM,EAAE,CAAC;IAC5B,aAAa,EAAE,KAAK,MAAM,EAAE,CAAC;CAC9B;;;;mCAkBA"}
|