@pegasimed.com/pegasi-sail-connect-shared 0.1.0-dev.0 → 0.1.0-dev.2

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 (44) hide show
  1. package/README.md +275 -125
  2. package/dist/capabilities/catalog-data.d.ts +4507 -0
  3. package/dist/capabilities/catalog-data.d.ts.map +1 -0
  4. package/dist/capabilities/catalog-data.js +4854 -0
  5. package/dist/capabilities/catalog-data.js.map +1 -0
  6. package/dist/capabilities/catalog.d.ts +41 -0
  7. package/dist/capabilities/catalog.d.ts.map +1 -0
  8. package/dist/capabilities/catalog.js +70 -0
  9. package/dist/capabilities/catalog.js.map +1 -0
  10. package/dist/capabilities/index.d.ts +8 -0
  11. package/dist/capabilities/index.d.ts.map +1 -0
  12. package/dist/capabilities/index.js +8 -0
  13. package/dist/capabilities/index.js.map +1 -0
  14. package/dist/capabilities/list.d.ts +24 -0
  15. package/dist/capabilities/list.d.ts.map +1 -0
  16. package/dist/capabilities/list.js +46 -0
  17. package/dist/capabilities/list.js.map +1 -0
  18. package/dist/capabilities/match.d.ts +43 -0
  19. package/dist/capabilities/match.d.ts.map +1 -0
  20. package/dist/capabilities/match.js +152 -0
  21. package/dist/capabilities/match.js.map +1 -0
  22. package/dist/capabilities/migration-data.d.ts +2364 -0
  23. package/dist/capabilities/migration-data.d.ts.map +1 -0
  24. package/dist/capabilities/migration-data.js +2579 -0
  25. package/dist/capabilities/migration-data.js.map +1 -0
  26. package/dist/capabilities/migration.d.ts +152 -0
  27. package/dist/capabilities/migration.d.ts.map +1 -0
  28. package/dist/capabilities/migration.js +243 -0
  29. package/dist/capabilities/migration.js.map +1 -0
  30. package/dist/capabilities/types.d.ts +108 -0
  31. package/dist/capabilities/types.d.ts.map +1 -0
  32. package/dist/capabilities/types.js +2 -0
  33. package/dist/capabilities/types.js.map +1 -0
  34. package/dist/capabilities/validate.d.ts +17 -0
  35. package/dist/capabilities/validate.d.ts.map +1 -0
  36. package/dist/capabilities/validate.js +281 -0
  37. package/dist/capabilities/validate.js.map +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -0
  41. package/dist/index.js.map +1 -1
  42. package/package.json +107 -102
  43. package/scripts/check-service-keys.mjs +213 -0
  44. package/scripts/lint-phi.mjs +266 -266
@@ -0,0 +1,108 @@
1
+ export type CapabilityProduct = "sail" | "connect";
2
+ /**
3
+ * `operation`: a key a service can require. `grant-wildcard`: a grant form
4
+ * (`servicio:recurso:*`, `servicio:*:acción`, `servicio:*:*`) that is only ever
5
+ * granted, never required.
6
+ */
7
+ export type CapabilityKind = "operation" | "grant-wildcard";
8
+ /** Role bundles that receive a key automatically. */
9
+ export type CapabilityRoleDefault = "tenant_admin";
10
+ export type PermissionMigrationOp = "rename" | "merge" | "split" | "retire" | "keep";
11
+ /** How carefully an administrator should grant the key; absent means normal. */
12
+ export type CapabilitySensitivity = "normal" | "sensitive";
13
+ export interface CapabilityDefinition {
14
+ readonly key: string;
15
+ readonly service: string;
16
+ readonly resource: string;
17
+ readonly action: string;
18
+ readonly displayName: string;
19
+ readonly description: string;
20
+ readonly groupKey: string;
21
+ readonly groupDisplayName: string;
22
+ readonly order: number;
23
+ readonly products: readonly CapabilityProduct[];
24
+ /** Whether a tenant administrator may assign the key to tenant users. */
25
+ readonly tenantAssignable: boolean;
26
+ readonly kind: CapabilityKind;
27
+ /** A wildcard grant never satisfies the key; only the exact key does. */
28
+ readonly exactMatch: boolean;
29
+ /** Presented by a service identity, never by a tenant user: always exactMatch and not tenant-assignable. */
30
+ readonly serviceToService: boolean;
31
+ readonly roleDefaults: readonly CapabilityRoleDefault[];
32
+ /** Why a flag was set conservatively or what the owner still has to decide. */
33
+ readonly notes?: string;
34
+ /** Curated sensitivity for administration screens; absent means normal. */
35
+ readonly sensitivity?: CapabilitySensitivity;
36
+ /** Curated warning shown before granting the key. */
37
+ readonly warning?: string;
38
+ }
39
+ export interface CapabilityGrammar {
40
+ readonly segments: number;
41
+ readonly segmentPattern: string;
42
+ readonly defaultResource: string;
43
+ readonly baseActions: readonly string[];
44
+ readonly specialActions: readonly string[];
45
+ readonly scopeSuffix: string;
46
+ }
47
+ export interface PermissionMigrationEntryDefinition {
48
+ readonly old: string;
49
+ readonly op: PermissionMigrationOp;
50
+ readonly canonical: readonly string[];
51
+ /** The exact grants an owner of the old key receives after migration. */
52
+ readonly grantMigration: readonly string[];
53
+ /**
54
+ * Grants for a stored value that differs from `old` only by case: the
55
+ * destinations whose old checks lower-cased the granted value. null when
56
+ * none did (the variant goes to unknown).
57
+ */
58
+ readonly caseVariantGrants: readonly string[] | null;
59
+ /**
60
+ * Grants for a stored value that equals `old` with surrounding spaces: the
61
+ * destinations whose old checks trimmed the granted value. null when none
62
+ * did (the variant goes to unknown).
63
+ */
64
+ readonly spaceVariantGrants: readonly string[] | null;
65
+ readonly note: string;
66
+ }
67
+ /** Old keys a service stores per entity and compares by equality (e.g. schedules-api profile grants). */
68
+ export interface PermissionProfileGrantRuleDefinition {
69
+ readonly service: string;
70
+ readonly field: string;
71
+ readonly evidence: string;
72
+ readonly keys: readonly {
73
+ readonly old: string;
74
+ readonly canonical: string;
75
+ }[];
76
+ }
77
+ /** Parameters of the rule for old service-prefix grants (`servicio:*`), with evidence. */
78
+ export interface PermissionPrefixRuleDefinition {
79
+ readonly note: string;
80
+ readonly services: readonly {
81
+ readonly service: string;
82
+ readonly evidence: string;
83
+ }[];
84
+ readonly excludedServices: readonly {
85
+ readonly service: string;
86
+ readonly evidence: string;
87
+ }[];
88
+ /** Non-exactMatch keys a prefix service compared by equality: a prefix never satisfied them. */
89
+ readonly exactChecked: readonly {
90
+ readonly key: string;
91
+ readonly evidence: string;
92
+ }[];
93
+ /** exactMatch keys the old prefix matcher did satisfy. */
94
+ readonly exactAllowed: readonly {
95
+ readonly key: string;
96
+ readonly evidence: string;
97
+ }[];
98
+ }
99
+ export interface PermissionLevelRuleDefinition {
100
+ readonly source: "permissionLevels";
101
+ readonly module: string;
102
+ readonly levels: readonly {
103
+ readonly level: number;
104
+ readonly grants: readonly string[];
105
+ }[];
106
+ readonly note: string;
107
+ }
108
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAE5D,qDAAqD;AACrD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErF,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC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
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/capabilities/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { CapabilityDefinition } from "./types.js";
2
+ export type CapabilityViolationCode = "invalid-catalog" | "invalid-entry" | "invalid-field" | "invalid-key-shape" | "invalid-segment" | "segment-mismatch" | "unknown-service" | "duplicate-key" | "duplicate-order" | "invalid-kind" | "invalid-action" | "scope-suffix-not-exact" | "wildcard-in-operation" | "wildcard-in-service" | "wildcard-without-wildcard" | "wildcard-flags" | "platform-wildcard-assignable" | "wildcard-without-target" | "assignable-wildcard-covers-unassignable" | "service-to-service-not-exact" | "service-to-service-role-defaults" | "invalid-products" | "undecided-products-assignable" | "invalid-role-defaults" | "invalid-sensitivity" | "invalid-warning";
3
+ export interface CapabilityViolation {
4
+ /** Position of the entry in the catalog; -1 for catalog-level violations. */
5
+ readonly index: number;
6
+ readonly key: string;
7
+ readonly code: CapabilityViolationCode;
8
+ readonly message: string;
9
+ }
10
+ /**
11
+ * Checks a catalog against the canonical grammar and the catalog invariants.
12
+ * Returns every violation found; never throws, whatever the input (hostile
13
+ * proxies, revoked proxies and throwing accessors become invalid-catalog or
14
+ * invalid-entry violations).
15
+ */
16
+ export declare function validateCapabilityCatalog(catalog: readonly CapabilityDefinition[]): CapabilityViolation[];
17
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/capabilities/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAC/B,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,wBAAwB,GACxB,uBAAuB,GACvB,qBAAqB,GACrB,2BAA2B,GAC3B,gBAAgB,GAChB,8BAA8B,GAC9B,yBAAyB,GACzB,yCAAyC,GACzC,8BAA8B,GAC9B,kCAAkC,GAClC,kBAAkB,GAClB,+BAA+B,GAC/B,uBAAuB,GACvB,qBAAqB,GACrB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAyOD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,mBAAmB,EAAE,CAOzG"}
@@ -0,0 +1,281 @@
1
+ import { CAPABILITY_GRAMMAR, CAPABILITY_SERVICES } from "./catalog-data.js";
2
+ import { readList } from "./list.js";
3
+ const WILDCARD = "*";
4
+ const SEGMENT = new RegExp(CAPABILITY_GRAMMAR.segmentPattern);
5
+ const ACTIONS = new Set([...CAPABILITY_GRAMMAR.baseActions, ...CAPABILITY_GRAMMAR.specialActions]);
6
+ const SERVICES = new Set(CAPABILITY_SERVICES);
7
+ const PRODUCTS = new Set(["sail", "connect"]);
8
+ const ROLE_DEFAULTS = new Set(["tenant_admin"]);
9
+ const SENSITIVITIES = new Set(["normal", "sensitive"]);
10
+ const TEXT_FIELDS = ["displayName", "description", "groupKey", "groupDisplayName"];
11
+ const FLAG_FIELDS = ["tenantAssignable", "exactMatch", "serviceToService"];
12
+ function isRecord(value) {
13
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14
+ }
15
+ function isUniqueStringArray(value, allowed) {
16
+ return (Array.isArray(value) &&
17
+ value.every((item) => typeof item === "string" && allowed.has(item)) &&
18
+ new Set(value).size === value.length);
19
+ }
20
+ function checkFields(entry, report) {
21
+ for (const field of TEXT_FIELDS) {
22
+ const value = entry[field];
23
+ if (typeof value !== "string" || value.trim().length === 0) {
24
+ report("invalid-field", `${field} must be a non-empty string.`);
25
+ }
26
+ }
27
+ for (const field of FLAG_FIELDS) {
28
+ if (typeof entry[field] !== "boolean") {
29
+ report("invalid-field", `${field} must be a boolean.`);
30
+ }
31
+ }
32
+ if (typeof entry.order !== "number" || !Number.isInteger(entry.order) || entry.order < 1) {
33
+ report("invalid-field", "order must be a positive integer.");
34
+ }
35
+ if (entry.notes !== undefined && (typeof entry.notes !== "string" || entry.notes.trim().length === 0)) {
36
+ report("invalid-field", "notes, when present, must be a non-empty string.");
37
+ }
38
+ if (entry.sensitivity !== undefined && !SENSITIVITIES.has(entry.sensitivity)) {
39
+ report("invalid-sensitivity", "sensitivity, when present, must be normal or sensitive.");
40
+ }
41
+ if (entry.warning !== undefined && (typeof entry.warning !== "string" || entry.warning.trim().length === 0)) {
42
+ report("invalid-warning", "warning, when present, must be a non-empty string.");
43
+ }
44
+ if (!isUniqueStringArray(entry.products, PRODUCTS)) {
45
+ report("invalid-products", "products must be a list of distinct values among sail and connect.");
46
+ }
47
+ else if (entry.products.length === 0 && entry.tenantAssignable === true) {
48
+ report("undecided-products-assignable", "An entry without a decided product cannot be tenant-assignable.");
49
+ }
50
+ if (!isUniqueStringArray(entry.roleDefaults, ROLE_DEFAULTS)) {
51
+ report("invalid-role-defaults", "roleDefaults must be a list of distinct values among tenant_admin.");
52
+ }
53
+ if (entry.serviceToService === true && (entry.kind !== "operation" || entry.exactMatch !== true || entry.tenantAssignable !== false)) {
54
+ report("service-to-service-not-exact", "A service-to-service key must be an exactMatch, non-tenant-assignable operation.");
55
+ }
56
+ if (entry.serviceToService === true && Array.isArray(entry.roleDefaults) && entry.roleDefaults.length > 0) {
57
+ report("service-to-service-role-defaults", "A service-to-service key cannot be granted by default to a tenant user role.");
58
+ }
59
+ }
60
+ function checkAction(action, entry, report) {
61
+ const suffix = CAPABILITY_GRAMMAR.scopeSuffix;
62
+ const scoped = action.endsWith(suffix);
63
+ const base = scoped ? action.slice(0, -suffix.length) : action;
64
+ if (!ACTIONS.has(base)) {
65
+ report("invalid-action", `Action "${action}" is outside the closed vocabulary.`);
66
+ return;
67
+ }
68
+ if (scoped && (entry.kind !== "operation" || entry.exactMatch !== true || entry.tenantAssignable !== false)) {
69
+ report("scope-suffix-not-exact", `The ${suffix} scope suffix is only valid on exact-match, non-tenant-assignable operation keys.`);
70
+ }
71
+ }
72
+ function checkKey(entry, report) {
73
+ const key = entry.key;
74
+ if (typeof key !== "string") {
75
+ report("invalid-field", "key must be a string.");
76
+ return undefined;
77
+ }
78
+ const segments = key.split(":");
79
+ if (segments.length !== CAPABILITY_GRAMMAR.segments) {
80
+ report("invalid-key-shape", `Key must have exactly ${CAPABILITY_GRAMMAR.segments} segments.`);
81
+ return undefined;
82
+ }
83
+ const [service, resource, action] = segments;
84
+ if (entry.service !== service || entry.resource !== resource || entry.action !== action) {
85
+ report("segment-mismatch", "service, resource and action must equal the key segments.");
86
+ }
87
+ if (service === WILDCARD) {
88
+ report("wildcard-in-service", "The service segment can never be a wildcard.");
89
+ return undefined;
90
+ }
91
+ for (const segment of segments) {
92
+ if (segment !== WILDCARD && !SEGMENT.test(segment)) {
93
+ report("invalid-segment", `Segment "${segment}" is not lowercase kebab-case.`);
94
+ return undefined;
95
+ }
96
+ }
97
+ if (!SERVICES.has(service)) {
98
+ report("unknown-service", `Service "${service}" is not a known owning service.`);
99
+ }
100
+ return segments;
101
+ }
102
+ function checkKind(entry, segments, report) {
103
+ const [, resource, action] = segments;
104
+ const hasWildcard = resource === WILDCARD || action === WILDCARD;
105
+ if (entry.kind === "operation") {
106
+ if (hasWildcard) {
107
+ report("wildcard-in-operation", "Operation keys can never contain a wildcard.");
108
+ return;
109
+ }
110
+ checkAction(action, entry, report);
111
+ return;
112
+ }
113
+ if (entry.kind !== "grant-wildcard") {
114
+ report("invalid-kind", "kind must be operation or grant-wildcard.");
115
+ return;
116
+ }
117
+ if (!hasWildcard) {
118
+ report("wildcard-without-wildcard", "A grant-wildcard entry must have a wildcard resource or action.");
119
+ return;
120
+ }
121
+ if (action !== WILDCARD) {
122
+ checkAction(action, entry, report);
123
+ }
124
+ if (entry.exactMatch !== false || (Array.isArray(entry.roleDefaults) && entry.roleDefaults.length > 0)) {
125
+ report("wildcard-flags", "A grant-wildcard entry must have exactMatch false and no roleDefaults.");
126
+ }
127
+ if (resource === WILDCARD && action === WILDCARD && entry.tenantAssignable !== false) {
128
+ report("platform-wildcard-assignable", "servicio:*:* is platform-only and never tenant-assignable.");
129
+ }
130
+ }
131
+ // Operation entries a wildcard grant satisfies (non-exactMatch keys of its service).
132
+ function wildcardTargets(wildcard, catalog) {
133
+ const [service, resource, action] = wildcard;
134
+ return catalog.filter((entry) => entry.kind === "operation" &&
135
+ entry.exactMatch === false &&
136
+ entry.service === service &&
137
+ (resource === WILDCARD || entry.resource === resource) &&
138
+ (action === WILDCARD || entry.action === action));
139
+ }
140
+ function checkWildcardTargets(entry, segments, catalog, report) {
141
+ const targets = wildcardTargets(segments, catalog);
142
+ if (targets.length === 0) {
143
+ report("wildcard-without-target", "A grant-wildcard entry must satisfy at least one non-exact operation key.");
144
+ return;
145
+ }
146
+ // A tenant administrator could otherwise delegate, through the wildcard, a
147
+ // key the catalog declares non-assignable. Such keys must be exactMatch.
148
+ const unassignable = targets.filter((target) => target.tenantAssignable !== true).map((target) => String(target.key));
149
+ if (entry.tenantAssignable === true && unassignable.length > 0) {
150
+ report("assignable-wildcard-covers-unassignable", `A tenant-assignable wildcard cannot satisfy non-assignable keys unless they are exactMatch: ${unassignable.join(", ")}.`);
151
+ }
152
+ }
153
+ const ENTRY_FIELDS = [
154
+ "key",
155
+ "service",
156
+ "resource",
157
+ "action",
158
+ "displayName",
159
+ "description",
160
+ "groupKey",
161
+ "groupDisplayName",
162
+ "order",
163
+ "products",
164
+ "tenantAssignable",
165
+ "kind",
166
+ "exactMatch",
167
+ "serviceToService",
168
+ "roleDefaults",
169
+ "notes",
170
+ "sensitivity",
171
+ "warning"
172
+ ];
173
+ const ARRAY_FIELDS = new Set(["products", "roleDefaults"]);
174
+ // Marks a catalog element (or entry) whose inspection threw.
175
+ const UNREADABLE = Symbol("unreadable");
176
+ // Plain copy of an array (readList: by index, bounded); a non-array is
177
+ // returned as is. Throws when the array is unreadable, so the entry is.
178
+ function copyArray(value) {
179
+ const read = readList(value);
180
+ if (read.status === "unreadable") {
181
+ throw new Error("unreadable array");
182
+ }
183
+ return read.status === "ok" ? read.items : value;
184
+ }
185
+ // Plain snapshot of an entry's fields, so the checks never touch the input
186
+ // again. undefined when it is not an object; UNREADABLE when reading throws.
187
+ function snapshotEntry(value) {
188
+ try {
189
+ if (!isRecord(value)) {
190
+ return undefined;
191
+ }
192
+ const snapshot = {};
193
+ for (const field of ENTRY_FIELDS) {
194
+ const fieldValue = value[field];
195
+ snapshot[field] = ARRAY_FIELDS.has(field) ? copyArray(fieldValue) : fieldValue;
196
+ }
197
+ return snapshot;
198
+ }
199
+ catch {
200
+ return UNREADABLE;
201
+ }
202
+ }
203
+ // Plain copy of the catalog's elements (readList: by index, at most
204
+ // MAX_LIST_LENGTH); undefined when it is not an array; throws when unreadable.
205
+ function readCatalog(catalog) {
206
+ const read = readList(catalog);
207
+ if (read.status === "unreadable") {
208
+ throw new Error("unreadable catalog");
209
+ }
210
+ return read.status === "ok" ? read.items : undefined;
211
+ }
212
+ /**
213
+ * Checks a catalog against the canonical grammar and the catalog invariants.
214
+ * Returns every violation found; never throws, whatever the input (hostile
215
+ * proxies, revoked proxies and throwing accessors become invalid-catalog or
216
+ * invalid-entry violations).
217
+ */
218
+ export function validateCapabilityCatalog(catalog) {
219
+ const violations = [];
220
+ try {
221
+ return collectViolations(catalog, violations);
222
+ }
223
+ catch {
224
+ return [...violations, { index: -1, key: "", code: "invalid-catalog", message: "The catalog could not be validated." }];
225
+ }
226
+ }
227
+ function collectViolations(catalog, violations) {
228
+ let items;
229
+ try {
230
+ items = readCatalog(catalog);
231
+ }
232
+ catch {
233
+ return [{ index: -1, key: "", code: "invalid-catalog", message: "The catalog could not be read." }];
234
+ }
235
+ if (items === undefined) {
236
+ return [{ index: -1, key: "", code: "invalid-catalog", message: "The catalog must be an array." }];
237
+ }
238
+ const snapshots = items.map((item) => snapshotEntry(item));
239
+ const entries = snapshots.filter((snapshot) => isRecord(snapshot));
240
+ const seenKeys = new Map();
241
+ const seenOrders = new Map();
242
+ snapshots.forEach((value, index) => {
243
+ const key = isRecord(value) && typeof value.key === "string" ? value.key : "";
244
+ const report = (code, message) => violations.push({ index, key, code, message });
245
+ if (value === UNREADABLE) {
246
+ report("invalid-entry", "The catalog entry could not be read.");
247
+ return;
248
+ }
249
+ if (!isRecord(value)) {
250
+ report("invalid-entry", "Each catalog entry must be an object.");
251
+ return;
252
+ }
253
+ checkFields(value, report);
254
+ const segments = checkKey(value, report);
255
+ if (typeof value.key === "string") {
256
+ if (seenKeys.has(value.key)) {
257
+ report("duplicate-key", `Key already defined at index ${seenKeys.get(value.key)}.`);
258
+ }
259
+ else {
260
+ seenKeys.set(value.key, index);
261
+ }
262
+ }
263
+ if (typeof value.order === "number") {
264
+ if (seenOrders.has(value.order)) {
265
+ report("duplicate-order", `order already used at index ${seenOrders.get(value.order)}.`);
266
+ }
267
+ else {
268
+ seenOrders.set(value.order, index);
269
+ }
270
+ }
271
+ if (segments === undefined) {
272
+ return;
273
+ }
274
+ checkKind(value, segments, report);
275
+ if (value.kind === "grant-wildcard") {
276
+ checkWildcardTargets(value, segments, entries, report);
277
+ }
278
+ });
279
+ return violations;
280
+ }
281
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/capabilities/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,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GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YACpC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./audit.js";
2
+ export * from "./capabilities/index.js";
2
3
  export * from "./clinical-operations.js";
3
4
  export * from "./config.js";
4
5
  export * from "./ids.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./audit.js";
2
+ export * from "./capabilities/index.js";
2
3
  export * from "./clinical-operations.js";
3
4
  export * from "./config.js";
4
5
  export * from "./ids.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}