@ya-accelerators/web-backend-framework 0.0.120 → 0.0.122

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The declaration of the package rooted at `directory`. A package that declares none takes the
3
+ * framework's lists alone; a manifest that is present and unreadable throws, since degrading there would
4
+ * take that package's redaction off without saying so.
5
+ */
6
+ export declare const readSanitizeDeclaration: (directory: string) => import("./sanitize-declaration.ts").SanitizeDeclaration;
7
+ export declare const readRunningPackageSanitizeDeclaration: () => import("./sanitize-declaration.ts").SanitizeDeclaration;
@@ -0,0 +1,34 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { emptySanitizeDeclaration, parseSanitizeDeclaration, SANITIZE_DECLARATION_FIELD, } from './sanitize-declaration.js';
4
+ const readManifest = (source) => {
5
+ let contents;
6
+ try {
7
+ contents = fs.readFileSync(source, 'utf8');
8
+ }
9
+ catch (e) {
10
+ if (e.code === 'ENOENT') {
11
+ return undefined;
12
+ }
13
+ throw e;
14
+ }
15
+ let manifest;
16
+ try {
17
+ manifest = JSON.parse(contents);
18
+ }
19
+ catch (e) {
20
+ throw new Error(`${source} is not valid JSON: ${e.message}`);
21
+ }
22
+ if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest)) {
23
+ throw new Error(`${source} is not an object`);
24
+ }
25
+ return parseSanitizeDeclaration(manifest[SANITIZE_DECLARATION_FIELD], `${source} "${SANITIZE_DECLARATION_FIELD}"`);
26
+ };
27
+ /**
28
+ * The declaration of the package rooted at `directory`. A package that declares none takes the
29
+ * framework's lists alone; a manifest that is present and unreadable throws, since degrading there would
30
+ * take that package's redaction off without saying so.
31
+ */
32
+ export const readSanitizeDeclaration = (directory) => readManifest(path.join(path.resolve(directory), 'package.json')) ?? emptySanitizeDeclaration();
33
+ export const readRunningPackageSanitizeDeclaration = () => readSanitizeDeclaration(process.cwd());
34
+ //# sourceMappingURL=sanitize-declaration-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-declaration-file.js","sourceRoot":"","sources":["../../../src/.generated/policy/sanitize-declaration-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAA;AAElC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE;IACtC,IAAI,QAAgB,CAAA;IACpB,IAAI,CAAC;QACH,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAK,CAA2B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnD,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,CAAC,CAAA;IACT,CAAC;IACD,IAAI,QAAiB,CAAA;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,uBAAwB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAA;IACzE,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,mBAAmB,CAAC,CAAA;IAC/C,CAAC;IACD,OAAO,wBAAwB,CAC5B,QAAoC,CAAC,0BAA0B,CAAC,EACjE,GAAG,MAAM,KAAK,0BAA0B,GAAG,CAC5C,CAAA;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAE,EAAE,CAC3D,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,wBAAwB,EAAE,CAAA;AAEhG,MAAM,CAAC,MAAM,qCAAqC,GAAG,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA"}
@@ -3,12 +3,5 @@ export type SanitizeDeclaration = {
3
3
  keywords: string[];
4
4
  exactKeys: string[];
5
5
  };
6
- /**
7
- * The declaration of the package rooted at `directory`. A package that declares none takes the
8
- * framework's lists alone; a manifest that is present and unreadable throws, since degrading there would
9
- * take that package's redaction off without saying so.
10
- */
11
- export declare const readSanitizeDeclaration: (directory: string) => {
12
- keywords: string[];
13
- exactKeys: string[];
14
- };
6
+ export declare const emptySanitizeDeclaration: () => SanitizeDeclaration;
7
+ export declare const parseSanitizeDeclaration: (declared: unknown, source: string) => SanitizeDeclaration;
@@ -1,17 +1,20 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
1
  // A package adds the log keys its own domain needs redacted, as the `sanitizeKeys` field of its own
4
- // `package.json`. `Util.sanitize` and the sanitize-coverage gate both read it through this module, so a
5
- // declaration one accepted and the other refused cannot make the set the gate judges differ from the set
6
- // in force.
2
+ // `package.json`. `Util.sanitize` and the sanitize-coverage gate both read it through this module and
3
+ // `sanitize-declaration-file.ts` beside it, so a declaration one accepted and the other refused cannot
4
+ // make the set the gate judges differ from the set in force.
7
5
  //
8
6
  // It is additive: the framework's own lists decide what is redacted everywhere, and a package only adds
9
7
  // to them for itself. It lives in `package.json` because the release image copies that file for every
10
8
  // package it carries.
9
+ //
10
+ // This module is copied into `nextjs-framework`, whose `Util.sanitize` is reachable from Next's client
11
+ // bundle, so it imports no Node built-in. Reading a manifest is `sanitize-declaration-file.ts`, which no
12
+ // client bundle reaches.
11
13
  export const SANITIZE_DECLARATION_FIELD = 'sanitizeKeys';
12
- const parseSanitizeDeclaration = (declared, source) => {
14
+ export const emptySanitizeDeclaration = () => ({ keywords: [], exactKeys: [] });
15
+ export const parseSanitizeDeclaration = (declared, source) => {
13
16
  if (declared === undefined) {
14
- return { keywords: [], exactKeys: [] };
17
+ return emptySanitizeDeclaration();
15
18
  }
16
19
  if (typeof declared !== 'object' || declared === null || Array.isArray(declared)) {
17
20
  throw new Error(`${source} must be an object carrying "keywords" and / or "exactKeys"`);
@@ -38,33 +41,4 @@ const parseSanitizeDeclaration = (declared, source) => {
38
41
  }
39
42
  return declaration;
40
43
  };
41
- const readManifest = (source) => {
42
- let contents;
43
- try {
44
- contents = fs.readFileSync(source, 'utf8');
45
- }
46
- catch (e) {
47
- if (e.code === 'ENOENT') {
48
- return undefined;
49
- }
50
- throw e;
51
- }
52
- let manifest;
53
- try {
54
- manifest = JSON.parse(contents);
55
- }
56
- catch (e) {
57
- throw new Error(`${source} is not valid JSON: ${e.message}`);
58
- }
59
- if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest)) {
60
- throw new Error(`${source} is not an object`);
61
- }
62
- return parseSanitizeDeclaration(manifest[SANITIZE_DECLARATION_FIELD], `${source} "${SANITIZE_DECLARATION_FIELD}"`);
63
- };
64
- /**
65
- * The declaration of the package rooted at `directory`. A package that declares none takes the
66
- * framework's lists alone; a manifest that is present and unreadable throws, since degrading there would
67
- * take that package's redaction off without saying so.
68
- */
69
- export const readSanitizeDeclaration = (directory) => readManifest(path.join(path.resolve(directory), 'package.json')) ?? { keywords: [], exactKeys: [] };
70
44
  //# sourceMappingURL=sanitize-declaration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize-declaration.js","sourceRoot":"","sources":["../../../src/.generated/policy/sanitize-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,oGAAoG;AACpG,wGAAwG;AACxG,yGAAyG;AACzG,YAAY;AACZ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export declare const consumerSanitizeKeys: {
2
- keywords: string[];
3
- exactKeys: string[];
4
- };
1
+ export declare const consumerSanitizeKeys: import("./.generated/policy/sanitize-declaration.ts").SanitizeDeclaration;
@@ -1,5 +1,5 @@
1
- import { readSanitizeDeclaration } from './.generated/policy/sanitize-declaration.js';
1
+ import { readRunningPackageSanitizeDeclaration } from './.generated/policy/sanitize-declaration-file.js';
2
2
  // The running package's own additions, read from its `package.json` at module load. Nothing registers
3
3
  // them, so no entry point of that package can start without them.
4
- export const consumerSanitizeKeys = readSanitizeDeclaration(process.cwd());
4
+ export const consumerSanitizeKeys = readRunningPackageSanitizeDeclaration();
5
5
  //# sourceMappingURL=sanitize-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize-keys.js","sourceRoot":"","sources":["../src/sanitize-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAErF,sGAAsG;AACtG,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"sanitize-keys.js","sourceRoot":"","sources":["../src/sanitize-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,kDAAkD,CAAA;AAExG,sGAAsG;AACtG,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,qCAAqC,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ya-accelerators/web-backend-framework",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "packageRole": "library",
5
5
  "type": "module",
6
6
  "description": "",
@@ -41,8 +41,8 @@
41
41
  ],
42
42
  "scripts": {
43
43
  "setup": "pnpm run build",
44
- "build": "node ../../bin/copy-policy.mts src/.generated/policy && tsc",
45
- "dev": "node ../../bin/copy-policy.mts src/.generated/policy && tsc --watch --preserveWatchOutput",
44
+ "build": "node ../../../bin/copy-policy.mts src/.generated/policy && tsc",
45
+ "dev": "node ../../../bin/copy-policy.mts src/.generated/policy && tsc --watch --preserveWatchOutput",
46
46
  "lint": "run-p -l -c lint:*",
47
47
  "lint:tsc": "tsc --pretty --noEmit --incremental false",
48
48
  "lint:biome": "biome check .",
@@ -52,7 +52,7 @@
52
52
  "test:integration": "jest --testPathPatterns=integration"
53
53
  },
54
54
  "dependencies": {
55
- "@aws-sdk/client-s3": "^3.1118.0",
55
+ "@aws-sdk/client-s3": "^3.1120.0",
56
56
  "@aws-sdk/credential-provider-node": "^3.972.81",
57
57
  "@prisma/adapter-mariadb": "^7.10.0",
58
58
  "@prisma/extension-read-replicas": "^0.5.0",