@arpproject/recrate 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -2
- package/dist/recrate.css +4 -4
- package/dist/recrate.es.js +34674 -114061
- package/package.json +41 -32
- package/.eslintrc.json +0 -37
- package/.storybook/main.ts +0 -40
- package/.storybook/preview.tsx +0 -46
- package/babel.config.json +0 -5
- package/docker-compose.yml +0 -30
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -99
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1448
- package/docs/classes/src_crate_builder_CrateManager_crate_manager.CrateManager.html +0 -240
- package/docs/classes/src_crate_builder_CrateManager_profile_manager.ProfileManager.html +0 -42
- package/docs/classes/src_crate_builder_editor_state.EditorState.html +0 -28
- package/docs/classes/src_crate_builder_types.CrateManagerType.html +0 -57
- package/docs/classes/src_crate_builder_types.ProfileManagerType.html +0 -13
- package/docs/functions/src_crate_builder_CrateManager_lib.isURL.html +0 -2
- package/docs/functions/src_crate_builder_CrateManager_lib.mintNewCrate.html +0 -3
- package/docs/functions/src_crate_builder_CrateManager_lib.normalise.html +0 -5
- package/docs/functions/src_crate_builder_CrateManager_lib.normaliseEntityType.html +0 -1
- package/docs/index.html +0 -58
- package/docs/interfaces/src_crate_builder_types.NormalisedCrate.html +0 -3
- package/docs/interfaces/src_crate_builder_types.NormalisedEntityDefinition.html +0 -4
- package/docs/interfaces/src_crate_builder_types.NormalisedProfile.html +0 -9
- package/docs/interfaces/src_crate_builder_types.ProfileLayout.html +0 -2
- package/docs/interfaces/src_crate_builder_types.ProfileLayoutGroup.html +0 -9
- package/docs/interfaces/src_crate_builder_types.UnverifiedCrate.html +0 -3
- package/docs/interfaces/src_crate_builder_types.UnverifiedEntityDefinition.html +0 -4
- package/docs/modules/src_crate_builder_CrateManager_crate_manager.html +0 -2
- package/docs/modules/src_crate_builder_CrateManager_lib.html +0 -6
- package/docs/modules/src_crate_builder_CrateManager_profile_manager.html +0 -2
- package/docs/modules/src_crate_builder_editor_state.html +0 -2
- package/docs/modules/src_crate_builder_types.html +0 -16
- package/docs/types/src_crate_builder_types.EntityReference.html +0 -1
- package/docs/types/src_crate_builder_types.NormalisedContext.html +0 -1
- package/docs/types/src_crate_builder_types.PrimitiveType.html +0 -1
- package/docs/types/src_crate_builder_types.ProfileAssociation.html +0 -1
- package/docs/types/src_crate_builder_types.ProfileInput.html +0 -1
- package/docs/types/src_crate_builder_types.UnverifiedContext.html +0 -1
- package/docs/variables/src_crate_builder_CrateManager_lib.urlProtocols.html +0 -1
- package/index.html +0 -13
- package/load-data-packs.cjs +0 -38
- package/postcss.config.cjs +0 -6
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/marker-icon.png +0 -0
- package/public/marker-shadow.png +0 -0
- package/public/robots.txt +0 -3
- package/react-app-env.d.ts +0 -1
- package/rollup.config.js +0 -26
- package/src/app/App.tsx +0 -13
- package/src/app/EmbeddedComponent.tsx +0 -432
- package/src/app/index.html +0 -20
- package/src/app/index.tsx +0 -19
- package/src/app/lookup.ts +0 -141
- package/src/app/override-styles.css +0 -96
- package/src/crate-builder/CrateManager/contexts/1.1-context.jsonld +0 -2660
- package/src/crate-builder/CrateManager/contexts/1.2-DRAFT-context.jsonld +0 -2918
- package/src/crate-builder/CrateManager/contexts.ts +0 -42
- package/src/crate-builder/CrateManager/crate-manager-benchmarking.spec.ts +0 -31
- package/src/crate-builder/CrateManager/crate-manager-loading-exporting.spec.ts +0 -431
- package/src/crate-builder/CrateManager/crate-manager-operations.spec.ts +0 -298
- package/src/crate-builder/CrateManager/crate-manager.spec.ts +0 -2336
- package/src/crate-builder/CrateManager/crate-manager.ts +0 -2111
- package/src/crate-builder/CrateManager/lib.spec.ts +0 -133
- package/src/crate-builder/CrateManager/lib.ts +0 -170
- package/src/crate-builder/CrateManager/profile-manager.spec.ts +0 -593
- package/src/crate-builder/CrateManager/profile-manager.ts +0 -367
- package/src/crate-builder/CrateManager/schema-type-definitions.json +0 -35122
- package/src/crate-builder/CrateManager/validate-identifier.spec.ts +0 -82
- package/src/crate-builder/CrateManager/validate-identifier.ts +0 -65
- package/src/crate-builder/RenderEntity/Add.tsx +0 -249
- package/src/crate-builder/RenderEntity/AddControl.stories.tsx +0 -126
- package/src/crate-builder/RenderEntity/AddControl.tsx +0 -84
- package/src/crate-builder/RenderEntity/AutoComplete.tsx +0 -215
- package/src/crate-builder/RenderEntity/BulkAdd.tsx +0 -136
- package/src/crate-builder/RenderEntity/DeleteProperty.tsx +0 -33
- package/src/crate-builder/RenderEntity/DialogAddProperty.tsx +0 -83
- package/src/crate-builder/RenderEntity/DialogBrowseEntities.tsx +0 -136
- package/src/crate-builder/RenderEntity/DialogEditContext.tsx +0 -107
- package/src/crate-builder/RenderEntity/DialogPreviewCrate.tsx +0 -54
- package/src/crate-builder/RenderEntity/DialogSaveCrateAsTemplate.tsx +0 -65
- package/src/crate-builder/RenderEntity/DialogSaveEntityTemplate.tsx +0 -87
- package/src/crate-builder/RenderEntity/DisplayPropertyName.stories.tsx +0 -30
- package/src/crate-builder/RenderEntity/DisplayPropertyName.tsx +0 -21
- package/src/crate-builder/RenderEntity/EntityId.tsx +0 -75
- package/src/crate-builder/RenderEntity/EntityName.tsx +0 -49
- package/src/crate-builder/RenderEntity/EntityProperty.tsx +0 -188
- package/src/crate-builder/RenderEntity/EntityPropertyInstance.tsx +0 -255
- package/src/crate-builder/RenderEntity/EntityType.tsx +0 -95
- package/src/crate-builder/RenderEntity/ItemLink.tsx +0 -37
- package/src/crate-builder/RenderEntity/PaginateLinkedEntities.stories.tsx +0 -43
- package/src/crate-builder/RenderEntity/PaginateLinkedEntities.tsx +0 -141
- package/src/crate-builder/RenderEntity/PropertyHelp.tsx +0 -39
- package/src/crate-builder/RenderEntity/RenderControls.tsx +0 -278
- package/src/crate-builder/RenderEntity/RenderLinkedItem.tsx +0 -139
- package/src/crate-builder/RenderEntity/RenderPropertyHelp.tsx +0 -41
- package/src/crate-builder/RenderEntity/RenderReverseConnections.tsx +0 -150
- package/src/crate-builder/RenderEntity/RenderTypes.tsx +0 -102
- package/src/crate-builder/RenderEntity/Shell2.tsx +0 -576
- package/src/crate-builder/RenderEntity/UnlinkEntity.tsx +0 -30
- package/src/crate-builder/RenderEntity/auto-complete.lib.ts +0 -184
- package/src/crate-builder/RenderEntity/keys.ts +0 -4
- package/src/crate-builder/RenderEntity/layout.spec.js +0 -593
- package/src/crate-builder/RenderEntity/layout.ts +0 -220
- package/src/crate-builder/Shell.tsx +0 -337
- package/src/crate-builder/component.css +0 -65
- package/src/crate-builder/editor-state.ts +0 -114
- package/src/crate-builder/emotionCache.ts +0 -8
- package/src/crate-builder/helpers.ts +0 -16
- package/src/crate-builder/i18n.ts +0 -22
- package/src/crate-builder/lib/validate-iri.js +0 -69
- package/src/crate-builder/lib/validate-iri.ts +0 -57
- package/src/crate-builder/locales/en.js +0 -149
- package/src/crate-builder/locales/hu.js +0 -147
- package/src/crate-builder/primitives/Boolean.stories.tsx +0 -33
- package/src/crate-builder/primitives/Boolean.tsx +0 -67
- package/src/crate-builder/primitives/Date.stories.tsx +0 -32
- package/src/crate-builder/primitives/Date.tsx +0 -58
- package/src/crate-builder/primitives/DateTime.stories.tsx +0 -32
- package/src/crate-builder/primitives/DateTime.tsx +0 -64
- package/src/crate-builder/primitives/Geo.stories.tsx +0 -57
- package/src/crate-builder/primitives/Geo.tsx +0 -225
- package/src/crate-builder/primitives/Map.SelectArea.js +0 -359
- package/src/crate-builder/primitives/Map.stories.tsx +0 -61
- package/src/crate-builder/primitives/Map.tsx +0 -124
- package/src/crate-builder/primitives/Number.stories.tsx +0 -74
- package/src/crate-builder/primitives/Number.tsx +0 -166
- package/src/crate-builder/primitives/Select.stories.tsx +0 -66
- package/src/crate-builder/primitives/Select.tsx +0 -121
- package/src/crate-builder/primitives/SelectObject.stories.tsx +0 -29
- package/src/crate-builder/primitives/SelectObject.tsx +0 -105
- package/src/crate-builder/primitives/SelectUrl.stories.tsx +0 -42
- package/src/crate-builder/primitives/SelectUrl.tsx +0 -110
- package/src/crate-builder/primitives/Text.stories.tsx +0 -106
- package/src/crate-builder/primitives/Text.tsx +0 -197
- package/src/crate-builder/primitives/Time.stories.tsx +0 -38
- package/src/crate-builder/primitives/Time.tsx +0 -71
- package/src/crate-builder/primitives/Url.stories.tsx +0 -43
- package/src/crate-builder/primitives/Url.tsx +0 -75
- package/src/crate-builder/primitives/Value.stories.tsx +0 -37
- package/src/crate-builder/primitives/Value.tsx +0 -30
- package/src/crate-builder/primitives/date-libs.ts +0 -12
- package/src/crate-builder/profile-schema.json +0 -145
- package/src/crate-builder/property-definitions.ts +0 -78
- package/src/crate-builder/recrate.css +0 -3
- package/src/crate-builder/store.ts +0 -14
- package/src/crate-builder/tailwind.css +0 -5
- package/src/crate-builder/types.d.ts +0 -318
- package/src/examples/collection/collections-entity-example.json +0 -131
- package/src/examples/collection/crate-builder-entity-example.json +0 -33
- package/src/examples/item/complex-collection/ro-crate-metadata.json +0 -174
- package/src/examples/item/complex-item/ro-crate-metadata.json +0 -769
- package/src/examples/item/crate-with-language.json +0 -38
- package/src/examples/item/empty/ro-crate-metadata.json +0 -20
- package/src/examples/item/item-with-relationship-and-action/ro-crate-metadata.json +0 -66
- package/src/examples/item/large-crate/ro-crate-metadata.json +0 -5762
- package/src/examples/item/multiple-types/ro-crate-metadata.json +0 -20
- package/src/examples/item/ridiculously-big-collection/ro-crate-metadata.json +0 -162977
- package/src/examples/profile/aroma.complex.profile.json +0 -11098
- package/src/examples/profile/aroma.profile.json +0 -9158
- package/src/examples/profile/nyingarn-item-profile.json +0 -426
- package/src/examples/profile/profile-to-test-inverse-associations.json +0 -73
- package/src/examples/profile/profile-to-test-multiple-types.json +0 -31
- package/src/examples/profile/profile-with-all-primitives-and-groups.json +0 -207
- package/src/examples/profile/profile-with-all-primitives.json +0 -244
- package/src/examples/profile/profile-with-constraints.json +0 -446
- package/src/examples/profile/profile-with-resolve.json +0 -57
- package/src/examples/profile/vocabulary-creation-profile.json +0 -231
- package/src/images.d.ts +0 -5
- package/src/index.ts +0 -12
- package/src/types.ts +0 -104
- package/tailwind.config.js +0 -21
- package/tsconfig.app.json +0 -31
- package/tsconfig.json +0 -26
- package/typedoc.json +0 -11
- package/update-deps.sh +0 -4
- package/vite-env.d.ts +0 -1
- package/vite.config.ts +0 -46
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import "regenerator-runtime";
|
|
2
|
-
import { describe, expect, test, beforeAll, vi } from "vitest";
|
|
3
|
-
import { CrateManager } from "./crate-manager";
|
|
4
|
-
import type { UnverifiedCrate } from "../types";
|
|
5
|
-
|
|
6
|
-
describe("Test loading / exporting crate files", () => {
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
vi.spyOn(console, "debug").mockImplementation(() => {});
|
|
9
|
-
});
|
|
10
|
-
test("a bunch of entity update operations", async () => {
|
|
11
|
-
let crate = getBaseCrate();
|
|
12
|
-
crate["@graph"].push({
|
|
13
|
-
"@id": "./",
|
|
14
|
-
"@type": "Dataset",
|
|
15
|
-
name: "root dataset",
|
|
16
|
-
data: "value",
|
|
17
|
-
author: { "@id": "#person1" },
|
|
18
|
-
});
|
|
19
|
-
crate["@graph"].push({
|
|
20
|
-
"@id": "#person1",
|
|
21
|
-
"@type": "Person",
|
|
22
|
-
name: "person1",
|
|
23
|
-
});
|
|
24
|
-
crate["@graph"].push({
|
|
25
|
-
"@id": "#organisation1",
|
|
26
|
-
"@type": "Organisation",
|
|
27
|
-
name: "org1",
|
|
28
|
-
director: { "@id": "#person1" },
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// load the crate in
|
|
32
|
-
let cm = new CrateManager({ crate });
|
|
33
|
-
let ec = cm.exportCrate();
|
|
34
|
-
// console.log(JSON.stringify(ec["@graph"], null, 2));
|
|
35
|
-
|
|
36
|
-
let entities = [...cm.getEntities()];
|
|
37
|
-
expect(entities.length).toEqual(4);
|
|
38
|
-
expect(entities).toMatchObject([
|
|
39
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
40
|
-
{ "@id": "./" },
|
|
41
|
-
{ "@id": "#person1" },
|
|
42
|
-
{ "@id": "#organisation1" },
|
|
43
|
-
]);
|
|
44
|
-
// console.log(JSON.stringify(entities, null, 2));
|
|
45
|
-
|
|
46
|
-
cm.updateProperty({ id: "#person1", property: "@id", value: "http://person.example.com" });
|
|
47
|
-
ec = cm.exportCrate();
|
|
48
|
-
// console.log(JSON.stringify(ec["@graph"], null, 2));
|
|
49
|
-
expect(ec["@graph"]).toMatchObject([
|
|
50
|
-
{
|
|
51
|
-
"@id": "ro-crate-metadata.json",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"@id": "./",
|
|
55
|
-
author: { "@id": "http://person.example.com" },
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"@id": "http://person.example.com",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"@id": "#organisation1",
|
|
62
|
-
director: {
|
|
63
|
-
"@id": "http://person.example.com",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
]);
|
|
67
|
-
|
|
68
|
-
cm.updateProperty({ id: "#organisation1", property: "@id", value: "thebadguys" });
|
|
69
|
-
ec = cm.exportCrate();
|
|
70
|
-
// console.log(JSON.stringify(ec["@graph"], null, 2));
|
|
71
|
-
expect(ec["@graph"]).toMatchObject([
|
|
72
|
-
{
|
|
73
|
-
"@id": "ro-crate-metadata.json",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"@id": "./",
|
|
77
|
-
author: { "@id": "http://person.example.com" },
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"@id": "http://person.example.com",
|
|
81
|
-
"@reverse": {
|
|
82
|
-
director: {
|
|
83
|
-
"@id": "#thebadguys",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"@id": "#thebadguys",
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
91
|
-
entities = [...cm.getEntities()];
|
|
92
|
-
// console.log(entities);
|
|
93
|
-
expect(entities).toMatchObject([
|
|
94
|
-
{
|
|
95
|
-
"@id": "ro-crate-metadata.json",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"@id": "./",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"@id": "http://person.example.com",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"@id": "#thebadguys",
|
|
105
|
-
},
|
|
106
|
-
]);
|
|
107
|
-
|
|
108
|
-
// set the id back to #person1 and delete the organisation
|
|
109
|
-
cm.updateProperty({
|
|
110
|
-
id: "http://person.example.com",
|
|
111
|
-
property: "@id",
|
|
112
|
-
value: "#person1",
|
|
113
|
-
});
|
|
114
|
-
cm.deleteEntity({ id: "#thebadguys" });
|
|
115
|
-
entities = [...cm.getEntities()];
|
|
116
|
-
expect(entities).toMatchObject([
|
|
117
|
-
{
|
|
118
|
-
"@id": "ro-crate-metadata.json",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"@id": "./",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"@id": "#person1",
|
|
125
|
-
},
|
|
126
|
-
]);
|
|
127
|
-
|
|
128
|
-
// set properties
|
|
129
|
-
try {
|
|
130
|
-
cm.setProperty({
|
|
131
|
-
id: "",
|
|
132
|
-
property: "value",
|
|
133
|
-
propertyId: "http://schema.org/value",
|
|
134
|
-
value: "value",
|
|
135
|
-
});
|
|
136
|
-
} catch (error) {
|
|
137
|
-
(error as Error).message = `'setProperty' requires 'id'`;
|
|
138
|
-
}
|
|
139
|
-
cm.setProperty({ id: "./", property: "data", value: "value" });
|
|
140
|
-
cm.setProperty({ id: "./", property: "data", value: { "@id": "#person1" } });
|
|
141
|
-
entities = [...cm.getEntities()];
|
|
142
|
-
// console.log(entities);
|
|
143
|
-
expect(entities).toMatchObject([
|
|
144
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
145
|
-
{
|
|
146
|
-
"@id": "./",
|
|
147
|
-
data: ["value", "value", { "@id": "#person1" }],
|
|
148
|
-
author: [{ "@id": "#person1" }],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"@id": "#person1",
|
|
152
|
-
},
|
|
153
|
-
]);
|
|
154
|
-
|
|
155
|
-
// delete a property
|
|
156
|
-
cm.deleteProperty({
|
|
157
|
-
id: "./",
|
|
158
|
-
property: "data",
|
|
159
|
-
idx: 2,
|
|
160
|
-
});
|
|
161
|
-
entities = [...cm.getEntities()];
|
|
162
|
-
// console.log(entities);
|
|
163
|
-
expect(entities).toMatchObject([
|
|
164
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
165
|
-
{
|
|
166
|
-
"@id": "./",
|
|
167
|
-
data: ["value", "value"],
|
|
168
|
-
author: [{ "@id": "#person1" }],
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
"@id": "#person1",
|
|
172
|
-
},
|
|
173
|
-
]);
|
|
174
|
-
|
|
175
|
-
// set another property
|
|
176
|
-
cm.setProperty({ id: "#person1", property: "authorOf", value: { "@id": "./" } });
|
|
177
|
-
entities = [...cm.getEntities({})];
|
|
178
|
-
expect(entities).toMatchObject([
|
|
179
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
180
|
-
{
|
|
181
|
-
"@id": "./",
|
|
182
|
-
data: ["value", "value"],
|
|
183
|
-
author: [{ "@id": "#person1" }],
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"@id": "#person1",
|
|
187
|
-
authorOf: [{ "@id": "./" }],
|
|
188
|
-
},
|
|
189
|
-
]);
|
|
190
|
-
|
|
191
|
-
// update a property
|
|
192
|
-
cm.updateProperty({ id: "./", property: "data", idx: 1, value: "new" });
|
|
193
|
-
entities = [...cm.getEntities()];
|
|
194
|
-
expect(entities).toMatchObject([
|
|
195
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
196
|
-
{
|
|
197
|
-
"@id": "./",
|
|
198
|
-
data: ["value", "new"],
|
|
199
|
-
author: [{ "@id": "#person1" }],
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"@id": "#person1",
|
|
203
|
-
authorOf: [{ "@id": "./" }],
|
|
204
|
-
},
|
|
205
|
-
]);
|
|
206
|
-
// console.log(entities);
|
|
207
|
-
|
|
208
|
-
// delete an entity
|
|
209
|
-
cm.deleteEntity({ id: "#person1" });
|
|
210
|
-
entities = [...cm.getEntities()];
|
|
211
|
-
expect(entities).toMatchObject([
|
|
212
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
213
|
-
{
|
|
214
|
-
"@id": "./",
|
|
215
|
-
data: ["value", "new"],
|
|
216
|
-
},
|
|
217
|
-
]);
|
|
218
|
-
|
|
219
|
-
// add an entity
|
|
220
|
-
cm.addEntity({
|
|
221
|
-
"@id": "#person1",
|
|
222
|
-
"@type": "Person",
|
|
223
|
-
name: "person1",
|
|
224
|
-
});
|
|
225
|
-
entities = [...cm.getEntities()];
|
|
226
|
-
expect(entities).toMatchObject([
|
|
227
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
228
|
-
{
|
|
229
|
-
"@id": "./",
|
|
230
|
-
data: ["value", "new"],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
"@id": "#person1",
|
|
234
|
-
},
|
|
235
|
-
]);
|
|
236
|
-
// console.log(JSON.stringify(entities, null, 2));
|
|
237
|
-
|
|
238
|
-
// add the same entity
|
|
239
|
-
cm.addEntity({
|
|
240
|
-
"@id": "#person1",
|
|
241
|
-
"@type": "Person",
|
|
242
|
-
name: "person1",
|
|
243
|
-
});
|
|
244
|
-
entities = [...cm.getEntities()];
|
|
245
|
-
|
|
246
|
-
// console.log(entities);
|
|
247
|
-
expect(entities).toMatchObject([
|
|
248
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
249
|
-
{
|
|
250
|
-
"@id": "./",
|
|
251
|
-
data: ["value", "new"],
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"@id": "#person1",
|
|
255
|
-
},
|
|
256
|
-
]);
|
|
257
|
-
|
|
258
|
-
// add an entity with the same id but different type
|
|
259
|
-
cm.addEntity({
|
|
260
|
-
"@id": "#person1",
|
|
261
|
-
"@type": "Organisation",
|
|
262
|
-
name: "person1",
|
|
263
|
-
});
|
|
264
|
-
entities = [...cm.getEntities()];
|
|
265
|
-
|
|
266
|
-
expect(entities).toMatchObject([
|
|
267
|
-
{ "@id": "ro-crate-metadata.json" },
|
|
268
|
-
{
|
|
269
|
-
"@id": "./",
|
|
270
|
-
data: ["value", "new"],
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
"@id": "#person1",
|
|
274
|
-
},
|
|
275
|
-
{ "@type": ["Organisation"] },
|
|
276
|
-
]);
|
|
277
|
-
|
|
278
|
-
// console.log(JSON.stringify(entities, null, 2));
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
function getBaseCrate(): UnverifiedCrate {
|
|
283
|
-
return {
|
|
284
|
-
"@context": ["https://w3id.org/ro/crate/1.1/context"],
|
|
285
|
-
"@graph": [
|
|
286
|
-
{
|
|
287
|
-
"@id": "ro-crate-metadata.json",
|
|
288
|
-
"@type": "CreativeWork",
|
|
289
|
-
conformsTo: {
|
|
290
|
-
"@id": "https://w3id.org/ro/crate/1.1/context",
|
|
291
|
-
},
|
|
292
|
-
about: {
|
|
293
|
-
"@id": "./",
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
};
|
|
298
|
-
}
|