@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.80 → 6.2.2-dev.82

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.
Files changed (49) hide show
  1. package/dist/browser/{connect-Df8YBCmF.js → connect-Bpm1qc2o.js} +3 -3
  2. package/dist/browser/{connect-Df8YBCmF.js.map → connect-Bpm1qc2o.js.map} +1 -1
  3. package/dist/browser/{dist-BIpFdiLp.js → dist-DzuQgnp9.js} +2 -2
  4. package/dist/browser/{dist-BIpFdiLp.js.map → dist-DzuQgnp9.js.map} +1 -1
  5. package/dist/browser/{document-drive-DU75CBKf.js → document-drive-BVYCdu_5.js} +24 -222
  6. package/dist/browser/document-drive-BVYCdu_5.js.map +1 -0
  7. package/dist/browser/document-models/index.js +1 -1
  8. package/dist/browser/{editor-y1bqyeB_.js → editor-BhVC9JGB.js} +5 -5
  9. package/dist/browser/{editor-y1bqyeB_.js.map → editor-BhVC9JGB.js.map} +1 -1
  10. package/dist/browser/{editor-BuYbUTIt.js → editor-Cr2SUFnl.js} +6 -6
  11. package/dist/browser/{editor-BuYbUTIt.js.map → editor-Cr2SUFnl.js.map} +1 -1
  12. package/dist/browser/editors/document-model-editor/module.js +1 -1
  13. package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
  14. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  15. package/dist/browser/{folder-view-BzERbCoQ.js → folder-view-EDdZl1fJ.js} +3 -3
  16. package/dist/browser/{folder-view-BzERbCoQ.js.map → folder-view-EDdZl1fJ.js.map} +1 -1
  17. package/dist/browser/{graphql-editor-Dv1FDpax.js → graphql-editor-BjkthIT9.js} +3 -3
  18. package/dist/browser/{graphql-editor-Dv1FDpax.js.map → graphql-editor-BjkthIT9.js.map} +1 -1
  19. package/dist/browser/index.js +1 -1
  20. package/dist/browser/{json-editor-ZRgRDikU.js → json-editor-nLgiw_aY.js} +3 -3
  21. package/dist/browser/{json-editor-ZRgRDikU.js.map → json-editor-nLgiw_aY.js.map} +1 -1
  22. package/dist/browser/{state-schemas-BBkkpjRl.js → state-schemas-IiwC01DT.js} +3 -3
  23. package/dist/browser/{state-schemas-BBkkpjRl.js.map → state-schemas-IiwC01DT.js.map} +1 -1
  24. package/dist/node/{connect-DM43aaJZ.mjs → connect-DzMvrvtH.mjs} +3 -3
  25. package/dist/node/{connect-DM43aaJZ.mjs.map → connect-DzMvrvtH.mjs.map} +1 -1
  26. package/dist/node/{dist-4gA6tFmW.mjs → dist-CWqCyPep.mjs} +2 -2
  27. package/dist/node/{dist-4gA6tFmW.mjs.map → dist-CWqCyPep.mjs.map} +1 -1
  28. package/dist/node/{document-drive-CRYbvD0-.mjs → document-drive-lf_0SP-H.mjs} +24 -222
  29. package/dist/node/document-drive-lf_0SP-H.mjs.map +1 -0
  30. package/dist/node/document-models/index.mjs +1 -1
  31. package/dist/node/{editor-B5cnYfC7.mjs → editor-BHFgv5Sn.mjs} +6 -6
  32. package/dist/node/{editor-B5cnYfC7.mjs.map → editor-BHFgv5Sn.mjs.map} +1 -1
  33. package/dist/node/{editor-Dn0DUR0W.mjs → editor-DSlBxXEG.mjs} +5 -5
  34. package/dist/node/{editor-Dn0DUR0W.mjs.map → editor-DSlBxXEG.mjs.map} +1 -1
  35. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  36. package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
  37. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  38. package/dist/node/{folder-view-BAAfODx_.mjs → folder-view-BU4jkZT4.mjs} +3 -3
  39. package/dist/node/{folder-view-BAAfODx_.mjs.map → folder-view-BU4jkZT4.mjs.map} +1 -1
  40. package/dist/node/{graphql-editor-CUrJvXrG.mjs → graphql-editor-CScEOmFM.mjs} +3 -3
  41. package/dist/node/{graphql-editor-CUrJvXrG.mjs.map → graphql-editor-CScEOmFM.mjs.map} +1 -1
  42. package/dist/node/index.mjs +1 -1
  43. package/dist/node/{json-editor-TvKShKo-.mjs → json-editor-BkdBLGDx.mjs} +3 -3
  44. package/dist/node/{json-editor-TvKShKo-.mjs.map → json-editor-BkdBLGDx.mjs.map} +1 -1
  45. package/dist/node/{state-schemas-CJK5hin3.mjs → state-schemas-BCTGWiNB.mjs} +3 -3
  46. package/dist/node/{state-schemas-CJK5hin3.mjs.map → state-schemas-BCTGWiNB.mjs.map} +1 -1
  47. package/package.json +7 -7
  48. package/dist/browser/document-drive-DU75CBKf.js.map +0 -1
  49. package/dist/node/document-drive-CRYbvD0-.mjs.map +0 -1
@@ -4257,35 +4257,32 @@ const AUTH_ADMINISTRATION_REQUEST = {
4257
4257
  operation: "SET_GRANT"
4258
4258
  };
4259
4259
  /**
4260
- * Whether some subject can still administer the auth scope under this grant list.
4260
+ * Whether some subject can still administer the auth scope under this grant
4261
+ * list.
4261
4262
  *
4262
- * Asks the evaluator rather than pattern-matching a single grant: evaluation is
4263
- * last-applicable-grant-wins, so an allow that some later deny shadows keeps
4264
- * nothing reachable even though it is still present in the list. Only anyone and
4265
- * address principals are candidates, because those are the ones v1 can match at
4266
- * all; a `where` condition or a group or match principal never applies.
4263
+ * Answers exactly what asking {@link evaluateGrantStack} per candidate grant
4264
+ * answered, in one reverse pass instead of one full stack scan per candidate.
4265
+ * Evaluation is last-applicable-grant-wins, so scanning from the end meets each
4266
+ * subject's deciding grant first: an anyone grant decides every subject not
4267
+ * already decided, and an allow reached that way is itself a grant that carries
4268
+ * administration. Only anyone and address principals are candidates, because
4269
+ * those are the ones v1 can match with no groups and no condition context; a
4270
+ * `where` condition or a group or match principal never applies.
4267
4271
  */
4268
4272
  function administrationReachable(grants) {
4269
- return grants.some((grant) => {
4270
- const subject = administrationCandidate(grant);
4271
- if (subject === void 0) return false;
4272
- return evaluateGrantStack(grants, subject, AUTH_ADMINISTRATION_REQUEST).decision === "allow";
4273
- });
4274
- }
4275
- /**
4276
- * The subject to test this grant with, or undefined when the grant could never
4277
- * carry administration for anyone.
4278
- */
4279
- function administrationCandidate(grant) {
4280
- if (grant.effect !== "allow" || grant.where !== void 0 || !capabilityCovers(grant.capability, AUTH_ADMINISTRATION_REQUEST)) return;
4281
- if ("address" in grant.principal) return {
4282
- address: grant.principal.address,
4283
- key: void 0
4284
- };
4285
- if ("anyone" in grant.principal) return {
4286
- address: void 0,
4287
- key: void 0
4288
- };
4273
+ const shadowedAddresses = /* @__PURE__ */ new Set();
4274
+ for (let index = grants.length - 1; index >= 0; index -= 1) {
4275
+ const grant = grants[index];
4276
+ if (grant.where !== void 0 || !grantAnswers(grant, AUTH_ADMINISTRATION_REQUEST)) continue;
4277
+ const allows = grant.effect === "allow";
4278
+ if ("anyone" in grant.principal) return allows;
4279
+ if (!("address" in grant.principal)) continue;
4280
+ const address = grant.principal.address.toLowerCase();
4281
+ if (shadowedAddresses.has(address)) continue;
4282
+ if (allows) return true;
4283
+ shadowedAddresses.add(address);
4284
+ }
4285
+ return false;
4289
4286
  }
4290
4287
  /**
4291
4288
  * A creator-less policy must always retain a grant permitting execute on the
@@ -4297,158 +4294,6 @@ function assertAuthAdministrationRetained(creator, previous, next, grantId) {
4297
4294
  if (creator !== void 0) return;
4298
4295
  if (administrationReachable(previous) && !administrationReachable(next)) throw new AuthAdministrationLockoutError(grantId);
4299
4296
  }
4300
- /**
4301
- * An operand whose shape validation would have rejected. Distinguished from
4302
- * an unresolved path so a structurally malformed operand poisons its whole
4303
- * condition to false rather than reading as "absent", which `not` would
4304
- * otherwise widen to true.
4305
- */
4306
- const INVALID_OPERAND = Symbol("invalid-operand");
4307
- /**
4308
- * Narrows to the values conditions compare. An object, array, or non-finite
4309
- * number resolves to undefined, and every comparison involving undefined is
4310
- * false.
4311
- */
4312
- function asConditionValue(value) {
4313
- if (value === null || typeof value === "string" || typeof value === "boolean") return value;
4314
- if (typeof value === "number" && Number.isFinite(value)) return value;
4315
- }
4316
- /**
4317
- * Resolves one operand. Attr roots: `subject.*`, `doc.<scope>.*` where the
4318
- * scope must be the executing scope (validation already rejects any other,
4319
- * but resolution stays total), and `action.input.*`. Path steps read own
4320
- * properties only, so prototype members can never influence a verdict.
4321
- */
4322
- function resolveOperand(operand, subject, request, conditions) {
4323
- if (!isPlainValue(operand)) return INVALID_OPERAND;
4324
- const keys = Object.keys(operand);
4325
- if (keys.length !== 1) return INVALID_OPERAND;
4326
- if (keys[0] === "lit") {
4327
- const value = asConditionValue(operand.lit);
4328
- return value === void 0 ? INVALID_OPERAND : value;
4329
- }
4330
- if (keys[0] !== "attr") return INVALID_OPERAND;
4331
- const attr = operand.attr;
4332
- if (typeof attr !== "string" || attr.length === 0) return INVALID_OPERAND;
4333
- const path = attr.split(".");
4334
- let value;
4335
- let rest;
4336
- if (path[0] === "subject") {
4337
- value = subject;
4338
- rest = path.slice(1);
4339
- } else if (path[0] === "doc") {
4340
- if (path[1] !== request.scope) return;
4341
- value = conditions.scopeState;
4342
- rest = path.slice(2);
4343
- } else if (path[0] === "action" && path[1] === "input") {
4344
- value = conditions.actionInput;
4345
- rest = path.slice(2);
4346
- } else return;
4347
- for (const segment of rest) {
4348
- if (!isPlainValue(value) || !Object.hasOwn(value, segment)) return;
4349
- value = value[segment];
4350
- }
4351
- return asConditionValue(value);
4352
- }
4353
- /**
4354
- * Total order within one type: numbers numerically, strings by code point.
4355
- * Everything else, including mixed types, does not order.
4356
- */
4357
- function compareValues(left, right) {
4358
- if (typeof left === "number" && typeof right === "number") return left < right ? -1 : left > right ? 1 : 0;
4359
- if (typeof left === "string" && typeof right === "string") {
4360
- const leftPoints = Array.from(left);
4361
- const rightPoints = Array.from(right);
4362
- const shared = Math.min(leftPoints.length, rightPoints.length);
4363
- for (let i = 0; i < shared; i++) {
4364
- const a = leftPoints[i].codePointAt(0) ?? 0;
4365
- const b = rightPoints[i].codePointAt(0) ?? 0;
4366
- if (a !== b) return a < b ? -1 : 1;
4367
- }
4368
- return leftPoints.length === rightPoints.length ? 0 : leftPoints.length < rightPoints.length ? -1 : 1;
4369
- }
4370
- }
4371
- /**
4372
- * Tri-state evaluation: undefined marks a structurally invalid node, which
4373
- * poisons the whole tree to false at the top — and a structurally malformed
4374
- * operand poisons its condition the same way. Both are distinct from an
4375
- * operand whose path fails to resolve, which is a valid comparison that is
4376
- * false. The distinction keeps `not` from widening over malformed input.
4377
- */
4378
- function evaluateNode(node, subject, request, conditions) {
4379
- if (!isPlainValue(node)) return;
4380
- const keys = Object.keys(node);
4381
- if (keys.length !== 1) return;
4382
- const kind = keys[0];
4383
- const body = node[kind];
4384
- switch (kind) {
4385
- case "eq":
4386
- case "ne":
4387
- case "lt":
4388
- case "lte":
4389
- case "gt":
4390
- case "gte": {
4391
- if (!Array.isArray(body) || body.length !== 2) return;
4392
- const left = resolveOperand(body[0], subject, request, conditions);
4393
- const right = resolveOperand(body[1], subject, request, conditions);
4394
- if (left === INVALID_OPERAND || right === INVALID_OPERAND) return;
4395
- if (left === void 0 || right === void 0) return false;
4396
- if (kind === "eq") return left === right;
4397
- if (kind === "ne") return left !== right;
4398
- const order = compareValues(left, right);
4399
- if (order === void 0) return false;
4400
- switch (kind) {
4401
- case "lt": return order < 0;
4402
- case "lte": return order <= 0;
4403
- case "gt": return order > 0;
4404
- case "gte": return order >= 0;
4405
- }
4406
- return;
4407
- }
4408
- case "in":
4409
- case "notIn": {
4410
- if (!Array.isArray(body) || body.length !== 2 || !Array.isArray(body[1])) return;
4411
- const left = resolveOperand(body[0], subject, request, conditions);
4412
- if (left === INVALID_OPERAND) return;
4413
- const elements = body[1].map((element) => resolveOperand(element, subject, request, conditions));
4414
- if (elements.some((value) => value === INVALID_OPERAND)) return;
4415
- if (left === void 0) return false;
4416
- const found = elements.some((value) => value !== void 0 && value === left);
4417
- return kind === "in" ? found : !found;
4418
- }
4419
- case "exists": {
4420
- const value = resolveOperand(body, subject, request, conditions);
4421
- if (value === INVALID_OPERAND) return;
4422
- return value !== void 0;
4423
- }
4424
- case "and":
4425
- case "or": {
4426
- if (!Array.isArray(body)) return;
4427
- let result = kind === "and";
4428
- for (const child of body) {
4429
- const value = evaluateNode(child, subject, request, conditions);
4430
- if (value === void 0) return;
4431
- if (kind === "and") result = result && value;
4432
- else result = result || value;
4433
- }
4434
- return result;
4435
- }
4436
- case "not": {
4437
- const value = evaluateNode(body, subject, request, conditions);
4438
- return value === void 0 ? void 0 : !value;
4439
- }
4440
- default: return;
4441
- }
4442
- }
4443
- /**
4444
- * Evaluates a version-1 condition. Deterministic, total, and pure: any input
4445
- * shape yields a boolean and never throws, and a malformed condition is
4446
- * false. These are consensus semantics, versioned by `PHAuthState.version`;
4447
- * changing them requires a new version.
4448
- */
4449
- function evaluateCondition(condition, subject, request, conditions) {
4450
- return evaluateNode(condition, subject, request, conditions) === true;
4451
- }
4452
4297
  /** Whether a capability's scope reaches the requested one. */
4453
4298
  function scopeCovers(scope, requested) {
4454
4299
  return scope === void 0 || scope === "*" || scope === requested;
@@ -4484,49 +4329,6 @@ function capabilityCovers(capability, request) {
4484
4329
  }
4485
4330
  return true;
4486
4331
  }
4487
- function principalMatches(principal, subject, request, groups, conditions) {
4488
- if ("anyone" in principal) return true;
4489
- if ("address" in principal) return subject.address !== void 0 && subject.address.toLowerCase() === principal.address.toLowerCase();
4490
- if ("group" in principal) {
4491
- if (groups === void 0 || subject.address === void 0) return false;
4492
- const group = groups[principal.group];
4493
- if (group === void 0 || !Array.isArray(group.members)) return false;
4494
- const address = subject.address.toLowerCase();
4495
- return group.members.some((member) => member.toLowerCase() === address);
4496
- }
4497
- if ("match" in principal) {
4498
- if (conditions === void 0) return false;
4499
- return evaluateCondition(principal.match, subject, request, conditions);
4500
- }
4501
- return false;
4502
- }
4503
- /**
4504
- * Evaluates a v1 grant stack: default deny, last applicable grant wins, and
4505
- * reports which grant decided it. Group principals match only against a
4506
- * supplied groups map, and `where` clauses and { match } principals evaluate
4507
- * only against a supplied condition context; a grant that uses an unsupplied
4508
- * feature never applies.
4509
- */
4510
- function evaluateGrantStack(grants, subject, request, groups, conditions) {
4511
- let applicable;
4512
- for (const grant of grants) {
4513
- if (grant.where !== void 0) {
4514
- if (conditions === void 0) continue;
4515
- if (!evaluateCondition(grant.where, subject, request, conditions)) continue;
4516
- }
4517
- if (grantAnswers(grant, request) && principalMatches(grant.principal, subject, request, groups, conditions)) applicable = grant;
4518
- }
4519
- if (applicable === void 0) return {
4520
- decision: "deny",
4521
- refusal: "no-applicable-grant"
4522
- };
4523
- if (applicable.effect === "deny") return {
4524
- decision: "deny",
4525
- refusal: "denied-by-grant",
4526
- grantId: applicable.id
4527
- };
4528
- return { decision: "allow" };
4529
- }
4530
4332
  const documentModelFileExtension = "phdm";
4531
4333
  const documentModelInitialLocalState = {};
4532
4334
  const documentModelInitialGlobalState = {
@@ -8425,4 +8227,4 @@ const driveDocumentModelModule = {
8425
8227
  //#endregion
8426
8228
  export { setOperationDescription as $, createState as A, normalizeDocumentModelVersion as B, baseLoadFromInputVersioned as C, createBaseState as D, createAction as E, deleteOperationError as F, setAuthorWebsite as G, releaseNewVersion as H, deserializeSignature as I, setModelExtension as J, setInitialState as K, documentModelDocumentType as L, defaultBaseState as M, deleteModule as N, createPresignedHeader as O, deleteOperation as P, setName as Q, hashDocumentStateForScope as R, baseLoadFromInput as S, buildSignedAction as T, replayDocumentVersioned as U, redo as V, setAuthorName as W, setModelName as X, setModelId as Y, setModuleName as Z, addOperation as _, handleTargetNameCollisions as a, undo as at, baseActions as b, isValidName as c, validateStateSchemaName as ct, documentModelDocumentModelModule as d, setOperationErrorName as et, logger as f, addModule as g, UnsupportedDocumentModelVersionError as h, generateNodesCopy as i, toTransportAction as it, createZip as j, createReducer as k, moveNode as l, generateId as lt, BaseDocumentStateSchema as m, copyNode as n, setOperationSchema as nt, isFileNode as o, validateInitialState as ot, BaseDocumentHeaderSchema as p, setModelDescription as q, driveDocumentModelModule as r, setStateSchema as rt, isFolderNode as s, validateModules as st, addFolder as t, setOperationName as tt, updateNode as u, addOperationError as v, baseSaveToFileHandle as w, baseCreateDocument as x, assertAuthPreservedOnDuplicate as y, isDocumentAction as z };
8427
8229
 
8428
- //# sourceMappingURL=document-drive-DU75CBKf.js.map
8230
+ //# sourceMappingURL=document-drive-BVYCdu_5.js.map