@graphprotocol/grc-20 0.31.1 → 0.32.1

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.
Files changed (116) hide show
  1. package/dist/examples/ranks/create-ordinal-rank.js +4 -4
  2. package/dist/examples/ranks/create-ordinal-rank.js.map +1 -1
  3. package/dist/examples/ranks/create-weighted-rank.js +4 -4
  4. package/dist/examples/ranks/create-weighted-rank.js.map +1 -1
  5. package/dist/proto.d.ts +4 -8
  6. package/dist/proto.d.ts.map +1 -1
  7. package/dist/proto.js +4 -8
  8. package/dist/proto.js.map +1 -1
  9. package/dist/scripts/setup-rank-types.d.ts +2 -2
  10. package/dist/scripts/setup-rank-types.d.ts.map +1 -1
  11. package/dist/scripts/setup-rank-types.js.map +1 -1
  12. package/dist/src/codec/convert.d.ts +18 -0
  13. package/dist/src/codec/convert.d.ts.map +1 -0
  14. package/dist/src/codec/convert.js +188 -0
  15. package/dist/src/codec/convert.js.map +1 -0
  16. package/dist/src/core/account.d.ts +2 -2
  17. package/dist/src/core/account.d.ts.map +1 -1
  18. package/dist/src/core/account.js +2 -0
  19. package/dist/src/core/account.js.map +1 -1
  20. package/dist/src/core/account.test.js +69 -22
  21. package/dist/src/core/account.test.js.map +1 -1
  22. package/dist/src/core/blocks/data.d.ts +3 -3
  23. package/dist/src/core/blocks/data.d.ts.map +1 -1
  24. package/dist/src/core/blocks/data.js +2 -1
  25. package/dist/src/core/blocks/data.js.map +1 -1
  26. package/dist/src/core/blocks/data.test.js +74 -36
  27. package/dist/src/core/blocks/data.test.js.map +1 -1
  28. package/dist/src/core/blocks/text.d.ts +3 -3
  29. package/dist/src/core/blocks/text.d.ts.map +1 -1
  30. package/dist/src/core/blocks/text.js +2 -1
  31. package/dist/src/core/blocks/text.js.map +1 -1
  32. package/dist/src/core/blocks/text.test.js +79 -15
  33. package/dist/src/core/blocks/text.test.js.map +1 -1
  34. package/dist/src/encoding.test.d.ts +2 -0
  35. package/dist/src/encoding.test.d.ts.map +1 -0
  36. package/dist/src/encoding.test.js +644 -0
  37. package/dist/src/encoding.test.js.map +1 -0
  38. package/dist/src/full-flow-test.test.js +125 -37
  39. package/dist/src/full-flow-test.test.js.map +1 -1
  40. package/dist/src/graph/constants.d.ts +2 -1
  41. package/dist/src/graph/constants.d.ts.map +1 -1
  42. package/dist/src/graph/constants.js +4 -0
  43. package/dist/src/graph/constants.js.map +1 -1
  44. package/dist/src/graph/create-entity.d.ts +0 -1
  45. package/dist/src/graph/create-entity.d.ts.map +1 -1
  46. package/dist/src/graph/create-entity.js +155 -111
  47. package/dist/src/graph/create-entity.js.map +1 -1
  48. package/dist/src/graph/create-entity.test.js +339 -206
  49. package/dist/src/graph/create-entity.test.js.map +1 -1
  50. package/dist/src/graph/create-image.d.ts.map +1 -1
  51. package/dist/src/graph/create-image.js +14 -13
  52. package/dist/src/graph/create-image.js.map +1 -1
  53. package/dist/src/graph/create-image.test.js +109 -50
  54. package/dist/src/graph/create-image.test.js.map +1 -1
  55. package/dist/src/graph/create-property.d.ts.map +1 -1
  56. package/dist/src/graph/create-property.js +10 -19
  57. package/dist/src/graph/create-property.js.map +1 -1
  58. package/dist/src/graph/create-property.test.js +129 -19
  59. package/dist/src/graph/create-property.test.js.map +1 -1
  60. package/dist/src/graph/create-relation.d.ts +1 -3
  61. package/dist/src/graph/create-relation.d.ts.map +1 -1
  62. package/dist/src/graph/create-relation.js +21 -37
  63. package/dist/src/graph/create-relation.js.map +1 -1
  64. package/dist/src/graph/create-relation.test.js +186 -200
  65. package/dist/src/graph/create-relation.test.js.map +1 -1
  66. package/dist/src/graph/create-space.d.ts +2 -2
  67. package/dist/src/graph/create-space.d.ts.map +1 -1
  68. package/dist/src/graph/create-space.js.map +1 -1
  69. package/dist/src/graph/create-type.d.ts.map +1 -1
  70. package/dist/src/graph/create-type.js +16 -21
  71. package/dist/src/graph/create-type.js.map +1 -1
  72. package/dist/src/graph/create-type.test.js +76 -67
  73. package/dist/src/graph/create-type.test.js.map +1 -1
  74. package/dist/src/graph/delete-relation.d.ts.map +1 -1
  75. package/dist/src/graph/delete-relation.js +3 -6
  76. package/dist/src/graph/delete-relation.js.map +1 -1
  77. package/dist/src/graph/delete-relation.test.js +6 -8
  78. package/dist/src/graph/delete-relation.test.js.map +1 -1
  79. package/dist/src/graph/index.d.ts +1 -4
  80. package/dist/src/graph/index.d.ts.map +1 -1
  81. package/dist/src/graph/index.js +1 -4
  82. package/dist/src/graph/index.js.map +1 -1
  83. package/dist/src/graph/update-entity.d.ts.map +1 -1
  84. package/dist/src/graph/update-entity.js +109 -57
  85. package/dist/src/graph/update-entity.js.map +1 -1
  86. package/dist/src/graph/update-entity.test.js +167 -40
  87. package/dist/src/graph/update-entity.test.js.map +1 -1
  88. package/dist/src/graph/update-relation.d.ts +1 -2
  89. package/dist/src/graph/update-relation.d.ts.map +1 -1
  90. package/dist/src/graph/update-relation.js +12 -16
  91. package/dist/src/graph/update-relation.js.map +1 -1
  92. package/dist/src/graph/update-relation.test.js +75 -109
  93. package/dist/src/graph/update-relation.test.js.map +1 -1
  94. package/dist/src/id-utils.d.ts +6 -0
  95. package/dist/src/id-utils.d.ts.map +1 -1
  96. package/dist/src/id-utils.js +13 -0
  97. package/dist/src/id-utils.js.map +1 -1
  98. package/dist/src/ipfs.d.ts +3 -3
  99. package/dist/src/ipfs.d.ts.map +1 -1
  100. package/dist/src/ipfs.js +27 -7
  101. package/dist/src/ipfs.js.map +1 -1
  102. package/dist/src/ipfs.test.js +130 -17
  103. package/dist/src/ipfs.test.js.map +1 -1
  104. package/dist/src/proto/index.d.ts +7 -1
  105. package/dist/src/proto/index.d.ts.map +1 -1
  106. package/dist/src/proto/index.js +6 -1
  107. package/dist/src/proto/index.js.map +1 -1
  108. package/dist/src/ranks/create-rank.d.ts.map +1 -1
  109. package/dist/src/ranks/create-rank.js +54 -47
  110. package/dist/src/ranks/create-rank.js.map +1 -1
  111. package/dist/src/ranks/create-rank.test.js +181 -94
  112. package/dist/src/ranks/create-rank.test.js.map +1 -1
  113. package/dist/src/types.d.ts +52 -89
  114. package/dist/src/types.d.ts.map +1 -1
  115. package/dist/src/types.js.map +1 -1
  116. package/package.json +2 -5
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { DESCRIPTION_PROPERTY, NAME_PROPERTY } from '../core/ids/system.js';
3
3
  import { Id } from '../id.js';
4
+ import { toGrcId } from '../id-utils.js';
4
5
  import { updateEntity } from './update-entity.js';
5
6
  describe('updateEntity', () => {
6
7
  const entityId = Id('b1dc6e5c63e143bab3d4755b251a4ea1');
@@ -14,22 +15,29 @@ describe('updateEntity', () => {
14
15
  expect(result).toBeDefined();
15
16
  expect(result.id).toBe(entityId);
16
17
  expect(result.ops).toHaveLength(1);
17
- expect(result.ops[0]).toMatchObject({
18
- type: 'UPDATE_ENTITY',
19
- entity: {
20
- id: entityId,
21
- values: [
22
- {
23
- property: NAME_PROPERTY,
24
- value: 'Updated Entity',
25
- },
26
- {
27
- property: DESCRIPTION_PROPERTY,
28
- value: 'Updated Description',
29
- },
30
- ],
31
- },
18
+ const entityOp = result.ops[0];
19
+ expect(entityOp.type).toBe('createEntity');
20
+ expect(entityOp.id).toEqual(toGrcId(entityId));
21
+ // Verify name value
22
+ const nameValue = entityOp.values.find(v => {
23
+ const propBytes = v.property;
24
+ return propBytes.every((b, i) => b === toGrcId(NAME_PROPERTY)[i]);
32
25
  });
26
+ expect(nameValue).toBeDefined();
27
+ expect(nameValue?.value.type).toBe('text');
28
+ if (nameValue?.value.type === 'text') {
29
+ expect(nameValue.value.value).toBe('Updated Entity');
30
+ }
31
+ // Verify description value
32
+ const descValue = entityOp.values.find(v => {
33
+ const propBytes = v.property;
34
+ return propBytes.every((b, i) => b === toGrcId(DESCRIPTION_PROPERTY)[i]);
35
+ });
36
+ expect(descValue).toBeDefined();
37
+ expect(descValue?.value.type).toBe('text');
38
+ if (descValue?.value.type === 'text') {
39
+ expect(descValue.value.value).toBe('Updated Description');
40
+ }
33
41
  });
34
42
  it('updates an entity with only name', async () => {
35
43
  const result = updateEntity({
@@ -39,43 +47,162 @@ describe('updateEntity', () => {
39
47
  expect(result).toBeDefined();
40
48
  expect(result.id).toBe(entityId);
41
49
  expect(result.ops).toHaveLength(1);
42
- expect(result.ops[0]).toMatchObject({
43
- type: 'UPDATE_ENTITY',
44
- entity: {
45
- id: entityId,
46
- values: [
47
- {
48
- property: NAME_PROPERTY,
49
- value: 'Updated Entity',
50
- },
51
- ],
52
- },
53
- });
50
+ const entityOp = result.ops[0];
51
+ expect(entityOp.type).toBe('createEntity');
52
+ expect(entityOp.id).toEqual(toGrcId(entityId));
53
+ expect(entityOp.values).toHaveLength(1);
54
+ // Verify name value
55
+ const nameValue = entityOp.values[0];
56
+ expect(nameValue?.property).toEqual(toGrcId(NAME_PROPERTY));
57
+ expect(nameValue?.value.type).toBe('text');
58
+ if (nameValue?.value.type === 'text') {
59
+ expect(nameValue.value.value).toBe('Updated Entity');
60
+ }
54
61
  });
55
- it('updates an entity with custom values', async () => {
62
+ it('updates an entity with custom typed values', async () => {
56
63
  const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
57
64
  const result = updateEntity({
58
65
  id: entityId,
59
- values: [{ property: customPropertyId, value: 'updated custom value' }],
66
+ values: [{ property: customPropertyId, type: 'text', value: 'updated custom value' }],
60
67
  });
61
68
  expect(result).toBeDefined();
62
69
  expect(result.id).toBe(entityId);
63
70
  expect(result.ops).toHaveLength(1);
64
- expect(result.ops[0]).toMatchObject({
65
- type: 'UPDATE_ENTITY',
66
- entity: {
67
- id: entityId,
68
- values: [
69
- {
70
- property: customPropertyId,
71
- value: 'updated custom value',
72
- },
73
- ],
74
- },
71
+ const entityOp = result.ops[0];
72
+ expect(entityOp.type).toBe('createEntity');
73
+ expect(entityOp.id).toEqual(toGrcId(entityId));
74
+ expect(entityOp.values).toHaveLength(1);
75
+ // Verify custom value
76
+ const customValue = entityOp.values[0];
77
+ expect(customValue?.property).toEqual(toGrcId(customPropertyId));
78
+ expect(customValue?.value.type).toBe('text');
79
+ if (customValue?.value.type === 'text') {
80
+ expect(customValue.value.value).toBe('updated custom value');
81
+ }
82
+ });
83
+ it('updates an entity with a float64 value', async () => {
84
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
85
+ const result = updateEntity({
86
+ id: entityId,
87
+ values: [{ property: customPropertyId, type: 'float64', value: 42.5 }],
75
88
  });
89
+ expect(result).toBeDefined();
90
+ const entityOp = result.ops[0];
91
+ expect(entityOp.type).toBe('createEntity');
92
+ expect(entityOp.id).toEqual(toGrcId(entityId));
93
+ expect(entityOp.values).toHaveLength(1);
94
+ const floatValue = entityOp.values[0];
95
+ expect(floatValue?.property).toEqual(toGrcId(customPropertyId));
96
+ expect(floatValue?.value.type).toBe('float64');
97
+ if (floatValue?.value.type === 'float64') {
98
+ expect(floatValue.value.value).toBe(42.5);
99
+ }
100
+ });
101
+ it('updates an entity with a float64 value with unit', async () => {
102
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
103
+ const unitId = Id('016c9b1cd8a84e4d9e844e40878bb235');
104
+ const result = updateEntity({
105
+ id: entityId,
106
+ values: [{ property: customPropertyId, type: 'float64', value: 42.5, unit: unitId }],
107
+ });
108
+ expect(result).toBeDefined();
109
+ const entityOp = result.ops[0];
110
+ expect(entityOp.type).toBe('createEntity');
111
+ const floatValue = entityOp.values[0];
112
+ expect(floatValue?.value.type).toBe('float64');
113
+ if (floatValue?.value.type === 'float64') {
114
+ expect(floatValue.value.value).toBe(42.5);
115
+ expect(floatValue.value.unit).toEqual(toGrcId(unitId));
116
+ }
117
+ });
118
+ it('updates an entity with a boolean value', async () => {
119
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
120
+ const result = updateEntity({
121
+ id: entityId,
122
+ values: [{ property: customPropertyId, type: 'bool', value: true }],
123
+ });
124
+ expect(result).toBeDefined();
125
+ const entityOp = result.ops[0];
126
+ expect(entityOp.type).toBe('createEntity');
127
+ const boolValue = entityOp.values[0];
128
+ expect(boolValue?.property).toEqual(toGrcId(customPropertyId));
129
+ expect(boolValue?.value.type).toBe('bool');
130
+ if (boolValue?.value.type === 'bool') {
131
+ expect(boolValue.value.value).toBe(true);
132
+ }
133
+ });
134
+ it('updates an entity with a point value', async () => {
135
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
136
+ const result = updateEntity({
137
+ id: entityId,
138
+ values: [{ property: customPropertyId, type: 'point', lon: -122.4, lat: 37.8 }],
139
+ });
140
+ expect(result).toBeDefined();
141
+ const entityOp = result.ops[0];
142
+ expect(entityOp.type).toBe('createEntity');
143
+ const pointValue = entityOp.values[0];
144
+ expect(pointValue?.property).toEqual(toGrcId(customPropertyId));
145
+ expect(pointValue?.value.type).toBe('point');
146
+ if (pointValue?.value.type === 'point') {
147
+ expect(pointValue.value.lon).toBe(-122.4);
148
+ expect(pointValue.value.lat).toBe(37.8);
149
+ }
150
+ });
151
+ it('updates an entity with a date value', async () => {
152
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
153
+ const result = updateEntity({
154
+ id: entityId,
155
+ values: [{ property: customPropertyId, type: 'date', value: '2024-03-20' }],
156
+ });
157
+ expect(result).toBeDefined();
158
+ const entityOp = result.ops[0];
159
+ expect(entityOp.type).toBe('createEntity');
160
+ const dateValue = entityOp.values[0];
161
+ expect(dateValue?.property).toEqual(toGrcId(customPropertyId));
162
+ expect(dateValue?.value.type).toBe('date');
163
+ if (dateValue?.value.type === 'date') {
164
+ expect(dateValue.value.value).toBe('2024-03-20');
165
+ }
166
+ });
167
+ it('updates an entity with a text value with language', async () => {
168
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
169
+ const languageId = Id('0a4e9810f78f429ea4ceb1904a43251d');
170
+ const result = updateEntity({
171
+ id: entityId,
172
+ values: [{ property: customPropertyId, type: 'text', value: 'localized text', language: languageId }],
173
+ });
174
+ expect(result).toBeDefined();
175
+ const entityOp = result.ops[0];
176
+ expect(entityOp.type).toBe('createEntity');
177
+ const textValue = entityOp.values[0];
178
+ expect(textValue?.value.type).toBe('text');
179
+ if (textValue?.value.type === 'text') {
180
+ expect(textValue.value.value).toBe('localized text');
181
+ expect(textValue.value.language).toEqual(toGrcId(languageId));
182
+ }
76
183
  });
77
184
  it('throws an error if the provided id is invalid', () => {
78
185
  expect(() => updateEntity({ id: 'invalid' })).toThrow('Invalid id: "invalid" for `id` in `updateEntity`');
79
186
  });
187
+ it('throws an error if a property id in values is invalid', () => {
188
+ expect(() => updateEntity({
189
+ id: entityId,
190
+ values: [{ property: 'invalid-prop', type: 'text', value: 'test' }],
191
+ })).toThrow('Invalid id: "invalid-prop" for `values` in `updateEntity`');
192
+ });
193
+ it('throws an error if a language id in values is invalid', () => {
194
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
195
+ expect(() => updateEntity({
196
+ id: entityId,
197
+ values: [{ property: customPropertyId, type: 'text', value: 'test', language: 'invalid-lang' }],
198
+ })).toThrow('Invalid id: "invalid-lang" for `language` in `values` in `updateEntity`');
199
+ });
200
+ it('throws an error if a unit id in values is invalid', () => {
201
+ const customPropertyId = Id('fa269fd3de9849cf90c44235d905a67c');
202
+ expect(() => updateEntity({
203
+ id: entityId,
204
+ values: [{ property: customPropertyId, type: 'float64', value: 42, unit: 'invalid-unit' }],
205
+ })).toThrow('Invalid id: "invalid-unit" for `unit` in `values` in `updateEntity`');
206
+ });
80
207
  });
81
208
  //# sourceMappingURL=update-entity.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-entity.test.js","sourceRoot":"","sources":["../../../src/graph/update-entity.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,YAAY,E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C,CAAC;QAChE,MAAM,CAAC,GAAG,EAAE,CACV,YAAY,CAAC;YACX,EAAE,EAAE,QAAQ;YACZ,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;SAC3F,CAAC,CACH,CAAC,OAAO,CAAC,qEAAqE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -11,12 +11,11 @@ import type { CreateResult, UpdateRelationParams } from '../types.js';
11
11
  * toSpace: 'id of the to space', // optional
12
12
  * fromVersion: 'id of the from version', // optional
13
13
  * toVersion: 'id of the to version', // optional
14
- * verified: true, // optional
15
14
  * });
16
15
  * ```
17
16
  * @param params – {@link UpdateRelationParams}
18
17
  * @returns – {@link CreateResult}
19
18
  * @throws Will throw an error if any provided ID is invalid
20
19
  */
21
- export declare const updateRelation: ({ id, position, fromSpace, toSpace, fromVersion, toVersion, verified, }: UpdateRelationParams) => CreateResult;
20
+ export declare const updateRelation: ({ id, position, fromSpace, toSpace, fromVersion, toVersion, }: UpdateRelationParams) => CreateResult;
22
21
  //# sourceMappingURL=update-relation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-relation.d.ts","sourceRoot":"","sources":["../../../src/graph/update-relation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAM,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,GAAI,yEAQ5B,oBAAoB,KAAG,YAuBzB,CAAC"}
1
+ {"version":3,"file":"update-relation.d.ts","sourceRoot":"","sources":["../../../src/graph/update-relation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,GAAI,+DAO5B,oBAAoB,KAAG,YAkBzB,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { updateRelation as grcUpdateRelation } from '@geoprotocol/grc-20';
1
2
  import { Id } from '../id.js';
2
- import { assertValid } from '../id-utils.js';
3
+ import { assertValid, toGrcId } from '../id-utils.js';
3
4
  /**
4
5
  * Updates a relation.
5
6
  *
@@ -12,14 +13,13 @@ import { assertValid } from '../id-utils.js';
12
13
  * toSpace: 'id of the to space', // optional
13
14
  * fromVersion: 'id of the from version', // optional
14
15
  * toVersion: 'id of the to version', // optional
15
- * verified: true, // optional
16
16
  * });
17
17
  * ```
18
18
  * @param params – {@link UpdateRelationParams}
19
19
  * @returns – {@link CreateResult}
20
20
  * @throws Will throw an error if any provided ID is invalid
21
21
  */
22
- export const updateRelation = ({ id, position, fromSpace, toSpace, fromVersion, toVersion, verified, }) => {
22
+ export const updateRelation = ({ id, position, fromSpace, toSpace, fromVersion, toVersion, }) => {
23
23
  assertValid(id, '`id` in `updateRelation`');
24
24
  if (fromSpace)
25
25
  assertValid(fromSpace, '`fromSpace` in `updateRelation`');
@@ -29,19 +29,15 @@ export const updateRelation = ({ id, position, fromSpace, toSpace, fromVersion,
29
29
  assertValid(fromVersion, '`fromVersion` in `updateRelation`');
30
30
  if (toVersion)
31
31
  assertValid(toVersion, '`toVersion` in `updateRelation`');
32
- const ops = [];
33
- ops.push({
34
- type: 'UPDATE_RELATION',
35
- relation: {
36
- id: Id(id),
37
- position,
38
- fromSpace: fromSpace ? Id(fromSpace) : undefined,
39
- toSpace: toSpace ? Id(toSpace) : undefined,
40
- fromVersion: fromVersion ? Id(fromVersion) : undefined,
41
- toVersion: toVersion ? Id(toVersion) : undefined,
42
- verified,
43
- },
32
+ const op = grcUpdateRelation({
33
+ id: toGrcId(id),
34
+ ...(position !== undefined ? { position } : {}),
35
+ ...(fromSpace ? { fromSpace: toGrcId(fromSpace) } : {}),
36
+ ...(toSpace ? { toSpace: toGrcId(toSpace) } : {}),
37
+ ...(fromVersion ? { fromVersion: toGrcId(fromVersion) } : {}),
38
+ ...(toVersion ? { toVersion: toGrcId(toVersion) } : {}),
39
+ unset: [],
44
40
  });
45
- return { id: Id(id), ops };
41
+ return { id: Id(id), ops: [op] };
46
42
  };
47
43
  //# sourceMappingURL=update-relation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-relation.js","sourceRoot":"","sources":["../../../src/graph/update-relation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,QAAQ,EACR,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,EACT,QAAQ,GACa,EAAgB,EAAE;IACvC,WAAW,CAAC,EAAE,EAAE,0BAA0B,CAAC,CAAC;IAC5C,IAAI,SAAS;QAAE,WAAW,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;IACzE,IAAI,OAAO;QAAE,WAAW,CAAC,OAAO,EAAE,+BAA+B,CAAC,CAAC;IACnE,IAAI,WAAW;QAAE,WAAW,CAAC,WAAW,EAAE,mCAAmC,CAAC,CAAC;IAC/E,IAAI,SAAS;QAAE,WAAW,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;IAEzE,MAAM,GAAG,GAAc,EAAE,CAAC;IAE1B,GAAG,CAAC,IAAI,CAAC;QACP,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE;YACR,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;YACV,QAAQ;YACR,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YAChD,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;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EAAE,CAAC;QAC/C,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IAEH,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACnC,CAAC,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { Id } from '../id.js';
3
+ import { toGrcId } from '../id-utils.js';
3
4
  import { updateRelation } from './update-relation.js';
4
5
  const isUpdateRelationOp = (op) => {
5
- return op.type === 'UPDATE_RELATION';
6
+ return op.type === 'updateRelation';
6
7
  };
7
8
  describe('updateRelation', () => {
8
9
  const relationId = Id('30145d36d5a54244be593d111d879ba5');
@@ -18,31 +19,25 @@ describe('updateRelation', () => {
18
19
  expect(result).toBeDefined();
19
20
  expect(result.id).toBe(relationId);
20
21
  expect(result.ops).toHaveLength(1);
21
- expect(result.ops[0]).toMatchObject({
22
- type: 'UPDATE_RELATION',
23
- relation: {
24
- id: relationId,
25
- position: '1',
26
- },
27
- });
22
+ const op = result.ops[0];
23
+ expect(op.type).toBe('updateRelation');
24
+ expect(isUpdateRelationOp(op)).toBe(true);
25
+ expect(op.id).toEqual(toGrcId(relationId));
26
+ expect(op.position).toBe('1');
27
+ expect(op.unset).toEqual([]);
28
28
  });
29
- it('updates a relation with position and verified', () => {
29
+ it('updates a relation with position', () => {
30
30
  const result = updateRelation({
31
31
  id: relationId,
32
32
  position: '2',
33
- verified: true,
34
33
  });
35
34
  expect(result).toBeDefined();
36
35
  expect(result.id).toBe(relationId);
37
36
  expect(result.ops).toHaveLength(1);
38
- expect(result.ops[0]).toMatchObject({
39
- type: 'UPDATE_RELATION',
40
- relation: {
41
- id: relationId,
42
- position: '2',
43
- verified: true,
44
- },
45
- });
37
+ const op = result.ops[0];
38
+ expect(op.type).toBe('updateRelation');
39
+ expect(op.id).toEqual(toGrcId(relationId));
40
+ expect(op.position).toBe('2');
46
41
  });
47
42
  it('updates a relation with fromSpace and toSpace', () => {
48
43
  const result = updateRelation({
@@ -53,14 +48,11 @@ describe('updateRelation', () => {
53
48
  expect(result).toBeDefined();
54
49
  expect(result.id).toBe(relationId);
55
50
  expect(result.ops).toHaveLength(1);
56
- expect(result.ops[0]).toMatchObject({
57
- type: 'UPDATE_RELATION',
58
- relation: {
59
- id: relationId,
60
- fromSpace: fromSpaceId,
61
- toSpace: toSpaceId,
62
- },
63
- });
51
+ const op = result.ops[0];
52
+ expect(op.type).toBe('updateRelation');
53
+ expect(op.id).toEqual(toGrcId(relationId));
54
+ expect(op.fromSpace).toEqual(toGrcId(fromSpaceId));
55
+ expect(op.toSpace).toEqual(toGrcId(toSpaceId));
64
56
  });
65
57
  it('updates a relation with fromVersion and toVersion', () => {
66
58
  const result = updateRelation({
@@ -71,14 +63,11 @@ describe('updateRelation', () => {
71
63
  expect(result).toBeDefined();
72
64
  expect(result.id).toBe(relationId);
73
65
  expect(result.ops).toHaveLength(1);
74
- expect(result.ops[0]).toMatchObject({
75
- type: 'UPDATE_RELATION',
76
- relation: {
77
- id: relationId,
78
- fromVersion: fromVersionId,
79
- toVersion: toVersionId,
80
- },
81
- });
66
+ const op = result.ops[0];
67
+ expect(op.type).toBe('updateRelation');
68
+ expect(op.id).toEqual(toGrcId(relationId));
69
+ expect(op.fromVersion).toEqual(toGrcId(fromVersionId));
70
+ expect(op.toVersion).toEqual(toGrcId(toVersionId));
82
71
  });
83
72
  it('updates a relation with all optional fields', () => {
84
73
  const result = updateRelation({
@@ -88,39 +77,18 @@ describe('updateRelation', () => {
88
77
  toSpace: toSpaceId,
89
78
  fromVersion: fromVersionId,
90
79
  toVersion: toVersionId,
91
- verified: false,
92
80
  });
93
81
  expect(result).toBeDefined();
94
82
  expect(result.id).toBe(relationId);
95
83
  expect(result.ops).toHaveLength(1);
96
- expect(result.ops[0]).toMatchObject({
97
- type: 'UPDATE_RELATION',
98
- relation: {
99
- id: relationId,
100
- position: '3',
101
- fromSpace: fromSpaceId,
102
- toSpace: toSpaceId,
103
- fromVersion: fromVersionId,
104
- toVersion: toVersionId,
105
- verified: false,
106
- },
107
- });
108
- });
109
- it('updates a relation with only verified field', () => {
110
- const result = updateRelation({
111
- id: relationId,
112
- verified: true,
113
- });
114
- expect(result).toBeDefined();
115
- expect(result.id).toBe(relationId);
116
- expect(result.ops).toHaveLength(1);
117
- expect(result.ops[0]).toMatchObject({
118
- type: 'UPDATE_RELATION',
119
- relation: {
120
- id: relationId,
121
- verified: true,
122
- },
123
- });
84
+ const op = result.ops[0];
85
+ expect(op.type).toBe('updateRelation');
86
+ expect(op.id).toEqual(toGrcId(relationId));
87
+ expect(op.position).toBe('3');
88
+ expect(op.fromSpace).toEqual(toGrcId(fromSpaceId));
89
+ expect(op.toSpace).toEqual(toGrcId(toSpaceId));
90
+ expect(op.fromVersion).toEqual(toGrcId(fromVersionId));
91
+ expect(op.toVersion).toEqual(toGrcId(toVersionId));
124
92
  });
125
93
  it('updates a relation with only fromSpace', () => {
126
94
  const result = updateRelation({
@@ -130,13 +98,14 @@ describe('updateRelation', () => {
130
98
  expect(result).toBeDefined();
131
99
  expect(result.id).toBe(relationId);
132
100
  expect(result.ops).toHaveLength(1);
133
- expect(result.ops[0]).toMatchObject({
134
- type: 'UPDATE_RELATION',
135
- relation: {
136
- id: relationId,
137
- fromSpace: fromSpaceId,
138
- },
139
- });
101
+ const op = result.ops[0];
102
+ expect(op.type).toBe('updateRelation');
103
+ expect(op.id).toEqual(toGrcId(relationId));
104
+ expect(op.fromSpace).toEqual(toGrcId(fromSpaceId));
105
+ expect(op.toSpace).toBeUndefined();
106
+ expect(op.fromVersion).toBeUndefined();
107
+ expect(op.toVersion).toBeUndefined();
108
+ expect(op.position).toBeUndefined();
140
109
  });
141
110
  it('updates a relation with only toSpace', () => {
142
111
  const result = updateRelation({
@@ -146,13 +115,11 @@ describe('updateRelation', () => {
146
115
  expect(result).toBeDefined();
147
116
  expect(result.id).toBe(relationId);
148
117
  expect(result.ops).toHaveLength(1);
149
- expect(result.ops[0]).toMatchObject({
150
- type: 'UPDATE_RELATION',
151
- relation: {
152
- id: relationId,
153
- toSpace: toSpaceId,
154
- },
155
- });
118
+ const op = result.ops[0];
119
+ expect(op.type).toBe('updateRelation');
120
+ expect(op.id).toEqual(toGrcId(relationId));
121
+ expect(op.toSpace).toEqual(toGrcId(toSpaceId));
122
+ expect(op.fromSpace).toBeUndefined();
156
123
  });
157
124
  it('updates a relation with only fromVersion', () => {
158
125
  const result = updateRelation({
@@ -162,13 +129,11 @@ describe('updateRelation', () => {
162
129
  expect(result).toBeDefined();
163
130
  expect(result.id).toBe(relationId);
164
131
  expect(result.ops).toHaveLength(1);
165
- expect(result.ops[0]).toMatchObject({
166
- type: 'UPDATE_RELATION',
167
- relation: {
168
- id: relationId,
169
- fromVersion: fromVersionId,
170
- },
171
- });
132
+ const op = result.ops[0];
133
+ expect(op.type).toBe('updateRelation');
134
+ expect(op.id).toEqual(toGrcId(relationId));
135
+ expect(op.fromVersion).toEqual(toGrcId(fromVersionId));
136
+ expect(op.toVersion).toBeUndefined();
172
137
  });
173
138
  it('updates a relation with only toVersion', () => {
174
139
  const result = updateRelation({
@@ -178,13 +143,11 @@ describe('updateRelation', () => {
178
143
  expect(result).toBeDefined();
179
144
  expect(result.id).toBe(relationId);
180
145
  expect(result.ops).toHaveLength(1);
181
- expect(result.ops[0]).toMatchObject({
182
- type: 'UPDATE_RELATION',
183
- relation: {
184
- id: relationId,
185
- toVersion: toVersionId,
186
- },
187
- });
146
+ const op = result.ops[0];
147
+ expect(op.type).toBe('updateRelation');
148
+ expect(op.id).toEqual(toGrcId(relationId));
149
+ expect(op.toVersion).toEqual(toGrcId(toVersionId));
150
+ expect(op.fromVersion).toBeUndefined();
188
151
  });
189
152
  it('throws an error if the relation id is invalid', () => {
190
153
  expect(() => updateRelation({
@@ -224,41 +187,44 @@ describe('updateRelation', () => {
224
187
  toSpace: undefined,
225
188
  fromVersion: undefined,
226
189
  toVersion: undefined,
227
- verified: undefined,
228
190
  });
229
191
  expect(result).toBeDefined();
230
192
  expect(result.id).toBe(relationId);
231
193
  expect(result.ops).toHaveLength(1);
232
- expect(result.ops[0]).toMatchObject({
233
- type: 'UPDATE_RELATION',
234
- relation: {
235
- id: relationId,
236
- position: undefined,
237
- fromSpace: undefined,
238
- toSpace: undefined,
239
- fromVersion: undefined,
240
- toVersion: undefined,
241
- verified: undefined,
242
- },
243
- });
194
+ const op = result.ops[0];
195
+ expect(op.type).toBe('updateRelation');
196
+ expect(op.id).toEqual(toGrcId(relationId));
197
+ expect(op.position).toBeUndefined();
198
+ expect(op.fromSpace).toBeUndefined();
199
+ expect(op.toSpace).toBeUndefined();
200
+ expect(op.fromVersion).toBeUndefined();
201
+ expect(op.toVersion).toBeUndefined();
202
+ expect(op.unset).toEqual([]);
244
203
  });
245
204
  it('validates the op structure correctly', () => {
246
205
  const result = updateRelation({
247
206
  id: relationId,
248
207
  position: 'test-position',
249
- verified: true,
250
208
  });
251
209
  expect(result.ops).toHaveLength(1);
252
210
  const op = result.ops[0];
253
211
  expect(op).toBeDefined();
212
+ expect(op?.type).toBe('updateRelation');
254
213
  if (op && isUpdateRelationOp(op)) {
255
- expect(op.relation.id).toBe(relationId);
256
- expect(op.relation.position).toBe('test-position');
257
- expect(op.relation.verified).toBe(true);
214
+ expect(op.id).toEqual(toGrcId(relationId));
215
+ expect(op.position).toBe('test-position');
258
216
  }
259
217
  else {
260
- throw new Error('Expected op to be defined and of type UPDATE_RELATION');
218
+ throw new Error('Expected op to be defined and of type updateRelation');
261
219
  }
262
220
  });
221
+ it('creates an updateRelation op with empty unset array by default', () => {
222
+ const result = updateRelation({
223
+ id: relationId,
224
+ position: 'a',
225
+ });
226
+ const op = result.ops[0];
227
+ expect(op.unset).toEqual([]);
228
+ });
263
229
  });
264
230
  //# sourceMappingURL=update-relation.test.js.map