arocapi 5.0.0-beta.2 → 5.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -824
- package/dist/app.d.ts +20 -7
- package/dist/app.js +42 -28
- package/dist/app.js.map +1 -1
- package/dist/app.test.js +41 -56
- package/dist/app.test.js.map +1 -1
- package/dist/errorHandling.test.d.ts +1 -0
- package/dist/errorHandling.test.js +222 -0
- package/dist/errorHandling.test.js.map +1 -0
- package/dist/index.dev.js +4 -3
- package/dist/index.dev.js.map +1 -1
- package/dist/routes/capabilities.test.js +8 -8
- package/dist/routes/capabilities.test.js.map +1 -1
- package/dist/routes/crate.test.js +67 -19
- package/dist/routes/crate.test.js.map +1 -1
- package/dist/routes/entities.d.ts +5 -2
- package/dist/routes/entities.js +31 -49
- package/dist/routes/entities.js.map +1 -1
- package/dist/routes/entities.test.js +16 -12
- package/dist/routes/entities.test.js.map +1 -1
- package/dist/routes/entity.d.ts +7 -2
- package/dist/routes/entity.js +14 -29
- package/dist/routes/entity.js.map +1 -1
- package/dist/routes/entity.test.js +19 -13
- package/dist/routes/entity.test.js.map +1 -1
- package/dist/routes/file.d.ts +6 -0
- package/dist/routes/file.js +67 -59
- package/dist/routes/file.js.map +1 -1
- package/dist/routes/file.test.js +99 -22
- package/dist/routes/file.test.js.map +1 -1
- package/dist/routes/files.d.ts +5 -2
- package/dist/routes/files.js +24 -39
- package/dist/routes/files.js.map +1 -1
- package/dist/routes/files.test.js +44 -21
- package/dist/routes/files.test.js.map +1 -1
- package/dist/routes/metadata.d.ts +6 -0
- package/dist/routes/metadata.js +49 -54
- package/dist/routes/metadata.js.map +1 -1
- package/dist/routes/search.d.ts +6 -2
- package/dist/routes/search.js +95 -99
- package/dist/routes/search.js.map +1 -1
- package/dist/routes/search.test.js +85 -39
- package/dist/routes/search.test.js.map +1 -1
- package/dist/test/helpers/fastify.js +2 -3
- package/dist/test/helpers/fastify.js.map +1 -1
- package/dist/test/integration.setup.d.ts +18 -0
- package/dist/test/integration.setup.js +15 -7
- package/dist/test/integration.setup.js.map +1 -1
- package/dist/test/integration.test.js +368 -2
- package/dist/test/integration.test.js.map +1 -1
- package/dist/transformers/default.d.ts +10 -18
- package/dist/transformers/default.js +41 -15
- package/dist/transformers/default.js.map +1 -1
- package/dist/transformers/default.test.js +109 -47
- package/dist/transformers/default.test.js.map +1 -1
- package/dist/transformers/transformer.test.js +12 -34
- package/dist/transformers/transformer.test.js.map +1 -1
- package/dist/types/access.d.ts +9 -0
- package/dist/types/access.js +2 -0
- package/dist/types/access.js.map +1 -0
- package/dist/types/context.d.ts +6 -0
- package/dist/types/context.js +2 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/fileHandlers.d.ts +5 -9
- package/dist/types/transformers.d.ts +4 -10
- package/dist/types/visibility.d.ts +5 -0
- package/dist/types/visibility.js +2 -0
- package/dist/types/visibility.js.map +1 -0
- package/dist/utils/access.d.ts +17 -0
- package/dist/utils/access.js +41 -0
- package/dist/utils/access.js.map +1 -0
- package/dist/utils/errors.d.ts +13 -4
- package/dist/utils/errors.js +44 -8
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/errors.test.js +14 -1
- package/dist/utils/errors.test.js.map +1 -1
- package/dist/utils/validation.d.ts +2 -0
- package/dist/utils/validation.js +8 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils/visibility.d.ts +18 -0
- package/dist/utils/visibility.js +16 -0
- package/dist/utils/visibility.js.map +1 -0
- package/package.json +5 -4
- package/src/app.test.ts +45 -66
- package/src/app.ts +85 -54
- package/src/errorHandling.test.ts +288 -0
- package/src/index.dev.ts +6 -4
- package/src/routes/__snapshots__/search.test.ts.snap +2 -2
- package/src/routes/capabilities.test.ts +8 -8
- package/src/routes/crate.test.ts +80 -19
- package/src/routes/entities.test.ts +16 -12
- package/src/routes/entities.ts +40 -59
- package/src/routes/entity.test.ts +19 -13
- package/src/routes/entity.ts +22 -35
- package/src/routes/file.test.ts +117 -22
- package/src/routes/file.ts +84 -62
- package/src/routes/files.test.ts +52 -26
- package/src/routes/files.ts +31 -47
- package/src/routes/metadata.ts +64 -58
- package/src/routes/search.test.ts +88 -39
- package/src/routes/search.ts +123 -119
- package/src/test/helpers/fastify.ts +2 -3
- package/src/test/integration.setup.ts +18 -7
- package/src/test/integration.test.ts +472 -1
- package/src/transformers/default.test.ts +139 -47
- package/src/transformers/default.ts +103 -83
- package/src/transformers/transformer.test.ts +18 -44
- package/src/types/access.ts +20 -0
- package/src/types/context.ts +15 -0
- package/src/types/fileHandlers.ts +5 -13
- package/src/types/transformers.ts +4 -32
- package/src/types/visibility.ts +18 -0
- package/src/utils/access.ts +80 -0
- package/src/utils/errors.test.ts +16 -1
- package/src/utils/errors.ts +67 -10
- package/src/utils/validation.ts +11 -0
- package/src/utils/visibility.ts +56 -0
package/src/routes/search.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Client } from '@opensearch-project/opensearch';
|
|
2
2
|
import type { MultiBucketAggregateBaseFiltersBucket } from '@opensearch-project/opensearch/api/_types/_common.aggregations.js';
|
|
3
|
-
import type { Search_Request } from '@opensearch-project/opensearch/api/index.js';
|
|
3
|
+
import type { Search_Request, Search_Response } from '@opensearch-project/opensearch/api/index.js';
|
|
4
4
|
import type { FastifyPluginAsync } from 'fastify';
|
|
5
5
|
import type { ZodTypeProvider } from 'fastify-type-provider-zod';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import type { PrismaClient } from '../generated/prisma/client.js';
|
|
8
|
-
import {
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
8
|
+
import { applyTransformers, authoriseEntities } from '../transformers/default.js';
|
|
9
|
+
import type { AccessFunction } from '../types/access.js';
|
|
10
|
+
import type { EntityTransformer } from '../types/transformers.js';
|
|
11
|
+
import type { EntityVisibilityFilter, SearchVisibilityFilter } from '../types/visibility.js';
|
|
12
|
+
import { createError, ERROR_CODES } from '../utils/errors.js';
|
|
11
13
|
import type { OpensearchQueryBuilder } from '../utils/queryBuilder.js';
|
|
12
14
|
|
|
13
15
|
const boundingBoxSchema = z.object({
|
|
@@ -36,13 +38,23 @@ const searchParamsSchema = z.object({
|
|
|
36
38
|
type SearchRouteOptions = {
|
|
37
39
|
prisma: PrismaClient;
|
|
38
40
|
opensearch: Client;
|
|
39
|
-
|
|
41
|
+
access: AccessFunction;
|
|
40
42
|
entityTransformers?: EntityTransformer[];
|
|
41
43
|
queryBuilder: OpensearchQueryBuilder;
|
|
44
|
+
entityVisibilityFilter: EntityVisibilityFilter;
|
|
45
|
+
searchVisibilityFilter: SearchVisibilityFilter;
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
const search: FastifyPluginAsync<SearchRouteOptions> = async (fastify, opts) => {
|
|
45
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
prisma,
|
|
51
|
+
opensearch,
|
|
52
|
+
access,
|
|
53
|
+
entityTransformers = [],
|
|
54
|
+
queryBuilder,
|
|
55
|
+
entityVisibilityFilter,
|
|
56
|
+
searchVisibilityFilter,
|
|
57
|
+
} = opts;
|
|
46
58
|
fastify.withTypeProvider<ZodTypeProvider>().post(
|
|
47
59
|
'/search',
|
|
48
60
|
{
|
|
@@ -53,138 +65,130 @@ const search: FastifyPluginAsync<SearchRouteOptions> = async (fastify, opts) =>
|
|
|
53
65
|
async (request, reply) => {
|
|
54
66
|
const { searchType, query, filters, boundingBox, geohashPrecision, limit, offset, sort, order } = request.body;
|
|
55
67
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
const context = { request, fastify };
|
|
69
|
+
const [visibilityWhere, visibilityQuery] = await Promise.all([
|
|
70
|
+
entityVisibilityFilter(context),
|
|
71
|
+
searchVisibilityFilter(context),
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
const opensearchQuery: Search_Request = {
|
|
75
|
+
index: 'entities',
|
|
76
|
+
body: {
|
|
77
|
+
query: {
|
|
78
|
+
bool: {
|
|
79
|
+
must: [queryBuilder.buildQuery(searchType, query, filters, boundingBox)],
|
|
80
|
+
filter: [visibilityQuery],
|
|
67
81
|
},
|
|
68
|
-
sort: queryBuilder.buildSort(sort, order),
|
|
69
|
-
from: offset,
|
|
70
|
-
size: limit,
|
|
71
82
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
throw new Error('Invalid search response: missing hits data');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const entityIds = response.body.hits.hits.map((hit) => hit._source?.id as string | undefined).filter(Boolean);
|
|
81
|
-
|
|
82
|
-
const dbEntities = await prisma.entity.findMany({
|
|
83
|
-
where: {
|
|
84
|
-
id: {
|
|
85
|
-
in: entityIds,
|
|
83
|
+
aggs: queryBuilder.buildAggregations(geohashPrecision, boundingBox),
|
|
84
|
+
highlight: {
|
|
85
|
+
fields: {
|
|
86
|
+
name: {},
|
|
87
|
+
description: {},
|
|
86
88
|
},
|
|
87
89
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
sort: queryBuilder.buildSort(sort, order),
|
|
91
|
+
from: offset,
|
|
92
|
+
size: limit,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
fastify.log.debug(opensearchQuery);
|
|
96
|
+
let response: Search_Response;
|
|
97
|
+
try {
|
|
98
|
+
response = await opensearch.search(opensearchQuery);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
const { statusCode, message } = error as Error & { statusCode?: number };
|
|
101
|
+
// OpenSearch returns 400 for malformed queries (e.g. invalid query_string syntax)
|
|
102
|
+
if (statusCode !== 400) {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
90
105
|
|
|
91
|
-
|
|
106
|
+
fastify.log.warn(`Invalid search query: ${message}`);
|
|
92
107
|
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
return reply.code(422).send(createError(ERROR_CODES.VALIDATION_ERROR, message));
|
|
109
|
+
}
|
|
95
110
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
throw new Error('Missing id in search hit');
|
|
100
|
-
}
|
|
111
|
+
if (!response.body?.hits?.hits) {
|
|
112
|
+
throw new Error('Invalid search response: missing hits data');
|
|
113
|
+
}
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
if (!dbEntity) {
|
|
104
|
-
fastify.log.warn(`Entity ${hit._source.id} found in OpenSearch but not in database`);
|
|
115
|
+
const entityIds = response.body.hits.hits.map((hit) => hit._source?.id as string | undefined).filter(Boolean);
|
|
105
116
|
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
const dbEntities = await prisma.entity.findMany({
|
|
118
|
+
where: {
|
|
119
|
+
AND: [{ id: { in: entityIds } }, visibilityWhere],
|
|
120
|
+
},
|
|
121
|
+
include: { file: { select: { id: true } } },
|
|
122
|
+
});
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
...base,
|
|
112
|
-
memberOf: base.memberOf ? (refMap.get(base.memberOf) ?? null) : null,
|
|
113
|
-
rootCollection: base.rootCollection ? (refMap.get(base.rootCollection) ?? null) : null,
|
|
114
|
-
};
|
|
115
|
-
const authorisedEntity = await accessTransformer(standardEntity, { request, fastify });
|
|
116
|
-
|
|
117
|
-
let result = authorisedEntity;
|
|
118
|
-
for (const transformer of entityTransformers) {
|
|
119
|
-
result = await transformer(result, { request, fastify });
|
|
120
|
-
}
|
|
124
|
+
const authorisedEntities = await authoriseEntities(dbEntities, prisma, access, context);
|
|
125
|
+
const entityMap = new Map(authorisedEntities.map((entity) => [entity.id, entity]));
|
|
121
126
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
).then((results) => results.filter(Boolean));
|
|
132
|
-
|
|
133
|
-
const facets: Record<string, Array<{ name: string; count: number }>> = {};
|
|
134
|
-
if (response.body.aggregations) {
|
|
135
|
-
Object.keys(response.body.aggregations).forEach((key) => {
|
|
136
|
-
if (key !== 'geohash_grid') {
|
|
137
|
-
const agg = response.body.aggregations?.[key] as MultiBucketAggregateBaseFiltersBucket;
|
|
138
|
-
if (agg?.buckets && Array.isArray(agg.buckets)) {
|
|
139
|
-
facets[key] = agg.buckets.map((bucket) => ({
|
|
140
|
-
name: bucket.key,
|
|
141
|
-
count: bucket.doc_count,
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
127
|
+
const entities = await Promise.all(
|
|
128
|
+
response.body.hits.hits.map(async (hit) => {
|
|
129
|
+
if (!hit._source?.id) {
|
|
130
|
+
throw new Error('Missing id in search hit');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const authorisedEntity = entityMap.get(hit._source.id);
|
|
134
|
+
if (!authorisedEntity) {
|
|
135
|
+
fastify.log.warn(`Entity ${hit._source.id} found in OpenSearch but missing or not visible in database`);
|
|
147
136
|
|
|
148
|
-
|
|
149
|
-
if (response.body.aggregations?.geohash_grid) {
|
|
150
|
-
const geohashAgg = response.body.aggregations.geohash_grid as MultiBucketAggregateBaseFiltersBucket;
|
|
151
|
-
if (geohashAgg?.buckets && Array.isArray(geohashAgg.buckets)) {
|
|
152
|
-
geohashAgg.buckets.forEach((bucket) => {
|
|
153
|
-
geohashGrid ||= {};
|
|
154
|
-
geohashGrid[bucket.key] = bucket.doc_count;
|
|
155
|
-
});
|
|
137
|
+
return null;
|
|
156
138
|
}
|
|
157
|
-
}
|
|
158
139
|
|
|
159
|
-
|
|
160
|
-
const total =
|
|
161
|
-
typeof response.body.hits.total === 'number'
|
|
162
|
-
? response.body.hits.total
|
|
163
|
-
: response.body.hits.total?.value || 0;
|
|
164
|
-
|
|
165
|
-
const result = {
|
|
166
|
-
total,
|
|
167
|
-
searchTime: response.body.took,
|
|
168
|
-
entities,
|
|
169
|
-
facets: Object.keys(facets).length > 0 ? facets : undefined,
|
|
170
|
-
geohashGrid,
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
return result;
|
|
174
|
-
} catch (error) {
|
|
175
|
-
const err = error as Error;
|
|
140
|
+
const result = await applyTransformers(authorisedEntity, entityTransformers, context);
|
|
176
141
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
142
|
+
// Add search-specific metadata
|
|
143
|
+
return {
|
|
144
|
+
...(result as Record<string, unknown>),
|
|
145
|
+
searchExtra: {
|
|
146
|
+
score: hit._score,
|
|
147
|
+
highlight: hit.highlight,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}),
|
|
151
|
+
).then((results) => results.filter(Boolean));
|
|
152
|
+
|
|
153
|
+
const facets: Record<string, Array<{ name: string; count: number }>> = {};
|
|
154
|
+
if (response.body.aggregations) {
|
|
155
|
+
Object.keys(response.body.aggregations).forEach((key) => {
|
|
156
|
+
if (key !== 'geohash_grid') {
|
|
157
|
+
const agg = response.body.aggregations?.[key] as MultiBucketAggregateBaseFiltersBucket;
|
|
158
|
+
if (agg?.buckets && Array.isArray(agg.buckets)) {
|
|
159
|
+
facets[key] = agg.buckets.map((bucket) => ({
|
|
160
|
+
name: bucket.key,
|
|
161
|
+
count: bucket.doc_count,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
180
167
|
|
|
181
|
-
|
|
168
|
+
let geohashGrid: Record<string, number> | undefined;
|
|
169
|
+
if (response.body.aggregations?.geohash_grid) {
|
|
170
|
+
const geohashAgg = response.body.aggregations.geohash_grid as MultiBucketAggregateBaseFiltersBucket;
|
|
171
|
+
if (geohashAgg?.buckets && Array.isArray(geohashAgg.buckets)) {
|
|
172
|
+
geohashAgg.buckets.forEach((bucket) => {
|
|
173
|
+
geohashGrid ||= {};
|
|
174
|
+
geohashGrid[bucket.key] = bucket.doc_count;
|
|
175
|
+
});
|
|
182
176
|
}
|
|
177
|
+
}
|
|
183
178
|
|
|
184
|
-
|
|
179
|
+
/* v8 ignore next 2 -- Not sure how to force opensearch to hit the other path -- @preserve */
|
|
180
|
+
const total =
|
|
181
|
+
typeof response.body.hits.total === 'number' ? response.body.hits.total : response.body.hits.total?.value || 0;
|
|
185
182
|
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
const result = {
|
|
184
|
+
total,
|
|
185
|
+
searchTime: response.body.took,
|
|
186
|
+
entities,
|
|
187
|
+
facets: Object.keys(facets).length > 0 ? facets : undefined,
|
|
188
|
+
geohashGrid,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return result;
|
|
188
192
|
},
|
|
189
193
|
);
|
|
190
194
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Client } from '@opensearch-project/opensearch';
|
|
2
2
|
import type { FastifyInstance } from 'fastify';
|
|
3
3
|
import Fastify from 'fastify';
|
|
4
|
-
import { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod';
|
|
5
4
|
import { mockDeep, mockReset } from 'vitest-mock-extended';
|
|
6
5
|
|
|
7
6
|
import type { PrismaClient } from '../../generated/prisma/client.js';
|
|
7
|
+
import { setupValidation } from '../../utils/validation.js';
|
|
8
8
|
|
|
9
9
|
export let fastify: FastifyInstance;
|
|
10
10
|
export const prisma = mockDeep<PrismaClient>();
|
|
@@ -16,8 +16,7 @@ export const fastifyBefore = async () => {
|
|
|
16
16
|
|
|
17
17
|
fastify = Fastify({ logger: false });
|
|
18
18
|
|
|
19
|
-
fastify
|
|
20
|
-
fastify.setSerializerCompiler(serializerCompiler);
|
|
19
|
+
setupValidation(fastify);
|
|
21
20
|
|
|
22
21
|
return fastify;
|
|
23
22
|
};
|
|
@@ -2,7 +2,8 @@ import { Client } from '@opensearch-project/opensearch';
|
|
|
2
2
|
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
|
|
3
3
|
import type { FastifyInstance } from 'fastify';
|
|
4
4
|
import Fastify from 'fastify';
|
|
5
|
-
import
|
|
5
|
+
import type { Options } from '../app.js';
|
|
6
|
+
import app, { AllPublicAccess, AllVisibleEntityFilter, AllVisibleSearchFilter } from '../app.js';
|
|
6
7
|
import { PrismaClient } from '../generated/prisma/client.js';
|
|
7
8
|
|
|
8
9
|
let fastify: FastifyInstance;
|
|
@@ -32,13 +33,18 @@ export async function setupIntegrationTests() {
|
|
|
32
33
|
node: process.env.OPENSEARCH_URL,
|
|
33
34
|
});
|
|
34
35
|
|
|
35
|
-
fastify =
|
|
36
|
+
fastify = await buildTestApp();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function buildTestApp(overrides: Partial<Options> = {}) {
|
|
40
|
+
const instance = Fastify({ logger: false });
|
|
36
41
|
|
|
37
|
-
await
|
|
42
|
+
await instance.register(app, {
|
|
38
43
|
prisma,
|
|
39
44
|
opensearch,
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
access: AllPublicAccess,
|
|
46
|
+
entityVisibilityFilter: AllVisibleEntityFilter,
|
|
47
|
+
searchVisibilityFilter: AllVisibleSearchFilter,
|
|
42
48
|
fileHandler: {
|
|
43
49
|
get: async () => {
|
|
44
50
|
throw new Error('File handler not implemented in integration tests');
|
|
@@ -55,9 +61,12 @@ export async function setupIntegrationTests() {
|
|
|
55
61
|
throw new Error('RO-Crate head handler not implemented in integration tests');
|
|
56
62
|
},
|
|
57
63
|
},
|
|
64
|
+
...overrides,
|
|
58
65
|
});
|
|
59
66
|
|
|
60
|
-
await
|
|
67
|
+
await instance.ready();
|
|
68
|
+
|
|
69
|
+
return instance;
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
export async function teardownIntegrationTests() {
|
|
@@ -103,6 +112,7 @@ export async function seedTestData() {
|
|
|
103
112
|
rootCollection: 'http://example.com/entity/1',
|
|
104
113
|
metadataLicenseId: 'https://creativecommons.org/licenses/by/4.0/',
|
|
105
114
|
contentLicenseId: 'https://creativecommons.org/licenses/by/4.0/',
|
|
115
|
+
meta: { draft: true },
|
|
106
116
|
createdAt: new Date(),
|
|
107
117
|
updatedAt: new Date(),
|
|
108
118
|
},
|
|
@@ -126,7 +136,7 @@ export async function seedTestData() {
|
|
|
126
136
|
memberOf: 'http://example.com/entity/2',
|
|
127
137
|
rootCollection: 'http://example.com/entity/1',
|
|
128
138
|
metadataLicenseId: 'https://creativecommons.org/licenses/by/4.0/',
|
|
129
|
-
contentLicenseId: 'https://
|
|
139
|
+
contentLicenseId: 'https://example.com/licences/restricted',
|
|
130
140
|
createdAt: new Date(),
|
|
131
141
|
updatedAt: new Date(),
|
|
132
142
|
},
|
|
@@ -139,6 +149,7 @@ export async function seedTestData() {
|
|
|
139
149
|
rootCollection: 'http://example.com/entity/1',
|
|
140
150
|
metadataLicenseId: 'https://creativecommons.org/licenses/by/4.0/',
|
|
141
151
|
contentLicenseId: 'https://creativecommons.org/licenses/by/4.0/',
|
|
152
|
+
meta: { draft: true },
|
|
142
153
|
createdAt: new Date(),
|
|
143
154
|
updatedAt: new Date(),
|
|
144
155
|
},
|