@almadar/core 10.110.0 → 10.112.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 +5 -5
- package/dist/builders.js +78 -9
- package/dist/builders.js.map +1 -1
- package/dist/{bus-CuAsuaHW.d.ts → bus-BZ9ekDiD.d.ts} +4 -2
- package/dist/{domain-Bf6sf9NR.d.ts → domain-DV8lmH3r.d.ts} +1857 -39
- package/dist/{effect-2JoKc8Zj.d.ts → effect-B9nMpTKN.d.ts} +27 -3
- package/dist/{entityAccess-CuKaSX0N.d.ts → entityAccess-Ak_ZvGXZ.d.ts} +3 -3
- package/dist/{expression-DhTTuu2W.d.ts → expression-Dz84kipC.d.ts} +4 -2
- package/dist/factory/index.d.ts +81 -7
- package/dist/factory/index.js +560 -16
- package/dist/factory/index.js.map +1 -1
- package/dist/factory-runtime/index.d.ts +5 -5
- package/dist/factory-runtime/index.js +78 -9
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/fixtures.d.ts +3 -3
- package/dist/fixtures.js +1 -1
- package/dist/fixtures.js.map +1 -1
- package/dist/i18n/index.js +36 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-bC0n_h8G.d.ts → index-DmkUMeXz.d.ts} +79 -10
- package/dist/index.d.ts +71 -20
- package/dist/index.js +17101 -5233
- package/dist/index.js.map +1 -1
- package/dist/mock/index.d.ts +20 -7
- package/dist/mock/index.js +38 -11
- package/dist/mock/index.js.map +1 -1
- package/dist/patterns/component-mapping.json +1 -1
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +1042 -228
- package/dist/patterns/index.js +392 -13
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +382 -10
- package/dist/patterns/registry.json +382 -10
- package/dist/{schema-DqBoP7Ab.d.ts → schema-C-HLTS_Q.d.ts} +2969 -44
- package/dist/state-machine/index.d.ts +1 -1
- package/dist/state-machine/index.js +32 -7
- package/dist/state-machine/index.js.map +1 -1
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/index.js +16303 -5151
- package/dist/themes/index.js.map +1 -1
- package/dist/{trait-S5uhI089.d.ts → trait-CRgDZSy_.d.ts} +10 -2
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +115 -10
- package/dist/types/index.js.map +1 -1
- package/dist/{types-2uS2WfIo.d.ts → types-C3nlpTDW.d.ts} +2 -2
- package/package.json +1 -1
- package/themes/almadar-website.json +7 -0
- package/themes/almadar.json +16 -4
- package/themes/aqua.json +420 -0
- package/themes/arabesque.json +512 -0
- package/themes/art-deco.json +340 -0
- package/themes/art-nouveau.json +340 -0
- package/themes/atelier.json +43 -187
- package/themes/bauhaus.json +330 -0
- package/themes/bloomberg-dense.json +69 -213
- package/themes/blueprint.json +330 -0
- package/themes/clay.json +53 -188
- package/themes/comic.json +107 -146
- package/themes/constructivist.json +340 -0
- package/themes/corporate.json +62 -197
- package/themes/cyberpunk.json +418 -0
- package/themes/frutiger-aero.json +422 -0
- package/themes/game-adventure.json +46 -21
- package/themes/game-rpg.json +48 -22
- package/themes/game-sci-fi.json +47 -21
- package/themes/game-ui-pack.json +39 -17
- package/themes/gazette.json +50 -194
- package/themes/glass.json +78 -201
- package/themes/gothic.json +329 -0
- package/themes/ink-wash.json +512 -0
- package/themes/kawaii.json +512 -0
- package/themes/kiosk.json +70 -200
- package/themes/linear-clean.json +67 -202
- package/themes/luxury.json +322 -0
- package/themes/mac-classic.json +330 -0
- package/themes/material.json +328 -0
- package/themes/memphis.json +337 -0
- package/themes/mid-century.json +338 -0
- package/themes/minimalist.json +60 -204
- package/themes/mudcloth.json +512 -0
- package/themes/neon.json +51 -212
- package/themes/neumorphic.json +322 -0
- package/themes/newsprint.json +330 -0
- package/themes/notion-editorial.json +51 -186
- package/themes/pixel.json +321 -0
- package/themes/prism.json +66 -69
- package/themes/retro.json +126 -165
- package/themes/risograph.json +325 -0
- package/themes/scandi.json +512 -0
- package/themes/sketch.json +330 -0
- package/themes/solarpunk.json +512 -0
- package/themes/steampunk.json +327 -0
- package/themes/swiss.json +338 -0
- package/themes/terminal.json +86 -156
- package/themes/trait-wars.json +143 -184
- package/themes/ukiyo-e.json +512 -0
- package/themes/vaporwave.json +420 -0
- package/themes/victorian.json +337 -0
- package/themes/wabi-sabi.json +512 -0
- package/themes/win95.json +324 -0
- package/themes/wireframe.json +44 -179
- package/themes/zine.json +330 -0
package/dist/mock/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { O 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-
|
|
3
|
-
import { S as SExpr } from '../expression-
|
|
4
|
-
export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-
|
|
1
|
+
import { O as OrbitalEntity, a as EntityPersistence, E as EntityField, F as FieldValue, g as EntityRow } from '../effect-B9nMpTKN.js';
|
|
2
|
+
import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-C-HLTS_Q.js';
|
|
3
|
+
import { S as SExpr } from '../expression-Dz84kipC.js';
|
|
4
|
+
export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-Ak_ZvGXZ.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../json-D8gmyK3l.js';
|
|
7
|
-
import '../trait-
|
|
8
|
-
import '../domain-
|
|
7
|
+
import '../trait-CRgDZSy_.js';
|
|
8
|
+
import '../domain-DV8lmH3r.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Lightweight seeded pseudo-random generator for mock data.
|
|
@@ -237,6 +237,8 @@ declare const RESERVED_FIELD_NAMES: ReadonlySet<string>;
|
|
|
237
237
|
interface SampleEntity {
|
|
238
238
|
readonly name: string;
|
|
239
239
|
readonly persistence?: EntityPersistence;
|
|
240
|
+
/** `[identity]`: the rows are the persona roster, so every field is filled. */
|
|
241
|
+
readonly identity?: boolean;
|
|
240
242
|
readonly fields: readonly EntityField[];
|
|
241
243
|
}
|
|
242
244
|
interface SampleContext {
|
|
@@ -246,6 +248,8 @@ interface SampleContext {
|
|
|
246
248
|
readonly strategy: SampleStrategy;
|
|
247
249
|
/** Declared persistence of the OWNING entity; undefined means persistent. */
|
|
248
250
|
readonly persistence?: EntityPersistence;
|
|
251
|
+
/** The owning entity is `[identity]`: its rows are personas, never left partly unset. */
|
|
252
|
+
readonly identity?: boolean;
|
|
249
253
|
readonly depth?: number;
|
|
250
254
|
}
|
|
251
255
|
/**
|
|
@@ -348,5 +352,14 @@ declare function linkSelfRelationField(rows: ReadonlyArray<EntityRow>, field: {
|
|
|
348
352
|
readonly name: string;
|
|
349
353
|
readonly cardinality?: string;
|
|
350
354
|
}, isExcluded?: (row: EntityRow, index: number) => boolean): void;
|
|
355
|
+
/**
|
|
356
|
+
* A cross-entity relation value for row `index` (0-based), deterministic and PRNG-free so every
|
|
357
|
+
* seeder links identically whatever else it draws: a scalar relation takes `targetIds[index % n]`;
|
|
358
|
+
* a list takes 2 (even rows) or 3 (odd rows) consecutive distinct ids from offset `index`. Twin of
|
|
359
|
+
* `orbital-core/src/runtime/seed.rs` `link_relation_fields`. `undefined` when there is no target.
|
|
360
|
+
*/
|
|
361
|
+
declare function crossRelationValue(targetIds: readonly string[], index: number, cardinality?: string): string | string[] | undefined;
|
|
362
|
+
/** A relation cell a seeder may fill: missing, or the `''` / `[]` placeholder `sampleRow` writes. */
|
|
363
|
+
declare function isRelationPlaceholder(value: EntityRow[string]): boolean;
|
|
351
364
|
|
|
352
|
-
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 };
|
|
365
|
+
export { IMAGE_FIELD_NAMES, RESERVED_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, type SelfRelationForest, collectUserFieldLiterals, crossRelationValue, identityEntitiesOf, identityEntityName, identityEntityNames, isDeclaredDefaultHonored, isRelationPlaceholder, 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
|
@@ -816,7 +816,7 @@ var SExprAtomSchema = z.union([
|
|
|
816
816
|
var SExprSchema = z.lazy(
|
|
817
817
|
() => z.union([
|
|
818
818
|
SExprAtomSchema,
|
|
819
|
-
z.array(
|
|
819
|
+
z.array(SExprDataSchema).min(1).refine(
|
|
820
820
|
(arr) => typeof arr[0] === "string",
|
|
821
821
|
{ message: "S-expression array must have a string operator as first element" }
|
|
822
822
|
)
|
|
@@ -953,8 +953,11 @@ function isDeclaredDefaultHonored(field, isRuntime = false) {
|
|
|
953
953
|
function sampleRowCount(entity, requested) {
|
|
954
954
|
return entity.persistence === "runtime" ? 1 : requested;
|
|
955
955
|
}
|
|
956
|
+
function mockCandidates(declared) {
|
|
957
|
+
return declared.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
958
|
+
}
|
|
956
959
|
function mockFieldValue(declared, index) {
|
|
957
|
-
const candidates = declared
|
|
960
|
+
const candidates = mockCandidates(declared);
|
|
958
961
|
if (candidates.length > 1) {
|
|
959
962
|
return candidates[(index - 1) % candidates.length];
|
|
960
963
|
}
|
|
@@ -978,12 +981,13 @@ function sampleText(field, ctx) {
|
|
|
978
981
|
}
|
|
979
982
|
return ctx.strategy === "seeded" ? titleCase(randomWords(2)) : `${titleCase(fieldName)} ${ctx.index}`;
|
|
980
983
|
}
|
|
984
|
+
var SEEDED_DATE_WINDOW_DAYS = 120;
|
|
981
985
|
function sampleDate(ctx, dateOnly) {
|
|
982
986
|
if (ctx.strategy === "index") {
|
|
983
987
|
const month = String(ctx.index % 12 + 1).padStart(2, "0");
|
|
984
988
|
return dateOnly ? `2026-${month}-15` : `2026-${month}-15T00:00:00.000Z`;
|
|
985
989
|
}
|
|
986
|
-
const iso = randomStraddlingDate({ days:
|
|
990
|
+
const iso = randomStraddlingDate({ days: SEEDED_DATE_WINDOW_DAYS }).toISOString();
|
|
987
991
|
return dateOnly ? iso.split("T")[0] : iso;
|
|
988
992
|
}
|
|
989
993
|
function sampleRelation(field) {
|
|
@@ -1011,7 +1015,8 @@ function sampleObject(field, ctx) {
|
|
|
1011
1015
|
const depth = ctx.depth ?? 0;
|
|
1012
1016
|
if (!field.properties || depth >= MAX_NESTED_DEPTH) return null;
|
|
1013
1017
|
const out = {};
|
|
1014
|
-
|
|
1018
|
+
const entries = Object.entries(field.properties).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
1019
|
+
for (const [propName, propField] of entries) {
|
|
1015
1020
|
const child = { ...propField, name: propName };
|
|
1016
1021
|
out[propName] = sampleFieldValue(child, { ...ctx, depth: depth + 1 }) ?? null;
|
|
1017
1022
|
}
|
|
@@ -1028,7 +1033,7 @@ function sampleUnion(field, ctx) {
|
|
|
1028
1033
|
return sampleFieldValue(child, { ...ctx, depth: depth + 1 });
|
|
1029
1034
|
}
|
|
1030
1035
|
function omitsUndefaultedOptionalFields(ctx) {
|
|
1031
|
-
return ctx.strategy === "seeded" && ctx.index % 2 === 0;
|
|
1036
|
+
return ctx.strategy === "seeded" && !ctx.identity && (ctx.depth ?? 0) === 0 && ctx.index % 2 === 0;
|
|
1032
1037
|
}
|
|
1033
1038
|
function sampleFieldValue(field, ctx) {
|
|
1034
1039
|
const honoredDefault = field.default !== void 0 && isFieldValue(field.default) ? field.default : void 0;
|
|
@@ -1040,15 +1045,17 @@ function sampleFieldValue(field, ctx) {
|
|
|
1040
1045
|
if (!field.required && field.default === void 0 && field.type !== "relation" && omitsUndefaultedOptionalFields(ctx)) {
|
|
1041
1046
|
return void 0;
|
|
1042
1047
|
}
|
|
1048
|
+
if (field.mock !== void 0) {
|
|
1049
|
+
const ordinal = isRuntime ? 1 : ctx.index;
|
|
1050
|
+
const members = declaredValues(field) ? mockCandidates(field.mock) : [];
|
|
1051
|
+
if (members.length > 0) return members[(ordinal - 1) % members.length];
|
|
1052
|
+
return typedMockValue(field, mockFieldValue(field.mock, ordinal));
|
|
1053
|
+
}
|
|
1043
1054
|
const values = declaredValues(field);
|
|
1044
1055
|
if (values) {
|
|
1045
1056
|
const ordinal = isRuntime ? 1 : ctx.index;
|
|
1046
1057
|
return values[(ordinal - 1) % values.length];
|
|
1047
1058
|
}
|
|
1048
|
-
if (field.mock !== void 0) {
|
|
1049
|
-
const ordinal = isRuntime ? 1 : ctx.index;
|
|
1050
|
-
return typedMockValue(field, mockFieldValue(field.mock, ordinal));
|
|
1051
|
-
}
|
|
1052
1059
|
switch (field.type) {
|
|
1053
1060
|
case "string":
|
|
1054
1061
|
return sampleText(field, ctx);
|
|
@@ -1112,6 +1119,8 @@ function sampleFieldValue(field, ctx) {
|
|
|
1112
1119
|
case "trait":
|
|
1113
1120
|
case "slot":
|
|
1114
1121
|
case "pattern":
|
|
1122
|
+
// An event name is authored on the owning struct, never random text (seed.rs twin).
|
|
1123
|
+
case "event":
|
|
1115
1124
|
// Renderable content is computed by the owning trait's effects, never
|
|
1116
1125
|
// seeded — same no-sample treatment as the config-only reference types.
|
|
1117
1126
|
case "node":
|
|
@@ -1128,7 +1137,8 @@ function sampleRow(entity, ctx) {
|
|
|
1128
1137
|
const value = sampleFieldValue(field, {
|
|
1129
1138
|
...ctx,
|
|
1130
1139
|
entityName: entity.name,
|
|
1131
|
-
persistence: ctx.persistence ?? entity.persistence
|
|
1140
|
+
persistence: ctx.persistence ?? entity.persistence,
|
|
1141
|
+
...entity.identity ? { identity: true } : {}
|
|
1132
1142
|
});
|
|
1133
1143
|
if (value !== void 0) row[name] = value;
|
|
1134
1144
|
}
|
|
@@ -1167,7 +1177,24 @@ function linkSelfRelationField(rows, field, isExcluded) {
|
|
|
1167
1177
|
row[field.name] = scalar ? forest.parentOf(index) : forest.childrenOf(index);
|
|
1168
1178
|
});
|
|
1169
1179
|
}
|
|
1180
|
+
var SCALAR_TARGET_CARDINALITIES = /* @__PURE__ */ new Set(["one", "many-to-one"]);
|
|
1181
|
+
function crossRelationValue(targetIds, index, cardinality) {
|
|
1182
|
+
if (targetIds.length === 0) return void 0;
|
|
1183
|
+
if (SCALAR_TARGET_CARDINALITIES.has(cardinality ?? "many")) return targetIds[index % targetIds.length];
|
|
1184
|
+
const picks = [];
|
|
1185
|
+
const count = Math.min(targetIds.length, 2 + index % 2);
|
|
1186
|
+
for (let offset = 0; offset < count; offset++) {
|
|
1187
|
+
const candidate = targetIds[(index + offset) % targetIds.length];
|
|
1188
|
+
if (!picks.includes(candidate)) picks.push(candidate);
|
|
1189
|
+
}
|
|
1190
|
+
return picks;
|
|
1191
|
+
}
|
|
1192
|
+
function isRelationPlaceholder(value) {
|
|
1193
|
+
if (value === void 0) return true;
|
|
1194
|
+
if (typeof value === "string") return value === "";
|
|
1195
|
+
return Array.isArray(value) && value.length === 0;
|
|
1196
|
+
}
|
|
1170
1197
|
|
|
1171
|
-
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 };
|
|
1198
|
+
export { IMAGE_FIELD_NAMES, RESERVED_FIELD_NAMES, collectUserFieldLiterals, crossRelationValue, entityAccessPolicies, entityAccessPoliciesByStoreKey, entityAccessTable, identityEntitiesOf, identityEntityName, identityEntityNames, isDeclaredDefaultHonored, isRelationPlaceholder, 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 };
|
|
1172
1199
|
//# sourceMappingURL=index.js.map
|
|
1173
1200
|
//# sourceMappingURL=index.js.map
|