@almadar/core 10.88.0 → 10.90.0
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/builders.d.ts +3 -3
- package/dist/builders.js +9 -2
- package/dist/builders.js.map +1 -1
- package/dist/{effect-DMA97JxX.d.ts → effect-7jQQxiIt.d.ts} +58 -42
- package/dist/{entityAccess-B5_Y9zF5.d.ts → entityAccess-CpHfCQA3.d.ts} +1 -1
- package/dist/factory/index.d.ts +4 -4
- package/dist/factory/index.js +467 -9
- package/dist/factory/index.js.map +1 -1
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +9 -2
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-CYE40P_7.d.ts → index-BresfHJy.d.ts} +63 -6
- package/dist/index.d.ts +34 -12
- package/dist/index.js +582 -17
- package/dist/index.js.map +1 -1
- package/dist/mock/index.d.ts +54 -5
- package/dist/mock/index.js +33 -3
- package/dist/mock/index.js.map +1 -1
- package/dist/patterns/component-mapping.json +6 -1
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +1160 -14
- package/dist/patterns/index.js +545 -12
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/integrators-registry.json +72 -1
- package/dist/patterns/patterns-registry.json +461 -8
- package/dist/patterns/registry.json +461 -8
- package/dist/patterns/services-registry.json +150 -64
- package/dist/{schema-ex9koAoK.d.ts → schema-C52juBr8.d.ts} +500 -325
- package/dist/{trait-BJAX5TJK.d.ts → trait-CFiL1YUN.d.ts} +98 -55
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +11 -6
- package/dist/types/index.js.map +1 -1
- package/dist/{types-kHQhEEXQ.d.ts → types-BgC8ETnl.d.ts} +2 -2
- package/package.json +1 -1
package/dist/mock/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { f as OrbitalEntity, a as EntityPersistence, E as EntityField, F as FieldValue, g as EntityRow } from '../effect-
|
|
2
|
-
import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-
|
|
1
|
+
import { f as OrbitalEntity, a as EntityPersistence, E as EntityField, F as FieldValue, g as EntityRow } from '../effect-7jQQxiIt.js';
|
|
2
|
+
import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-C52juBr8.js';
|
|
3
3
|
import { S as SExpr } from '../expression-WfTp2arD.js';
|
|
4
|
-
export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-
|
|
4
|
+
export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-CpHfCQA3.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../json-D8gmyK3l.js';
|
|
7
|
-
import '../trait-
|
|
7
|
+
import '../trait-CFiL1YUN.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Lightweight seeded pseudo-random generator for mock data.
|
|
@@ -278,4 +278,53 @@ declare function sampleRow(entity: SampleEntity, ctx: Omit<SampleContext, 'entit
|
|
|
278
278
|
/** `count` rows, 1-based, honoring the runtime-singleton gate. */
|
|
279
279
|
declare function sampleRows(entity: SampleEntity, count: number, strategy: SampleStrategy): EntityRow[];
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
/**
|
|
282
|
+
* Deterministic self-relation forest — the ONE seeding policy for a
|
|
283
|
+
* self-referential relation field (`Tag.parentId : Tag`, `ChatMessage.replies
|
|
284
|
+
* : [ChatMessage]`), shared by every mock seeder.
|
|
285
|
+
*
|
|
286
|
+
* Before this module each seeder invented its own policy: the interpreted
|
|
287
|
+
* path (`MockPersistenceAdapter`) built a deterministic binary forest for
|
|
288
|
+
* `one`/`many-to-one` self-relations but handed `many` self-relations 2-4
|
|
289
|
+
* RANDOM other-row ids, and the compiled path's seeder (`MockDataService`)
|
|
290
|
+
* assigned every relation field — self or cross-entity, any cardinality — one
|
|
291
|
+
* random id with no forest at all. Random cross-linking on a `many`
|
|
292
|
+
* self-relation means every row ends up referenced by several others, so
|
|
293
|
+
* under a default `onDelete: restrict` policy nothing is ever deletable — the
|
|
294
|
+
* `std-realtime-chat` `ChatMessage.replies` case this module fixes.
|
|
295
|
+
*
|
|
296
|
+
* The forest guarantees exactly one root (row 0, never referenced by any
|
|
297
|
+
* other row) and no cycles: row *i*'s parent is always row ⌊(i−1)/2⌋, a
|
|
298
|
+
* strictly smaller index.
|
|
299
|
+
*
|
|
300
|
+
* @packageDocumentation
|
|
301
|
+
*/
|
|
302
|
+
|
|
303
|
+
/** Parent/children lookups over `rowIds`, in binary-forest order. */
|
|
304
|
+
interface SelfRelationForest {
|
|
305
|
+
/** Row *i*'s parent id, or `''` for the root (row 0). */
|
|
306
|
+
parentOf: (index: number) => string | '';
|
|
307
|
+
/** The (0, 1, or 2) ids of rows whose parent is row *i*. */
|
|
308
|
+
childrenOf: (index: number) => string[];
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Build the forest over a set of already-generated row ids. Deterministic —
|
|
312
|
+
* the same `rowIds` array always produces the same forest, no PRNG involved.
|
|
313
|
+
*/
|
|
314
|
+
declare function selfRelationForest(rowIds: readonly string[]): SelfRelationForest;
|
|
315
|
+
/**
|
|
316
|
+
* Write a self-relation field over the forest derived from `rows`' own ids —
|
|
317
|
+
* the scalar parent form for `one`/`many-to-one`, the children-id-list form
|
|
318
|
+
* for `many`/`one-to-many`/`many-to-many`.
|
|
319
|
+
*
|
|
320
|
+
* `isExcluded`, when given, is asked per row/index before writing; each
|
|
321
|
+
* seeder passes in whatever cell it has already deliberately stamped (an
|
|
322
|
+
* owner column, a pre-authored value) so this pass never overwrites it — the
|
|
323
|
+
* exclusion RULE stays with the caller, who alone knows what it stamped.
|
|
324
|
+
*/
|
|
325
|
+
declare function linkSelfRelationField(rows: ReadonlyArray<EntityRow>, field: {
|
|
326
|
+
readonly name: string;
|
|
327
|
+
readonly cardinality?: string;
|
|
328
|
+
}, isExcluded?: (row: EntityRow, index: number) => boolean): void;
|
|
329
|
+
|
|
330
|
+
export { IMAGE_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, type SelfRelationForest, collectUserFieldLiterals, identityEntitiesOf, identityEntityName, identityEntityNames, isDeclaredDefaultHonored, linkSelfRelationField, ownerColumnsFromPolicy, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomStraddlingDate, randomUrl, randomUuid, randomWords, roleSatisfyingPolicy, roleVocabularyOf, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, selfRelationForest, shuffleArray };
|
package/dist/mock/index.js
CHANGED
|
@@ -670,7 +670,7 @@ var VISUAL_STYLES = ["pixel", "vector", "hd", "1-bit", "isometric"];
|
|
|
670
670
|
var VisualStyleSchema = z.enum(VISUAL_STYLES);
|
|
671
671
|
var ASSET_DIMENSIONS = ["2d", "3d"];
|
|
672
672
|
var AssetDimensionSchema = z.enum(ASSET_DIMENSIONS);
|
|
673
|
-
var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1"];
|
|
673
|
+
var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1", "4:1", "5:3", "1:2"];
|
|
674
674
|
var AssetAspectSchema = z.enum(ASSET_ASPECTS);
|
|
675
675
|
var ANIMATION_NAMES = ["idle", "walk", "skate", "jump", "fall", "attack", "hit", "death"];
|
|
676
676
|
z.enum(ANIMATION_NAMES);
|
|
@@ -740,7 +740,9 @@ SemanticAssetRefSchema.extend({
|
|
|
740
740
|
atlas: z.string().optional(),
|
|
741
741
|
sprite: z.string().optional(),
|
|
742
742
|
name: z.string().optional(),
|
|
743
|
-
thumbnailUrl: z.string().optional()
|
|
743
|
+
thumbnailUrl: z.string().optional(),
|
|
744
|
+
prompt: z.string().optional(),
|
|
745
|
+
choreography: z.record(z.string(), z.array(z.string())).optional()
|
|
744
746
|
});
|
|
745
747
|
var AssetCatalogEntrySchema = z.object({
|
|
746
748
|
url: z.string(),
|
|
@@ -870,6 +872,9 @@ z.object({
|
|
|
870
872
|
visual_prompt: z.string().optional(),
|
|
871
873
|
assetRef: SemanticAssetRefSchema.optional()
|
|
872
874
|
});
|
|
875
|
+
var FieldValueSchema = z.lazy(
|
|
876
|
+
() => z.union([z.string(), z.number(), z.boolean(), z.date(), z.null(), z.array(FieldValueSchema), z.record(FieldValueSchema.optional())])
|
|
877
|
+
);
|
|
873
878
|
function isFieldValue(value) {
|
|
874
879
|
if (value === null) return true;
|
|
875
880
|
const kind = typeof value;
|
|
@@ -1108,6 +1113,31 @@ function sampleRows(entity, count, strategy) {
|
|
|
1108
1113
|
return rows;
|
|
1109
1114
|
}
|
|
1110
1115
|
|
|
1111
|
-
|
|
1116
|
+
// src/mock/relationForest.ts
|
|
1117
|
+
function selfRelationForest(rowIds) {
|
|
1118
|
+
return {
|
|
1119
|
+
parentOf: (index) => index === 0 ? "" : rowIds[Math.floor((index - 1) / 2)] ?? "",
|
|
1120
|
+
childrenOf: (index) => {
|
|
1121
|
+
const children = [];
|
|
1122
|
+
const left = 2 * index + 1;
|
|
1123
|
+
const right = 2 * index + 2;
|
|
1124
|
+
if (left < rowIds.length) children.push(rowIds[left]);
|
|
1125
|
+
if (right < rowIds.length) children.push(rowIds[right]);
|
|
1126
|
+
return children;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
var SCALAR_PARENT_CARDINALITIES = /* @__PURE__ */ new Set(["one", "many-to-one"]);
|
|
1131
|
+
function linkSelfRelationField(rows, field, isExcluded) {
|
|
1132
|
+
const rowIds = rows.map((row) => row.id ?? "");
|
|
1133
|
+
const forest = selfRelationForest(rowIds);
|
|
1134
|
+
const scalar = SCALAR_PARENT_CARDINALITIES.has(field.cardinality ?? "many");
|
|
1135
|
+
rows.forEach((row, index) => {
|
|
1136
|
+
if (isExcluded?.(row, index)) return;
|
|
1137
|
+
row[field.name] = scalar ? forest.parentOf(index) : forest.childrenOf(index);
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export { IMAGE_FIELD_NAMES, collectUserFieldLiterals, entityAccessPolicies, entityAccessPoliciesByStoreKey, entityAccessTable, identityEntitiesOf, identityEntityName, identityEntityNames, isDeclaredDefaultHonored, linkSelfRelationField, ownerColumnsFromPolicy, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomStraddlingDate, randomUrl, randomUuid, randomWords, roleSatisfyingPolicy, roleVocabularyOf, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, selfRelationForest, shuffleArray };
|
|
1112
1142
|
//# sourceMappingURL=index.js.map
|
|
1113
1143
|
//# sourceMappingURL=index.js.map
|