@carbonorm/carbonreact 3.2.5 → 3.2.7

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 (2) hide show
  1. package/compileValidSQL.tsx +85 -0
  2. package/package.json +10 -4
@@ -0,0 +1,85 @@
1
+
2
+ interface iApiResponseLine {
3
+ "method": "GET" | "PUT" | "POST" | "DELETE",
4
+ "table": string,
5
+ "CarbonPHP\\Restful\\RestSettings::$externalRestfulRequestsAPI": boolean,
6
+ "argv": [
7
+ any[],
8
+ any,
9
+ any
10
+ ],
11
+ "stmt": [
12
+ string, // sql
13
+ {
14
+ [key: string]: string,
15
+ }
16
+ ]
17
+ }
18
+
19
+
20
+ const util = require('util');
21
+
22
+ const exec = util.promisify(require('child_process').exec);
23
+
24
+ const fs = require('fs');
25
+
26
+ const path = require("path");
27
+
28
+ (async () => {
29
+
30
+ const theDirectory = './logs/rest/'; // or whatever directory you want to read
31
+
32
+ let all: any[] = [],
33
+ validExternalRequests: iApiResponseLine[] = [];
34
+
35
+
36
+ const ManifestFile = 'validSQL.json';
37
+
38
+ fs.readdirSync(theDirectory).forEach((file) => {
39
+
40
+ if (file === ManifestFile) {
41
+
42
+ return;
43
+
44
+ }
45
+
46
+ const resource = require(`${theDirectory}/${file}`);
47
+
48
+ all.push(resource);
49
+
50
+ });
51
+
52
+ all.forEach(apiRequest => {
53
+
54
+ Object.keys(apiRequest).forEach(testName => {
55
+
56
+ Object.keys(apiRequest[testName]).forEach(mysqlRestCall => {
57
+
58
+ apiRequest[testName][mysqlRestCall].forEach(singleSqlInfoObject => {
59
+
60
+ if (true === singleSqlInfoObject['CarbonPHP\\Restful\\RestSettings::$externalRestfulRequestsAPI']) {
61
+
62
+ validExternalRequests.push(singleSqlInfoObject)
63
+
64
+ }
65
+
66
+ })
67
+
68
+ })
69
+
70
+ });
71
+
72
+ });
73
+
74
+
75
+ // @link https://stackoverflow.com/questions/12941083/execute-and-get-the-output-of-a-shell-command-in-node-js
76
+ const {stdout} = await exec('git rev-parse HEAD')
77
+
78
+ const revision = stdout.trim();
79
+
80
+ fs.writeFileSync(theDirectory + ManifestFile, JSON.stringify({
81
+ "revision": revision,
82
+ "valid": validExternalRequests
83
+ }, undefined, 4));
84
+
85
+ })()
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
- "version": "3.2.5",
3
+ "version": "3.2.7",
4
4
  "browser": "dist/index.umd.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "main": "dist/index.cjs.js",
7
7
  "types": "dist/index.d.ts",
8
- "type": "module",
9
8
  "dependencies": {
10
9
  "@carbonorm/carbonnode": "^1.1.0",
11
10
  "@fortawesome/fontawesome-svg-core": "^6.4.0",
@@ -33,6 +32,8 @@
33
32
  "@rollup/plugin-commonjs": "^11.0.1",
34
33
  "@rollup/plugin-node-resolve": "^7.0.0",
35
34
  "@rollup/plugin-typescript": "^11.1.2",
35
+ "@testing-library/react": "^14.0.0",
36
+ "@types/jest": "^29.5.4",
36
37
  "@types/ms": "^0.7.31",
37
38
  "@types/node": "^18.17.14",
38
39
  "@types/react": "^18.0.32",
@@ -43,6 +44,8 @@
43
44
  "classnames": "^2.3.2",
44
45
  "css-loader": "^6.8.1",
45
46
  "deepmerge": "^4.3.1",
47
+ "jest": "^29.5.0",
48
+ "jest-config": "^29.5.0",
46
49
  "livereload": "^0.9.3",
47
50
  "postcss": "^8.4.27",
48
51
  "postcss-nested": "^6.0.1",
@@ -56,7 +59,8 @@
56
59
  "rollup-watch": "^4.3.1",
57
60
  "sass": "^1.64.1",
58
61
  "scss": "^0.2.4",
59
- "typescript": "^5.1.6"
62
+ "typescript": "^5.1.6",
63
+ "ts-node": "^10.9.1"
60
64
  },
61
65
  "scripts": {
62
66
  "c6": "wget https://raw.githubusercontent.com/RichardTMiles/CarbonPHP/lts/view/C6.tsx -O src/variables/C6.tsx",
@@ -65,9 +69,11 @@
65
69
  "test": "node test/test.js",
66
70
  "pretest": "npm run build",
67
71
  "build:index": "npx barrelsby --directory ./src --delete --exclude '(jestHoc|\\.test|\\.d).(js|tsx?)$' --exportDefault --verbose --mode top",
68
- "build:css": "sass ./src:./src && typed-scss-modules 'src/**/*.?(s)css' --nameFormat all --exportType default src"
72
+ "build:css": "sass ./src:./src && typed-scss-modules 'src/**/*.?(s)css' --nameFormat all --exportType default src",
73
+ "build:compileValidSQL": "ts-node --experimental-specifier-resolution=node compileValidSQL.tsx"
69
74
  },
70
75
  "files": [
76
+ "compileValidSQL.tsx",
71
77
  "dist",
72
78
  "src"
73
79
  ]