@pegasimed.com/pegasi-sail-connect-shared 0.2.0-dev.0 → 0.2.0-dev.10

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 (48) hide show
  1. package/README.md +273 -37
  2. package/dist/authorization/index.d.ts +1 -0
  3. package/dist/authorization/index.d.ts.map +1 -1
  4. package/dist/authorization/index.js +1 -0
  5. package/dist/authorization/index.js.map +1 -1
  6. package/dist/authorization/work-grants.d.ts +151 -0
  7. package/dist/authorization/work-grants.d.ts.map +1 -0
  8. package/dist/authorization/work-grants.js +306 -0
  9. package/dist/authorization/work-grants.js.map +1 -0
  10. package/dist/authorization-testing.d.ts +229 -0
  11. package/dist/authorization-testing.d.ts.map +1 -0
  12. package/dist/authorization-testing.js +744 -0
  13. package/dist/authorization-testing.js.map +1 -0
  14. package/dist/capabilities/canonical-json.d.ts +3 -0
  15. package/dist/capabilities/canonical-json.d.ts.map +1 -0
  16. package/dist/capabilities/canonical-json.js +83 -0
  17. package/dist/capabilities/canonical-json.js.map +1 -0
  18. package/dist/capabilities/catalog-data.d.ts +575 -291
  19. package/dist/capabilities/catalog-data.d.ts.map +1 -1
  20. package/dist/capabilities/catalog-data.js +604 -303
  21. package/dist/capabilities/catalog-data.js.map +1 -1
  22. package/dist/capabilities/catalog.d.ts.map +1 -1
  23. package/dist/capabilities/catalog.js +4 -4
  24. package/dist/capabilities/catalog.js.map +1 -1
  25. package/dist/capabilities/index.d.ts +4 -0
  26. package/dist/capabilities/index.d.ts.map +1 -1
  27. package/dist/capabilities/index.js +7 -0
  28. package/dist/capabilities/index.js.map +1 -1
  29. package/dist/capabilities/migration-data.d.ts +105 -190
  30. package/dist/capabilities/migration-data.d.ts.map +1 -1
  31. package/dist/capabilities/migration-data.js +83 -144
  32. package/dist/capabilities/migration-data.js.map +1 -1
  33. package/dist/capabilities/migration.d.ts +20 -20
  34. package/dist/capabilities/migration.d.ts.map +1 -1
  35. package/dist/capabilities/migration.js +25 -40
  36. package/dist/capabilities/migration.js.map +1 -1
  37. package/dist/capabilities/sha256.d.ts +18 -0
  38. package/dist/capabilities/sha256.d.ts.map +1 -0
  39. package/dist/capabilities/sha256.js +180 -0
  40. package/dist/capabilities/sha256.js.map +1 -0
  41. package/dist/capabilities/types.d.ts +3 -2
  42. package/dist/capabilities/types.d.ts.map +1 -1
  43. package/dist/worker-logger.d.ts +46 -4
  44. package/dist/worker-logger.d.ts.map +1 -1
  45. package/dist/worker-logger.js +33 -11
  46. package/dist/worker-logger.js.map +1 -1
  47. package/package.json +7 -3
  48. package/scripts/check-service-keys.mjs +30 -7
@@ -0,0 +1,180 @@
1
+ // SHA-256 (FIPS 180-4) in plain TypeScript, so that `./capabilities` and
2
+ // `./authorization` run unchanged in Node, browsers and edge runtimes: no
3
+ // `node:crypto`, no `Buffer`, no Web Crypto (which is asynchronous) and no
4
+ // TextEncoder. The output is byte-identical to
5
+ // `createHash("sha256").update(text, "utf8")` of node:crypto, including the
6
+ // replacement of lone surrogates by U+FFFD (test/capabilities/sha256.test.ts
7
+ // checks the NIST vectors and the equivalence with node:crypto).
8
+ //
9
+ // Internal to the package: not exported by any subpath.
10
+ const ROUND_CONSTANTS = new Uint32Array([
11
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
12
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
13
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
14
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
15
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
16
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
17
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
18
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
19
+ ]);
20
+ const INITIAL_HASH = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
21
+ // Code point at `index` (a lone surrogate reads as U+FFFD) and the number of
22
+ // UTF-16 code units it takes.
23
+ function codePointAt(text, index) {
24
+ const unit = text.charCodeAt(index);
25
+ if (unit < 0xd800 || unit > 0xdfff) {
26
+ return [unit, 1];
27
+ }
28
+ const next = index + 1 < text.length ? text.charCodeAt(index + 1) : 0;
29
+ if (unit <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
30
+ return [0x10000 + ((unit - 0xd800) << 10) + (next - 0xdc00), 2];
31
+ }
32
+ return [0xfffd, 1];
33
+ }
34
+ function utf8Length(codePoint) {
35
+ return codePoint < 0x80 ? 1 : codePoint < 0x800 ? 2 : codePoint < 0x10000 ? 3 : 4;
36
+ }
37
+ /**
38
+ * UTF-8 bytes of a JavaScript string, as `Buffer.from(text, "utf8")` (and
39
+ * TextEncoder) produce them: a lone surrogate becomes U+FFFD (EF BF BD).
40
+ * Written into a preallocated Uint8Array (never `push` on an array, which an
41
+ * inherited index setter could intercept).
42
+ */
43
+ export function utf8Bytes(text) {
44
+ let length = 0;
45
+ for (let index = 0; index < text.length;) {
46
+ const [codePoint, units] = codePointAt(text, index);
47
+ length += utf8Length(codePoint);
48
+ index += units;
49
+ }
50
+ const bytes = new Uint8Array(length);
51
+ let position = 0;
52
+ for (let index = 0; index < text.length;) {
53
+ const [codePoint, units] = codePointAt(text, index);
54
+ index += units;
55
+ const size = utf8Length(codePoint);
56
+ if (size === 1) {
57
+ bytes[position] = codePoint;
58
+ }
59
+ else if (size === 2) {
60
+ bytes[position] = 0xc0 | (codePoint >> 6);
61
+ bytes[position + 1] = 0x80 | (codePoint & 0x3f);
62
+ }
63
+ else if (size === 3) {
64
+ bytes[position] = 0xe0 | (codePoint >> 12);
65
+ bytes[position + 1] = 0x80 | ((codePoint >> 6) & 0x3f);
66
+ bytes[position + 2] = 0x80 | (codePoint & 0x3f);
67
+ }
68
+ else {
69
+ bytes[position] = 0xf0 | (codePoint >> 18);
70
+ bytes[position + 1] = 0x80 | ((codePoint >> 12) & 0x3f);
71
+ bytes[position + 2] = 0x80 | ((codePoint >> 6) & 0x3f);
72
+ bytes[position + 3] = 0x80 | (codePoint & 0x3f);
73
+ }
74
+ position += size;
75
+ }
76
+ return bytes;
77
+ }
78
+ function rotateRight(value, bits) {
79
+ return (value >>> bits) | (value << (32 - bits));
80
+ }
81
+ /** SHA-256 digest (32 bytes) of a byte array. */
82
+ export function sha256Bytes(message) {
83
+ const bitLength = message.length * 8;
84
+ // Message, the 0x80 marker, zero padding and the 64-bit big-endian length.
85
+ const paddedLength = Math.ceil((message.length + 9) / 64) * 64;
86
+ const padded = new Uint8Array(paddedLength);
87
+ padded.set(message);
88
+ padded[message.length] = 0x80;
89
+ const view = new DataView(padded.buffer);
90
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x100000000));
91
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
92
+ const hash = Uint32Array.from(INITIAL_HASH);
93
+ const schedule = new Uint32Array(64);
94
+ for (let offset = 0; offset < paddedLength; offset += 64) {
95
+ for (let round = 0; round < 16; round += 1) {
96
+ schedule[round] = view.getUint32(offset + round * 4);
97
+ }
98
+ for (let round = 16; round < 64; round += 1) {
99
+ const w15 = schedule[round - 15];
100
+ const w2 = schedule[round - 2];
101
+ const sigma0 = rotateRight(w15, 7) ^ rotateRight(w15, 18) ^ (w15 >>> 3);
102
+ const sigma1 = rotateRight(w2, 17) ^ rotateRight(w2, 19) ^ (w2 >>> 10);
103
+ schedule[round] = (schedule[round - 16] + sigma0 + schedule[round - 7] + sigma1) >>> 0;
104
+ }
105
+ let a = hash[0];
106
+ let b = hash[1];
107
+ let c = hash[2];
108
+ let d = hash[3];
109
+ let e = hash[4];
110
+ let f = hash[5];
111
+ let g = hash[6];
112
+ let h = hash[7];
113
+ for (let round = 0; round < 64; round += 1) {
114
+ const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
115
+ const choice = (e & f) ^ (~e & g);
116
+ const temp1 = (h + sum1 + choice + ROUND_CONSTANTS[round] + schedule[round]) >>> 0;
117
+ const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
118
+ const majority = (a & b) ^ (a & c) ^ (b & c);
119
+ const temp2 = (sum0 + majority) >>> 0;
120
+ h = g;
121
+ g = f;
122
+ f = e;
123
+ e = (d + temp1) >>> 0;
124
+ d = c;
125
+ c = b;
126
+ b = a;
127
+ a = (temp1 + temp2) >>> 0;
128
+ }
129
+ hash[0] = (hash[0] + a) >>> 0;
130
+ hash[1] = (hash[1] + b) >>> 0;
131
+ hash[2] = (hash[2] + c) >>> 0;
132
+ hash[3] = (hash[3] + d) >>> 0;
133
+ hash[4] = (hash[4] + e) >>> 0;
134
+ hash[5] = (hash[5] + f) >>> 0;
135
+ hash[6] = (hash[6] + g) >>> 0;
136
+ hash[7] = (hash[7] + h) >>> 0;
137
+ }
138
+ const digest = new Uint8Array(32);
139
+ const digestView = new DataView(digest.buffer);
140
+ hash.forEach((word, index) => digestView.setUint32(index * 4, word));
141
+ return digest;
142
+ }
143
+ const HEX = "0123456789abcdef";
144
+ const BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
145
+ /** Lower-case hex of a byte array, as `digest("hex")`. */
146
+ export function toHex(bytes) {
147
+ let text = "";
148
+ for (const byte of bytes) {
149
+ text += HEX[byte >> 4] + HEX[byte & 0x0f];
150
+ }
151
+ return text;
152
+ }
153
+ /** Base64url without padding (RFC 4648 §5), as `digest("base64url")`. */
154
+ export function toBase64Url(bytes) {
155
+ let text = "";
156
+ for (let index = 0; index < bytes.length; index += 3) {
157
+ const first = bytes[index];
158
+ const second = index + 1 < bytes.length ? bytes[index + 1] : 0;
159
+ const third = index + 2 < bytes.length ? bytes[index + 2] : 0;
160
+ const triple = (first << 16) | (second << 8) | third;
161
+ text += BASE64URL[(triple >> 18) & 0x3f];
162
+ text += BASE64URL[(triple >> 12) & 0x3f];
163
+ if (index + 1 < bytes.length) {
164
+ text += BASE64URL[(triple >> 6) & 0x3f];
165
+ }
166
+ if (index + 2 < bytes.length) {
167
+ text += BASE64URL[triple & 0x3f];
168
+ }
169
+ }
170
+ return text;
171
+ }
172
+ /** Hex SHA-256 of the UTF-8 bytes of a string: `createHash("sha256").update(text, "utf8").digest("hex")`. */
173
+ export function sha256Hex(text) {
174
+ return toHex(sha256Bytes(utf8Bytes(text)));
175
+ }
176
+ /** Base64url SHA-256 of the UTF-8 bytes of a string: `createHash("sha256").update(text, "utf8").digest("base64url")`. */
177
+ export function sha256Base64Url(text) {
178
+ return toBase64Url(sha256Bytes(utf8Bytes(text)));
179
+ }
180
+ //# sourceMappingURL=sha256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.js","sourceRoot":"","sources":["../../src/capabilities/sha256.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,+CAA+C;AAC/C,4EAA4E;AAC5E,6EAA6E;AAC7E,iEAAiE;AACjE,EAAE;AACF,wDAAwD;AAExD,MAAM,eAAe,GAAG,IAAI,WAAW,CAAC;IACtC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAA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,CAAC;QACD,IAAI,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAW,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,yHAAyH;AACzH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -77,8 +77,9 @@ export interface PermissionProfileGrantRuleDefinition {
77
77
  }[];
78
78
  }
79
79
  /**
80
- * Data-migration rule for stored old service-prefix grants (`servicio:*`),
81
- * with evidence and the enumerated lists it produces. It is not a grant form.
80
+ * Data-migration rule for stored old service-prefix grants (`servicio:*`).
81
+ * Since 0.2.0-dev.4 (zero wildcards) every service is in excludedServices,
82
+ * with its reason, and every other field is empty. It is not a grant form.
82
83
  */
83
84
  export interface PermissionPrefixRuleDefinition {
84
85
  readonly note: string;
@@ -1 +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;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AAEzC,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,M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C,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -1,14 +1,56 @@
1
- import pino from "pino";
2
- export interface WorkerLoggerOptions {
1
+ import type { LevelWithSilent, Logger } from "pino";
2
+ /** What createWorkerLogger passes to pino (or to the injected factory). */
3
+ export interface WorkerLoggerConfig {
4
+ readonly name: string;
5
+ readonly level: LevelWithSilent;
6
+ readonly redact: {
7
+ readonly paths: string[];
8
+ readonly censor: string;
9
+ };
10
+ }
11
+ /**
12
+ * Minimal contract of an injected logger factory: called once with
13
+ * WorkerLoggerConfig, it returns the logger, and createWorkerLogger returns
14
+ * that same logger with the factory's exact type `L`. The `pino` default
15
+ * export itself satisfies it: `createWorkerLogger(service, component, { pino })`
16
+ * is typed `Logger<string, boolean>` by pino's declarations, which is not
17
+ * assignable to the default `Logger`; when exactly `Logger` is needed, pass
18
+ * the lambda `(config) => pino(config)`.
19
+ */
20
+ export type WorkerLoggerFactory<L = Logger> = (config: WorkerLoggerConfig) => L;
21
+ export interface WorkerLoggerOptions<L = Logger> {
3
22
  /** Override the LOG_LEVEL env default. */
4
- readonly level?: pino.LevelWithSilent;
23
+ readonly level?: LevelWithSilent;
24
+ /**
25
+ * Factory to use instead of loading the optional peer dependency `pino`
26
+ * (for example the service's own `import pino from "pino"`, or a bundler
27
+ * where `require` is not available).
28
+ */
29
+ readonly pino?: WorkerLoggerFactory<L>;
30
+ }
31
+ /** Thrown by createWorkerLogger when pino is not installed and no factory was passed. */
32
+ export declare class WorkerLoggerUnavailableError extends Error {
33
+ readonly code: "WORKER_LOGGER_UNAVAILABLE";
34
+ constructor(cause: unknown);
5
35
  }
6
36
  /**
7
37
  * Build a Pino logger pre-configured with the shared PHI redact paths
8
38
  * and a `<service>/<component>` name.
9
39
  *
40
+ * With a factory in `options.pino` it returns what the factory returns, with
41
+ * the factory's exact type `L` (that overload is resolved first). Any other
42
+ * options (none, a variable or parameter typed WorkerLoggerOptions, or
43
+ * `{ pino: factory | undefined }`) give pino's `Logger`, as in 0.2.0-dev.1. A
44
+ * type argument without a factory does not compile.
45
+ *
10
46
  * @param service e.g. "commercial-core-api" — the npm package name root
11
47
  * @param component e.g. "outbox-worker" — the worker's role
48
+ * @throws WorkerLoggerUnavailableError when pino is not installed and options.pino is not set
12
49
  */
13
- export declare function createWorkerLogger(service: string, component: string, options?: WorkerLoggerOptions): pino.Logger;
50
+ export declare function createWorkerLogger<L>(service: string, component: string, options: WorkerLoggerOptions<L> & {
51
+ readonly pino: WorkerLoggerFactory<L>;
52
+ }): L;
53
+ export declare function createWorkerLogger(service: string, component: string, options?: Omit<WorkerLoggerOptions, "pino"> & {
54
+ readonly pino?: WorkerLoggerFactory | undefined;
55
+ }): Logger;
14
56
  //# sourceMappingURL=worker-logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-logger.d.ts","sourceRoot":"","sources":["../src/worker-logger.ts"],"names":[],"mappings":"AAeA,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAAC,MAAM,CAMb"}
1
+ {"version":3,"file":"worker-logger.d.ts","sourceRoot":"","sources":["../src/worker-logger.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAInE,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,QA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ted just like in the HTTP path.
7
7
  //
8
- // Pino is bundled with Fastify (peerDependency); we declare it as
9
- // our own peerDependency too so consumers don't pull a duplicate copy.
8
+ // Pino is an OPTIONAL peer dependency (0.2.0-dev.2, PKG-06): importing the
9
+ // package (or any subpath) never loads it. createWorkerLogger loads it
10
+ // lazily on its first call, from the consumer's installation, or uses the
11
+ // factory passed in `options.pino`. Without either it throws
12
+ // WorkerLoggerUnavailableError. Only types are imported from pino here, and
13
+ // they are erased from the compiled JavaScript.
10
14
  //
11
15
  // Usage:
12
16
  // import { createWorkerLogger } from "@pegasimed.com/pegasi-sail-connect-shared";
13
17
  // const log = createWorkerLogger("commercial-core-api", "outbox-worker");
14
18
  // log.info({ result }, "cycle done");
15
- import pino from "pino";
19
+ import { createRequire } from "node:module";
16
20
  import { PHI_LOG_REDACT_CENSOR, PHI_LOG_REDACT_PATHS } from "./phi-redaction.js";
17
- /**
18
- * Build a Pino logger pre-configured with the shared PHI redact paths
19
- * and a `<service>/<component>` name.
20
- *
21
- * @param service e.g. "commercial-core-api" — the npm package name root
22
- * @param component e.g. "outbox-worker" — the worker's role
23
- */
21
+ /** Thrown by createWorkerLogger when pino is not installed and no factory was passed. */
22
+ export class WorkerLoggerUnavailableError extends Error {
23
+ code = "WORKER_LOGGER_UNAVAILABLE";
24
+ constructor(cause) {
25
+ super('createWorkerLogger needs the optional peer dependency "pino" (^10): install it or pass options.pino.', { cause });
26
+ this.name = "WorkerLoggerUnavailableError";
27
+ }
28
+ }
29
+ const requireFromPackage = createRequire(import.meta.url);
30
+ let loadedPino;
31
+ // Loads pino on first use only (never at import time) and keeps it.
32
+ function loadPino() {
33
+ if (loadedPino === undefined) {
34
+ try {
35
+ const loaded = requireFromPackage("pino");
36
+ loadedPino = (config) => loaded(config);
37
+ }
38
+ catch (error) {
39
+ throw new WorkerLoggerUnavailableError(error);
40
+ }
41
+ }
42
+ return loadedPino;
43
+ }
24
44
  export function createWorkerLogger(service, component, options = {}) {
25
- return pino({
45
+ // Without a defined factory the second overload applies: L is pino's own Logger.
46
+ const factory = options.pino ?? loadPino();
47
+ return factory({
26
48
  name: `${service}/${component}`,
27
49
  level: options.level ?? process.env.LOG_LEVEL ?? "info",
28
50
  redact: { paths: [...PHI_LOG_REDACT_PATHS], censor: PHI_LOG_REDACT_CENSOR }
@@ -1 +1 @@
1
- {"version":3,"file":"worker-logger.js","sourceRoot":"","sources":["../src/worker-logger.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,iEAAiE;AACjE,gEAAgE;AAChE,oEAAoE;AACpE,+DAA+D;AAC/D,gEAAgE;AAChE,EAAE;AACF,kEAAkE;AAClE,uEAAuE;AACvE,EAAE;AACF,SAAS;AACT,oFAAoF;AACpF,4EAA4E;AAC5E,wCAAwC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAOjF;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,SAAiB,EACjB,UAA+B,EAAE;IAEjC,OAAO,IAAI,CAAC;QACV,IAAI,EAAE,GAAG,OAAO,IAAI,SAAS,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAK,OAAO,CAAC,GAAG,CAAC,SAA8C,IAAI,MAAM;QAC7F,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE;KAC5E,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"worker-logger.js","sourceRoot":"","sources":["../src/worker-logger.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,iEAAiE;AACjE,gEAAgE;AAChE,oEAAoE;AACpE,+DAA+D;AAC/D,gEAAgE;AAChE,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,6DAA6D;AAC7D,4EAA4E;AAC5E,gDAAgD;AAChD,EAAE;AACF,SAA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AAC,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE;KAC5E,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pegasimed.com/pegasi-sail-connect-shared",
3
- "version": "0.2.0-dev.0",
3
+ "version": "0.2.0-dev.10",
4
4
  "description": "Versioned shared TypeScript helpers for PEGASI SAIL/CONNECT services.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,6 +57,10 @@
57
57
  "./authorization": {
58
58
  "types": "./dist/authorization/index.d.ts",
59
59
  "import": "./dist/authorization/index.js"
60
+ },
61
+ "./authorization/testing": {
62
+ "types": "./dist/authorization-testing.d.ts",
63
+ "import": "./dist/authorization-testing.js"
60
64
  }
61
65
  },
62
66
  "files": [
@@ -70,7 +74,7 @@
70
74
  },
71
75
  "scripts": {
72
76
  "build": "tsc -p tsconfig.json",
73
- "check": "tsc -p tsconfig.json --noEmit && tsc -p test/capabilities/tsconfig.json && tsc -p test/authorization/tsconfig.json",
77
+ "check": "tsc -p tsconfig.json --noEmit && tsc -p test/tsconfig.json && tsc -p test/capabilities/tsconfig.json && tsc -p test/authorization/tsconfig.json",
74
78
  "prepare": "npm run build",
75
79
  "lint": "eslint .",
76
80
  "test": "vitest run --coverage",
@@ -92,7 +96,7 @@
92
96
  "optional": true
93
97
  },
94
98
  "pino": {
95
- "optional": false
99
+ "optional": true
96
100
  }
97
101
  },
98
102
  "devDependencies": {
@@ -13,10 +13,12 @@
13
13
  // - "drift": the literal has the shape `servicio:recurso:acción` (three
14
14
  // segments of the catalog grammar) but is not a catalog key; or it is a
15
15
  // key-shaped literal with `*` anywhere in a segment (`patient:dom*:read`,
16
- // `patient:**:read`, `*:*:*`), a two-segment `servicio:*` of a catalog
17
- // service, or an old key with `*` (`meetings:*`). A literal with `*` is
18
- // always drift, before "old": there are no wildcard grants, every grant is
19
- // an explicit catalog key.
16
+ // `patient:**:read`, `*:*:*`), a two-segment `servicio:*` whose first
17
+ // segment is a catalog service or the namespace of an old key of
18
+ // PERMISSION_MIGRATION (`patient:*`, `meetings:*`, `access-api:*`,
19
+ // `users:*`), or an old key with `*`. A literal with `*` is always drift,
20
+ // before "old": there are no wildcard grants, every grant is an explicit
21
+ // catalog key, and since 0.2.0-dev.4 every stored wildcard is quarantined.
20
22
  //
21
23
  // Keys built at run time (template literals with substitutions,
22
24
  // concatenations) are not visible here: the authorization helper of the
@@ -57,12 +59,14 @@ const WILDCARD_SEGMENT = "[a-z*][a-z0-9*]*(?:-[a-z0-9*]+)*";
57
59
  /** Three key-shaped segments with `*` allowed anywhere in them. */
58
60
  export const WILDCARD_KEY_SHAPE = new RegExp(`^${WILDCARD_SEGMENT}:${WILDCARD_SEGMENT}:${WILDCARD_SEGMENT}$`);
59
61
  const TWO_SEGMENT_WILDCARD = new RegExp(`^(${SEGMENT}):${WILDCARD_SEGMENT}$`);
62
+ const NAMESPACE = new RegExp(`^${SEGMENT}$`);
60
63
 
61
64
  /**
62
65
  * True for a literal with `*` that has the shape of a key: three segments
63
66
  * with `*` anywhere, or two segments (`servicio:*`, `servicio:recu*`) whose
64
- * first segment is a catalog service. Other text with `*` (a MIME type, a
65
- * glob, `image:*` of no service) is not a permission.
67
+ * first segment is in `services` (scanFiles passes wildcardNamespaces: the
68
+ * catalog services and the old key namespaces). Other text with `*` (a MIME
69
+ * type, a glob, `image:*` of no service) is not a permission.
66
70
  */
67
71
  export function isWildcardKeyLiteral(text, services) {
68
72
  if (!text.includes("*")) {
@@ -129,6 +133,25 @@ export function collectStringLiterals(sourceText, fileName) {
129
133
  return literals;
130
134
  }
131
135
 
136
+ /**
137
+ * First segments whose two-segment `servicio:*` is a wildcard grant: the
138
+ * catalog services and the namespaces of the old keys of PERMISSION_MIGRATION.
139
+ * Since 0.2.0-dev.4 no wildcard is an old key (all are quarantined), so an old
140
+ * service name such as `access-api` (of `access-api:*`) comes from the old
141
+ * keys of its namespace (`access-api:write`...).
142
+ */
143
+ export function wildcardNamespaces(catalog) {
144
+ const namespaces = new Set(catalog.services ?? []);
145
+ for (const old of catalog.oldKeys) {
146
+ const separator = old.indexOf(":");
147
+ const namespace = separator > 0 ? old.slice(0, separator).toLowerCase() : "";
148
+ if (NAMESPACE.test(namespace)) {
149
+ namespaces.add(namespace);
150
+ }
151
+ }
152
+ return namespaces;
153
+ }
154
+
132
155
  /**
133
156
  * Findings of the literals of the given source files. `catalog` supplies
134
157
  * `findUnknownPermissionKeys`, the old keys of PERMISSION_MIGRATION and the
@@ -136,7 +159,7 @@ export function collectStringLiterals(sourceText, fileName) {
136
159
  */
137
160
  export function scanFiles(files, catalog, { root = cwd() } = {}) {
138
161
  const oldKeys = new Set(catalog.oldKeys);
139
- const services = new Set(catalog.services ?? []);
162
+ const services = wildcardNamespaces(catalog);
140
163
  const findings = [];
141
164
  let allowed = 0;
142
165
  for (const file of files) {