Skip to content

Commit 9ee3711

Browse files
authored
fix: create properties relation when creating type (#101)
1 parent 3be62b0 commit 9ee3711

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @graphprotocol/grc-20
22

3+
## 0.21.4
4+
5+
### Patch Changes
6+
7+
- Use correct system id when creating properties on a Type
8+
39
## 0.21.3
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/grc-20",
3-
"version": "0.21.3",
3+
"version": "0.21.4",
44
"license": "MIT",
55
"module": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/graph/create-type.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest';
22
import { AUTHORS_PROPERTY, WEBSITE_PROPERTY } from '../core/ids/content.js';
3-
import { NAME_PROPERTY, PROPERTY, SCHEMA_TYPE, TYPES_PROPERTY } from '../core/ids/system.js';
3+
import { NAME_PROPERTY, PROPERTIES, SCHEMA_TYPE, TYPES_PROPERTY } from '../core/ids/system.js';
44
import { Id } from '../id.js';
55
import { createType } from './create-type.js';
66

@@ -87,7 +87,7 @@ describe('createType', () => {
8787
relation: {
8888
fromEntity: type.id,
8989
toEntity: WEBSITE_PROPERTY,
90-
type: PROPERTY,
90+
type: PROPERTIES,
9191
},
9292
type: 'CREATE_RELATION',
9393
});
@@ -98,7 +98,7 @@ describe('createType', () => {
9898
relation: {
9999
fromEntity: type.id,
100100
toEntity: AUTHORS_PROPERTY,
101-
type: PROPERTY,
101+
type: PROPERTIES,
102102
},
103103
type: 'CREATE_RELATION',
104104
});

src/graph/create-type.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PROPERTY, SCHEMA_TYPE, TYPES_PROPERTY } from '../core/ids/system.js';
1+
import { PROPERTIES, PROPERTY, SCHEMA_TYPE, TYPES_PROPERTY } from '../core/ids/system.js';
22
import { Id, assertValid, generate } from '../id.js';
33
import type { CreateResult, CreateTypeParams } from '../types.js';
44
import { createEntity } from './create-entity.js';
@@ -60,14 +60,15 @@ export const createType = ({
6060
if (properties) {
6161
for (const propertyId of properties) {
6262
assertValid(propertyId, '`propertyId` in `createType`');
63+
// Set Properties on the Type
6364
ops.push({
6465
type: 'CREATE_RELATION',
6566
relation: {
6667
id: generate(),
6768
entity: generate(),
6869
fromEntity: Id(id),
6970
toEntity: Id(propertyId),
70-
type: PROPERTY,
71+
type: PROPERTIES,
7172
},
7273
});
7374
}

0 commit comments

Comments
 (0)