@almadar/core 10.89.0 → 10.91.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 +11 -3
- package/dist/builders.js.map +1 -1
- package/dist/{effect-CdLBg9zL.d.ts → effect-Bt8vKHwd.d.ts} +66 -42
- package/dist/{entityAccess-BmZHpQUv.d.ts → entityAccess-BdDX85rM.d.ts} +1 -1
- package/dist/factory/index.d.ts +4 -4
- package/dist/factory/index.js +662 -49
- package/dist/factory/index.js.map +1 -1
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +11 -3
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/i18n/index.js +12 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-CV_iM5Cm.d.ts → index-rOBf1Oag.d.ts} +83 -6
- package/dist/index.d.ts +34 -12
- package/dist/index.js +975 -57
- package/dist/index.js.map +1 -1
- package/dist/mock/index.d.ts +60 -5
- package/dist/mock/index.js +35 -4
- 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 +1875 -53
- package/dist/patterns/index.js +930 -51
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/integrators-registry.json +264 -1
- package/dist/patterns/patterns-registry.json +654 -47
- package/dist/patterns/registry.json +654 -47
- package/dist/patterns/services-registry.json +284 -1
- package/dist/{schema-DYC_RnBX.d.ts → schema-ovDTDQz9.d.ts} +495 -323
- package/dist/{trait-DmWdtKlP.d.ts → trait-C3e3btfn.d.ts} +98 -55
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +13 -7
- package/dist/types/index.js.map +1 -1
- package/dist/{types-DdK77hq2.d.ts → types-rh0naR6C.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-Bt8vKHwd.js';
|
|
2
|
+
import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-ovDTDQz9.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-BdDX85rM.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../json-D8gmyK3l.js';
|
|
7
|
-
import '../trait-
|
|
7
|
+
import '../trait-C3e3btfn.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Lightweight seeded pseudo-random generator for mock data.
|
|
@@ -227,6 +227,12 @@ declare function roleSatisfyingPolicy(policy: SExpr | undefined, identity: Orbit
|
|
|
227
227
|
* Rust can reproduce and therefore the one parity is asserted on.
|
|
228
228
|
*/
|
|
229
229
|
type SampleStrategy = 'seeded' | 'index';
|
|
230
|
+
/** Framework-stamped columns — the row's id and audit timestamps, minted by
|
|
231
|
+
* the store itself, never synthesized here and never a REQUIRED column a
|
|
232
|
+
* caller must supply (`EffectExecutor`'s persist-create check, `@almadar/
|
|
233
|
+
* runtime`'s mock store stamping). The one owner; every caller imports this
|
|
234
|
+
* instead of repeating the name list. */
|
|
235
|
+
declare const RESERVED_FIELD_NAMES: ReadonlySet<string>;
|
|
230
236
|
interface SampleEntity {
|
|
231
237
|
readonly name: string;
|
|
232
238
|
readonly persistence?: EntityPersistence;
|
|
@@ -278,4 +284,53 @@ declare function sampleRow(entity: SampleEntity, ctx: Omit<SampleContext, 'entit
|
|
|
278
284
|
/** `count` rows, 1-based, honoring the runtime-singleton gate. */
|
|
279
285
|
declare function sampleRows(entity: SampleEntity, count: number, strategy: SampleStrategy): EntityRow[];
|
|
280
286
|
|
|
281
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Deterministic self-relation forest — the ONE seeding policy for a
|
|
289
|
+
* self-referential relation field (`Tag.parentId : Tag`, `ChatMessage.replies
|
|
290
|
+
* : [ChatMessage]`), shared by every mock seeder.
|
|
291
|
+
*
|
|
292
|
+
* Before this module each seeder invented its own policy: the interpreted
|
|
293
|
+
* path (`MockPersistenceAdapter`) built a deterministic binary forest for
|
|
294
|
+
* `one`/`many-to-one` self-relations but handed `many` self-relations 2-4
|
|
295
|
+
* RANDOM other-row ids, and the compiled path's seeder (`MockDataService`)
|
|
296
|
+
* assigned every relation field — self or cross-entity, any cardinality — one
|
|
297
|
+
* random id with no forest at all. Random cross-linking on a `many`
|
|
298
|
+
* self-relation means every row ends up referenced by several others, so
|
|
299
|
+
* under a default `onDelete: restrict` policy nothing is ever deletable — the
|
|
300
|
+
* `std-realtime-chat` `ChatMessage.replies` case this module fixes.
|
|
301
|
+
*
|
|
302
|
+
* The forest guarantees exactly one root (row 0, never referenced by any
|
|
303
|
+
* other row) and no cycles: row *i*'s parent is always row ⌊(i−1)/2⌋, a
|
|
304
|
+
* strictly smaller index.
|
|
305
|
+
*
|
|
306
|
+
* @packageDocumentation
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
/** Parent/children lookups over `rowIds`, in binary-forest order. */
|
|
310
|
+
interface SelfRelationForest {
|
|
311
|
+
/** Row *i*'s parent id, or `''` for the root (row 0). */
|
|
312
|
+
parentOf: (index: number) => string | '';
|
|
313
|
+
/** The (0, 1, or 2) ids of rows whose parent is row *i*. */
|
|
314
|
+
childrenOf: (index: number) => string[];
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Build the forest over a set of already-generated row ids. Deterministic —
|
|
318
|
+
* the same `rowIds` array always produces the same forest, no PRNG involved.
|
|
319
|
+
*/
|
|
320
|
+
declare function selfRelationForest(rowIds: readonly string[]): SelfRelationForest;
|
|
321
|
+
/**
|
|
322
|
+
* Write a self-relation field over the forest derived from `rows`' own ids —
|
|
323
|
+
* the scalar parent form for `one`/`many-to-one`, the children-id-list form
|
|
324
|
+
* for `many`/`one-to-many`/`many-to-many`.
|
|
325
|
+
*
|
|
326
|
+
* `isExcluded`, when given, is asked per row/index before writing; each
|
|
327
|
+
* seeder passes in whatever cell it has already deliberately stamped (an
|
|
328
|
+
* owner column, a pre-authored value) so this pass never overwrites it — the
|
|
329
|
+
* exclusion RULE stays with the caller, who alone knows what it stamped.
|
|
330
|
+
*/
|
|
331
|
+
declare function linkSelfRelationField(rows: ReadonlyArray<EntityRow>, field: {
|
|
332
|
+
readonly name: string;
|
|
333
|
+
readonly cardinality?: string;
|
|
334
|
+
}, isExcluded?: (row: EntityRow, index: number) => boolean): void;
|
|
335
|
+
|
|
336
|
+
export { IMAGE_FIELD_NAMES, RESERVED_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
|
@@ -573,7 +573,8 @@ var EntityFieldSchema = z.lazy(() => {
|
|
|
573
573
|
properties: z.record(EntityFieldSchema).optional(),
|
|
574
574
|
intrinsic: z.boolean().optional(),
|
|
575
575
|
description: z.string().optional(),
|
|
576
|
-
synonyms: z.string().optional()
|
|
576
|
+
synonyms: z.string().optional(),
|
|
577
|
+
mergedFrom: z.string().optional()
|
|
577
578
|
};
|
|
578
579
|
function scalarVariant(t) {
|
|
579
580
|
return z.object({
|
|
@@ -670,7 +671,7 @@ var VISUAL_STYLES = ["pixel", "vector", "hd", "1-bit", "isometric"];
|
|
|
670
671
|
var VisualStyleSchema = z.enum(VISUAL_STYLES);
|
|
671
672
|
var ASSET_DIMENSIONS = ["2d", "3d"];
|
|
672
673
|
var AssetDimensionSchema = z.enum(ASSET_DIMENSIONS);
|
|
673
|
-
var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1"];
|
|
674
|
+
var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1", "4:1", "5:3", "1:2"];
|
|
674
675
|
var AssetAspectSchema = z.enum(ASSET_ASPECTS);
|
|
675
676
|
var ANIMATION_NAMES = ["idle", "walk", "skate", "jump", "fall", "attack", "hit", "death"];
|
|
676
677
|
z.enum(ANIMATION_NAMES);
|
|
@@ -740,7 +741,9 @@ SemanticAssetRefSchema.extend({
|
|
|
740
741
|
atlas: z.string().optional(),
|
|
741
742
|
sprite: z.string().optional(),
|
|
742
743
|
name: z.string().optional(),
|
|
743
|
-
thumbnailUrl: z.string().optional()
|
|
744
|
+
thumbnailUrl: z.string().optional(),
|
|
745
|
+
prompt: z.string().optional(),
|
|
746
|
+
choreography: z.record(z.string(), z.array(z.string())).optional()
|
|
744
747
|
});
|
|
745
748
|
var AssetCatalogEntrySchema = z.object({
|
|
746
749
|
url: z.string(),
|
|
@@ -870,6 +873,9 @@ z.object({
|
|
|
870
873
|
visual_prompt: z.string().optional(),
|
|
871
874
|
assetRef: SemanticAssetRefSchema.optional()
|
|
872
875
|
});
|
|
876
|
+
var FieldValueSchema = z.lazy(
|
|
877
|
+
() => z.union([z.string(), z.number(), z.boolean(), z.date(), z.null(), z.array(FieldValueSchema), z.record(FieldValueSchema.optional())])
|
|
878
|
+
);
|
|
873
879
|
function isFieldValue(value) {
|
|
874
880
|
if (value === null) return true;
|
|
875
881
|
const kind = typeof value;
|
|
@@ -1108,6 +1114,31 @@ function sampleRows(entity, count, strategy) {
|
|
|
1108
1114
|
return rows;
|
|
1109
1115
|
}
|
|
1110
1116
|
|
|
1111
|
-
|
|
1117
|
+
// src/mock/relationForest.ts
|
|
1118
|
+
function selfRelationForest(rowIds) {
|
|
1119
|
+
return {
|
|
1120
|
+
parentOf: (index) => index === 0 ? "" : rowIds[Math.floor((index - 1) / 2)] ?? "",
|
|
1121
|
+
childrenOf: (index) => {
|
|
1122
|
+
const children = [];
|
|
1123
|
+
const left = 2 * index + 1;
|
|
1124
|
+
const right = 2 * index + 2;
|
|
1125
|
+
if (left < rowIds.length) children.push(rowIds[left]);
|
|
1126
|
+
if (right < rowIds.length) children.push(rowIds[right]);
|
|
1127
|
+
return children;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
var SCALAR_PARENT_CARDINALITIES = /* @__PURE__ */ new Set(["one", "many-to-one"]);
|
|
1132
|
+
function linkSelfRelationField(rows, field, isExcluded) {
|
|
1133
|
+
const rowIds = rows.map((row) => row.id ?? "");
|
|
1134
|
+
const forest = selfRelationForest(rowIds);
|
|
1135
|
+
const scalar = SCALAR_PARENT_CARDINALITIES.has(field.cardinality ?? "many");
|
|
1136
|
+
rows.forEach((row, index) => {
|
|
1137
|
+
if (isExcluded?.(row, index)) return;
|
|
1138
|
+
row[field.name] = scalar ? forest.parentOf(index) : forest.childrenOf(index);
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export { IMAGE_FIELD_NAMES, RESERVED_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
1143
|
//# sourceMappingURL=index.js.map
|
|
1113
1144
|
//# sourceMappingURL=index.js.map
|