@volter/world-core 3.0.94 → 3.0.96

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.
@@ -190,7 +190,8 @@ export type ResourceDecl = {
190
190
  refusal: ErrorSpec;
191
191
  }>;
192
192
  /** the subjects a delete takes with it (an organization's memberships and invitations): each resource whose `field`
193
- * holds the deleted subject's id, deleted first, each through the write path as its own delete (its events sent) */
193
+ * holds the deleted subject's id, deleted first, each through the write path as its own delete (its events sent).
194
+ * The field may be a dot path; exact field names take precedence. */
194
195
  cascade?: Array<{
195
196
  resource: string;
196
197
  field: string;
@@ -935,7 +935,7 @@ function conflictOf(m, resource, fields, except, root) {
935
935
  /** A subject deleted through the write path, after every subject its resource's `cascade` takes with it (depth first). */
936
936
  async function removeSubject(m, call, resource, id, params, root, at, operation) {
937
937
  for (const child of m.resources[resource]?.cascade ?? []) {
938
- for (const row of stored(m, child.resource, root).filter((r) => r[child.field] === id)) {
938
+ for (const row of stored(m, child.resource, root).filter((r) => parentField(r, child.field) === id)) {
939
939
  await removeSubject(m, call, child.resource, String(row.id), params, root, at);
940
940
  }
941
941
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/world-core",
3
- "version": "3.0.94",
3
+ "version": "3.0.96",
4
4
  "description": "The kernel of Volter World: one log per twin, branches as pointers, checkpoints, the fold that keeps a twin current, the head that performs a write against the vendor, references, and the git plane. A twin package builds on it; the runtime serves it.",
5
5
  "keywords": [
6
6
  "twin",
@@ -180,7 +180,8 @@ export type ResourceDecl = {
180
180
  * a create or update that would make a second one is refused with `refusal`, by the core and by `ctx.conflict` */
181
181
  unique?: Array<{ fields: string[]; refusal: ErrorSpec }>;
182
182
  /** the subjects a delete takes with it (an organization's memberships and invitations): each resource whose `field`
183
- * holds the deleted subject's id, deleted first, each through the write path as its own delete (its events sent) */
183
+ * holds the deleted subject's id, deleted first, each through the write path as its own delete (its events sent).
184
+ * The field may be a dot path; exact field names take precedence. */
184
185
  cascade?: Array<{ resource: string; field: string }>;
185
186
  /** fields that name a subject as its id does (an organization by its id or its slug): a path's id and `ctx.find`
186
187
  * match either */
@@ -1402,7 +1403,7 @@ function conflictOf(m: DerivedManifest, resource: string, fields: Record<string,
1402
1403
  /** A subject deleted through the write path, after every subject its resource's `cascade` takes with it (depth first). */
1403
1404
  async function removeSubject(m: DerivedManifest, call: DerivedCall, resource: string, id: string, params: Record<string, unknown>, root: string | undefined, at: string, operation?: string): Promise<void> {
1404
1405
  for (const child of m.resources[resource]?.cascade ?? []) {
1405
- for (const row of stored(m, child.resource, root).filter((r) => (r as Record<string, unknown>)[child.field] === id)) {
1406
+ for (const row of stored(m, child.resource, root).filter((r) => parentField(r, child.field) === id)) {
1406
1407
  await removeSubject(m, call, child.resource, String(row.id), params, root, at);
1407
1408
  }
1408
1409
  }