@rizom/brain 0.2.0-alpha.80 → 0.2.0-alpha.82
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/brain.js +720 -693
- package/dist/entities.d.ts +25 -5
- package/dist/entities.js +64 -64
- package/dist/entities.js.map +11 -10
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/migrations/entity-service/0001_sleepy_mandroid.sql +1 -0
- package/dist/migrations/entity-service/meta/0001_snapshot.json +139 -0
- package/dist/migrations/entity-service/meta/_journal.json +7 -0
- package/dist/plugins.d.ts +22 -5
- package/dist/plugins.js +71 -71
- package/dist/plugins.js.map +19 -18
- package/dist/services.d.ts +19 -2
- package/dist/services.js +68 -68
- package/dist/services.js.map +10 -9
- package/dist/site.js +178 -178
- package/dist/site.js.map +34 -30
- package/dist/templates.d.ts +3 -3
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
package/dist/services.d.ts
CHANGED
|
@@ -154,6 +154,9 @@ interface EntityJobOptions {
|
|
|
154
154
|
priority?: number;
|
|
155
155
|
maxRetries?: number;
|
|
156
156
|
}
|
|
157
|
+
declare const canonicalContentVisibilitySchema: z.ZodEnum<["public", "shared", "restricted"]>;
|
|
158
|
+
type ContentVisibility = z.infer<typeof canonicalContentVisibilitySchema>;
|
|
159
|
+
type RawContentVisibility = ContentVisibility | "private";
|
|
157
160
|
/**
|
|
158
161
|
* Options for entity creation (extends EntityJobOptions with deduplication)
|
|
159
162
|
*/
|
|
@@ -196,6 +199,7 @@ interface BaseEntity<TMetadata = Record<string, unknown>> {
|
|
|
196
199
|
content: string;
|
|
197
200
|
created: string;
|
|
198
201
|
updated: string;
|
|
202
|
+
visibility: ContentVisibility;
|
|
199
203
|
metadata: TMetadata;
|
|
200
204
|
/** SHA256 hash of content for change detection */
|
|
201
205
|
contentHash: string;
|
|
@@ -204,10 +208,11 @@ interface BaseEntity<TMetadata = Record<string, unknown>> {
|
|
|
204
208
|
* Entity input type for creation - allows partial entities with optional system fields
|
|
205
209
|
* contentHash is excluded because it's computed automatically by the entity service
|
|
206
210
|
*/
|
|
207
|
-
type EntityInput<T extends BaseEntity> = Omit<T, "id" | "created" | "updated" | "contentHash"> & {
|
|
211
|
+
type EntityInput<T extends BaseEntity> = Omit<T, "id" | "created" | "updated" | "contentHash" | "visibility"> & {
|
|
208
212
|
id?: string;
|
|
209
213
|
created?: string;
|
|
210
214
|
updated?: string;
|
|
215
|
+
visibility?: RawContentVisibility;
|
|
211
216
|
};
|
|
212
217
|
/**
|
|
213
218
|
* Search result type
|
|
@@ -239,6 +244,7 @@ interface ListOptions<TMetadata = Record<string, unknown>> {
|
|
|
239
244
|
sortFields?: SortField[];
|
|
240
245
|
filter?: {
|
|
241
246
|
metadata?: Partial<TMetadata>;
|
|
247
|
+
visibilityScope?: ContentVisibility;
|
|
242
248
|
};
|
|
243
249
|
/** Filter to only entities with metadata.status = "published" */
|
|
244
250
|
publishedOnly?: boolean;
|
|
@@ -255,6 +261,7 @@ interface SearchOptions {
|
|
|
255
261
|
sortDirection?: "asc" | "desc";
|
|
256
262
|
/** Score multipliers per entity type - applied after initial search */
|
|
257
263
|
weight?: Record<string, number>;
|
|
264
|
+
visibilityScope?: ContentVisibility;
|
|
258
265
|
}
|
|
259
266
|
/**
|
|
260
267
|
* Configuration for entity type registration
|
|
@@ -276,6 +283,11 @@ interface EntityTypeConfig {
|
|
|
276
283
|
interface GetEntityRequest {
|
|
277
284
|
entityType: string;
|
|
278
285
|
id: string;
|
|
286
|
+
/**
|
|
287
|
+
* Optional visibility scope. Undefined fails closed to "public" — callers
|
|
288
|
+
* with elevated access must opt up explicitly.
|
|
289
|
+
*/
|
|
290
|
+
visibilityScope?: ContentVisibility;
|
|
279
291
|
}
|
|
280
292
|
type GetEntityRawRequest = GetEntityRequest;
|
|
281
293
|
interface ListEntitiesRequest {
|
|
@@ -325,7 +337,12 @@ interface ICoreEntityService {
|
|
|
325
337
|
getEntityTypes(): string[];
|
|
326
338
|
hasEntityType(type: string): boolean;
|
|
327
339
|
countEntities(request: CountEntitiesRequest): Promise<number>;
|
|
328
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Group counts by entity type. Fails closed: undefined visibilityScope
|
|
342
|
+
* filters to public-only counts so aggregate insights cannot reveal
|
|
343
|
+
* non-public entity existence.
|
|
344
|
+
*/
|
|
345
|
+
getEntityCounts(visibilityScope?: ContentVisibility): Promise<Array<{
|
|
329
346
|
entityType: string;
|
|
330
347
|
count: number;
|
|
331
348
|
}>>;
|