@almadar/core 10.44.0 → 10.45.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 +31 -23
- package/dist/builders.js.map +1 -1
- package/dist/{effect-NbTgX2yB.d.ts → effect-BZ1nzN3q.d.ts} +38 -2
- package/dist/factory/index.d.ts +4 -4
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +31 -23
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +60 -52
- package/dist/index.js.map +1 -1
- package/dist/mock/index.d.ts +34 -5
- package/dist/mock/index.js +60 -1
- 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 +5 -5
- package/dist/patterns/index.js +3 -3
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +1 -1
- package/dist/patterns/registry.json +1 -1
- package/dist/{schema-DdcBBHkb.d.ts → schema-CZNILCHD.d.ts} +530 -78
- package/dist/{trait-DdBiEffx.d.ts → trait-1V3odk0y.d.ts} +73 -13
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.js +57 -49
- package/dist/types/index.js.map +1 -1
- package/dist/{types-B4NVh8V9.d.ts → types-GAiRTtkp.d.ts} +2 -2
- package/package.json +1 -1
package/dist/mock/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as OrbitalSchema } from '../schema-
|
|
2
|
-
import {
|
|
3
|
-
import '../
|
|
4
|
-
import '../
|
|
1
|
+
import { O as OrbitalSchema } from '../schema-CZNILCHD.js';
|
|
2
|
+
import { S as SExpr } from '../expression-Yf7qvvOs.js';
|
|
3
|
+
import { a as EntityPersistence, E as EntityField, F as FieldValue, f as EntityRow } from '../effect-BZ1nzN3q.js';
|
|
4
|
+
import '../trait-1V3odk0y.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -84,6 +84,35 @@ declare function identityEntityName(schema: OrbitalSchema): string | undefined;
|
|
|
84
84
|
*/
|
|
85
85
|
declare function ownerFieldsFromSchema(schema: OrbitalSchema): string[];
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Entity access policies — the declared `@read`/`@create`/`@update`/`@delete`
|
|
89
|
+
* directives, keyed by entity name.
|
|
90
|
+
*
|
|
91
|
+
* The JS mirror of `orbital-core/src/runtime/entity_access.rs`'s
|
|
92
|
+
* `EntityAccessPolicies`/`EntityAccessTable`. Both paths must agree: a
|
|
93
|
+
* directive is a per-row predicate (`@entity` = the candidate row, or for
|
|
94
|
+
* `@create` the incoming data; `@user` = the viewer), enforced once for
|
|
95
|
+
* every trait that touches the entity — the un-bypassable twin of a
|
|
96
|
+
* call-site `filter:`, which sibling traits can skip simply by not
|
|
97
|
+
* declaring one.
|
|
98
|
+
*
|
|
99
|
+
* @packageDocumentation
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/** An entity's four declared directives. Any may be absent — an absent
|
|
103
|
+
* directive means "no restriction" for that operation, exactly like an
|
|
104
|
+
* absent fetch `filter:`. */
|
|
105
|
+
interface EntityAccessPolicies {
|
|
106
|
+
read?: SExpr;
|
|
107
|
+
create?: SExpr;
|
|
108
|
+
update?: SExpr;
|
|
109
|
+
delete?: SExpr;
|
|
110
|
+
}
|
|
111
|
+
/** Every entity's access policies, keyed by entity name. */
|
|
112
|
+
declare function entityAccessTable(schema: OrbitalSchema): Map<string, EntityAccessPolicies>;
|
|
113
|
+
/** One entity's access policies, or `undefined` when it declares none. */
|
|
114
|
+
declare function entityAccessPolicies(schema: OrbitalSchema, entityName: string): EntityAccessPolicies | undefined;
|
|
115
|
+
|
|
87
116
|
/**
|
|
88
117
|
* The one owner of mock-seed value synthesis.
|
|
89
118
|
*
|
|
@@ -146,4 +175,4 @@ declare function sampleRow(entity: SampleEntity, ctx: Omit<SampleContext, 'entit
|
|
|
146
175
|
/** `count` rows, 1-based, honoring the runtime-singleton gate. */
|
|
147
176
|
declare function sampleRows(entity: SampleEntity, count: number, strategy: SampleStrategy): EntityRow[];
|
|
148
177
|
|
|
149
|
-
export { IMAGE_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
|
|
178
|
+
export { type EntityAccessPolicies, IMAGE_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, entityAccessPolicies, entityAccessTable, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
|
package/dist/mock/index.js
CHANGED
|
@@ -191,6 +191,35 @@ function ownerFieldsFromSchema(schema) {
|
|
|
191
191
|
}
|
|
192
192
|
return out;
|
|
193
193
|
}
|
|
194
|
+
|
|
195
|
+
// src/access/entityAccess.ts
|
|
196
|
+
function inlineEntities2(schema) {
|
|
197
|
+
const out = [];
|
|
198
|
+
for (const orbital of schema.orbitals ?? []) {
|
|
199
|
+
const refs = [orbital.entity, ...orbital.auxiliaryEntities ?? []];
|
|
200
|
+
for (const ref of refs) {
|
|
201
|
+
if (typeof ref === "object" && ref !== null && "fields" in ref) {
|
|
202
|
+
out.push(ref);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
function entityAccessTable(schema) {
|
|
209
|
+
const table = /* @__PURE__ */ new Map();
|
|
210
|
+
for (const def of inlineEntities2(schema)) {
|
|
211
|
+
table.set(def.name, {
|
|
212
|
+
read: def.read_policy,
|
|
213
|
+
create: def.create_policy,
|
|
214
|
+
update: def.update_policy,
|
|
215
|
+
delete: def.delete_policy
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return table;
|
|
219
|
+
}
|
|
220
|
+
function entityAccessPolicies(schema, entityName) {
|
|
221
|
+
return entityAccessTable(schema).get(entityName);
|
|
222
|
+
}
|
|
194
223
|
var ID_PREFIXES = {
|
|
195
224
|
orbital: "orb_",
|
|
196
225
|
entity: "ent_",
|
|
@@ -506,6 +535,26 @@ z.object({
|
|
|
506
535
|
fov: z.number().optional(),
|
|
507
536
|
mode: CameraModeSchema.optional()
|
|
508
537
|
});
|
|
538
|
+
var SExprDataSchema = z.lazy(
|
|
539
|
+
() => z.union([SExprAtomSchema, z.array(SExprDataSchema)])
|
|
540
|
+
);
|
|
541
|
+
var SExprAtomSchema = z.union([
|
|
542
|
+
z.string(),
|
|
543
|
+
z.number(),
|
|
544
|
+
z.boolean(),
|
|
545
|
+
z.null(),
|
|
546
|
+
z.record(SExprDataSchema)
|
|
547
|
+
// Objects for payload data
|
|
548
|
+
]);
|
|
549
|
+
var SExprSchema = z.lazy(
|
|
550
|
+
() => z.union([
|
|
551
|
+
SExprAtomSchema,
|
|
552
|
+
z.array(z.lazy(() => SExprSchema)).min(1).refine(
|
|
553
|
+
(arr) => typeof arr[0] === "string",
|
|
554
|
+
{ message: "S-expression array must have a string operator as first element" }
|
|
555
|
+
)
|
|
556
|
+
])
|
|
557
|
+
);
|
|
509
558
|
|
|
510
559
|
// src/types/entity.ts
|
|
511
560
|
var EntityPersistenceSchema = z.enum([
|
|
@@ -521,6 +570,16 @@ z.object({
|
|
|
521
570
|
// than rejecting them, so a Rust-only field works on the compiled path and
|
|
522
571
|
// silently vanishes on the interpreter path.
|
|
523
572
|
identity: z.boolean().optional(),
|
|
573
|
+
// Same "must stay in step with Rust serde" hazard as `identity` above —
|
|
574
|
+
// these four mirror `EntityDefinition.{read,create,update,delete}_policy`.
|
|
575
|
+
// Rust has no `rename_all` on this struct, so the wire key IS snake_case
|
|
576
|
+
// (unlike this file's other camelCase fields, which are Rust-side-absent
|
|
577
|
+
// and so never hit this cross-language constraint — see `visual_prompt`
|
|
578
|
+
// just below for the existing precedent).
|
|
579
|
+
read_policy: SExprSchema.optional(),
|
|
580
|
+
create_policy: SExprSchema.optional(),
|
|
581
|
+
update_policy: SExprSchema.optional(),
|
|
582
|
+
delete_policy: SExprSchema.optional(),
|
|
524
583
|
collection: z.string().optional(),
|
|
525
584
|
fields: z.array(EntityFieldSchema).min(1, "At least one field is required"),
|
|
526
585
|
instances: z.array(z.record(JsonValueSchema)).optional(),
|
|
@@ -725,6 +784,6 @@ function sampleRows(entity, count, strategy) {
|
|
|
725
784
|
return rows;
|
|
726
785
|
}
|
|
727
786
|
|
|
728
|
-
export { IMAGE_FIELD_NAMES, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
|
|
787
|
+
export { IMAGE_FIELD_NAMES, entityAccessPolicies, entityAccessTable, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
|
|
729
788
|
//# sourceMappingURL=index.js.map
|
|
730
789
|
//# sourceMappingURL=index.js.map
|