@hyperscale0/udl 4.0.0 → 4.1.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.
@@ -9,8 +9,6 @@ export type UdlIssueCode =
9
9
  | "staff_role_unknown"
10
10
  | "product_party_unbound"
11
11
  | "product_party_invalid"
12
- | "approval_initiator_missing"
13
- | "approval_same_initiator"
14
12
  | "UDL1001"
15
13
  | "UDL1002"
16
14
  | "UDL1003"
@@ -40,16 +38,12 @@ const fixes: Record<UdlIssueCode, string> = {
40
38
  "Bind the parameter to a subject role or declared party.",
41
39
  party_name_reserved:
42
40
  "Choose a party name other than owner, actor or operator.",
43
- party_kind_mismatch:
44
- "Use a business or subject role for money and staff with a role for approval.",
41
+ party_kind_mismatch: "Use a business or subject role for money.",
45
42
  staff_role_unknown: "Use a registered staff permission role.",
46
43
  product_party_unbound:
47
44
  "Supply the consumed business in the Build party bindings.",
48
45
  product_party_invalid:
49
46
  "Bind a business participant in the same tenant and environment.",
50
- approval_initiator_missing: "Provide authenticated request attribution.",
51
- approval_same_initiator:
52
- "Have a different human approve the protected request.",
53
47
 
54
48
  UDL1001: "Encode the source as UTF-8.",
55
49
  UDL1002: "Repair JSON syntax.",
@@ -2,7 +2,6 @@ import * as z from "zod";
2
2
  import {
3
3
  udlExternalIdSchema,
4
4
  udlObjectIdSchema,
5
- udlPartyNameSchema,
6
5
  type UdlDocument,
7
6
  type UdlField,
8
7
  type UdlObjectField,
@@ -30,16 +29,6 @@ export const requestAttributionSchema = z.union([
30
29
  ]);
31
30
  export type RequestAttribution = z.infer<typeof requestAttributionSchema>;
32
31
 
33
- export const objectApprovalRequirementSchema = z.strictObject({
34
- target: z.string().min(1),
35
- action: udlPartyNameSchema,
36
- party: udlPartyNameSchema,
37
- role: udlPartyNameSchema,
38
- decision: z.enum(["approved", "declined"]),
39
- protectedRequest: z.string().min(1),
40
- differentFromInitiator: z.boolean(),
41
- });
42
-
43
32
  export type JsonSchemaDocument = z.core.JSONSchema.BaseSchema;
44
33
 
45
34
  export interface ObjectKindDiscovery {
@@ -61,9 +50,6 @@ export interface ObjectActionContext {
61
50
  target: ObjectActionTarget;
62
51
  }
63
52
  export interface ObjectActionDiscovery extends ObjectActionContext {
64
- approvalRequirements: readonly z.infer<
65
- typeof objectApprovalRequirementSchema
66
- >[];
67
53
  name: string;
68
54
  title: string;
69
55
  instrument: string;
@@ -340,26 +326,6 @@ export function projectObjectDiscovery(
340
326
  title: action.summary,
341
327
  instrument: instrument.id,
342
328
  action: name,
343
- approvalRequirements: action.requires.flatMap((rule) => {
344
- if (rule.kind !== "approval") return [];
345
- const party = document.parties[rule.party];
346
- if (party?.kind !== "staff" || !party.role)
347
- throw new Error(
348
- `Approval party ${rule.party} has no staff authority`,
349
- );
350
- return [
351
- {
352
- target: rule.target ?? "self",
353
- action: rule.action ?? name,
354
- party: rule.party,
355
- role: party.role,
356
- decision: rule.decision,
357
- protectedRequest: rule.protectedRequest ?? "self",
358
- differentFromInitiator:
359
- rule.differentFromInitiator === true,
360
- },
361
- ];
362
- }),
363
329
  requirements: mergedReqs.map(
364
330
  (requirement) =>
365
331
  ({
package/src/reporting.ts CHANGED
@@ -171,7 +171,6 @@ export const reportDefinitionSchema = z.strictObject({
171
171
  request: z.array(name).min(1).max(64),
172
172
  read: z.array(name).min(1).max(64),
173
173
  release: z.array(name).max(64),
174
- independentApproval: z.literal(true),
175
174
  retention: z.strictObject({ policy: name, years: integer.min(1).max(100) }),
176
175
  }),
177
176
  });
package/src/schema.ts CHANGED
@@ -328,15 +328,6 @@ export const udlRequirementSchema = z.discriminatedUnion("kind", [
328
328
  operator: z.enum(["==", "<=", ">=", "<", ">"]),
329
329
  value,
330
330
  }),
331
- z.strictObject({
332
- kind: z.literal("approval"),
333
- target: path.default("self"),
334
- party: name,
335
- action: name.optional(),
336
- decision: z.enum(["approved", "declined"]),
337
- differentFromInitiator: z.literal(true).optional(),
338
- protectedRequest: path.default("self"),
339
- }),
340
331
  z.strictObject({
341
332
  kind: z.literal("evidence"),
342
333
  instruction: path.optional(),
@@ -401,7 +392,6 @@ export const udlActionSchema = z.strictObject({
401
392
  summary: text,
402
393
  publicAction: name.optional(),
403
394
  expansionLimit: z.literal(8192).optional(),
404
- humanApproval: z.literal("distinct_member").optional(),
405
395
  reminder: z
406
396
  .strictObject({
407
397
  installment: path,
@@ -466,17 +456,6 @@ export const udlActionSchema = z.strictObject({
466
456
  )
467
457
  .max(16)
468
458
  .optional(),
469
- approval: z
470
- .strictObject({
471
- protectedRequest: path.default("self"),
472
- target: path,
473
- action: name,
474
- party: name,
475
- expires: path,
476
- input: z.record(name, value),
477
- decision: z.enum(["approved", "declined"]),
478
- })
479
- .optional(),
480
459
  });
481
460
  export const udlLifecycleSchema = z.strictObject({
482
461
  states: z.array(name).min(1).max(64),
package/src/validation.ts CHANGED
@@ -61,10 +61,6 @@ function moneyParty(
61
61
  (!instrument?.subject && document.parties[name]?.kind === "person"))
62
62
  );
63
63
  }
64
- function approvalParty(document: UdlDocument, name: string): boolean {
65
- const party = document.parties[name];
66
- return party?.kind === "staff" && !!party.role;
67
- }
68
64
 
69
65
  export type UdlValidationResult =
70
66
  | { ok: true; value: UdlDocument }
@@ -1039,38 +1035,6 @@ export function validateUdl(value: unknown): UdlValidationResult {
1039
1035
  for (const p of req.fields)
1040
1036
  if (!field(p, input, act))
1041
1037
  add(where, `unknown identity field ${p}`);
1042
- } else if (req.kind === "approval") {
1043
- const request = expect(
1044
- req.protectedRequest,
1045
- "ref",
1046
- where,
1047
- input,
1048
- act,
1049
- );
1050
- if (request?.type === "ref" && request.targetKind !== "instrument")
1051
- add(
1052
- where,
1053
- "protectedRequest must reference an instrument",
1054
- "UDL5001",
1055
- );
1056
- const target = expect(req.target, "ref", where, input, act);
1057
- if (!approvalParty(document, req.party))
1058
- add(
1059
- where,
1060
- `approval requires staff with a role: ${req.party}`,
1061
- hasParty(document, inst, req.party)
1062
- ? "party_kind_mismatch"
1063
- : "subject_party_unbound",
1064
- );
1065
- if (
1066
- req.action &&
1067
- target?.type === "ref" &&
1068
- target.targetKind === "instrument" &&
1069
- targetIds(target.target).some(
1070
- (id) => !byId.get(id)?.actions[req.action!],
1071
- )
1072
- )
1073
- add(where, `unknown approved action ${req.action}`);
1074
1038
  } else if (req.kind === "evidence") {
1075
1039
  if (req.instruction) {
1076
1040
  expect(req.instruction, "text", where, input, act);
@@ -1376,48 +1340,6 @@ export function validateUdl(value: unknown): UdlValidationResult {
1376
1340
  }
1377
1341
  }
1378
1342
  };
1379
- if (action.approval) {
1380
- const request = expect(
1381
- action.approval.protectedRequest,
1382
- "ref",
1383
- where,
1384
- action.input,
1385
- action,
1386
- );
1387
- if (request?.type === "ref" && request.targetKind !== "instrument")
1388
- add(
1389
- where,
1390
- "protectedRequest must reference an instrument",
1391
- "UDL5001",
1392
- );
1393
- const reference = expect(
1394
- action.approval.target,
1395
- "ref",
1396
- where,
1397
- action.input,
1398
- action,
1399
- );
1400
- if (
1401
- reference?.type === "ref" &&
1402
- reference.targetKind === "instrument" &&
1403
- targetIds(reference.target).some(
1404
- (id) => !byId.get(id)?.actions[action.approval!.action],
1405
- )
1406
- )
1407
- add(where, "approval target action does not exist");
1408
- if (reference?.type === "ref" && reference.targetKind === "instrument")
1409
- for (const id of targetIds(reference.target))
1410
- checkArguments(id, action.approval.action, action.approval.input);
1411
- expect(action.approval.expires, "date", where, action.input, action);
1412
- if (!approvalParty(document, action.approval.party))
1413
- add(
1414
- where,
1415
- "approval requires staff with a role",
1416
- hasParty(document, inst, action.approval.party)
1417
- ? "party_kind_mismatch"
1418
- : "subject_party_unbound",
1419
- );
1420
- }
1421
1343
  const targets: { targets: string[]; count: number }[] = [];
1422
1344
  for (const call of action.invoke ?? []) {
1423
1345
  if (call.guard)