@oak-digital/types-4-strapi-2 0.5.5 → 1.0.0-beta.1
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.
- package/.eslintrc.json +2 -1
- package/CHANGELOG.md +7 -0
- package/README.md +17 -5
- package/lib/attributes/Attributes.d.ts +4 -3
- package/lib/attributes/Attributes.js +102 -78
- package/lib/content-types/reader.js +49 -145
- package/lib/extra-types/ExtraType.d.ts +2 -2
- package/lib/extra-types/ExtraType.js +19 -38
- package/lib/extra-types/createExtraTypes.d.ts +1 -1
- package/lib/extra-types/createExtraTypes.js +11 -12
- package/lib/file/File.d.ts +1 -1
- package/lib/file/File.js +44 -43
- package/lib/index.js +57 -19
- package/lib/interface/BuiltinComponentInterface.js +9 -27
- package/lib/interface/BuiltinInterface.d.ts +0 -1
- package/lib/interface/BuiltinInterface.js +5 -26
- package/lib/interface/ComponentInterface.d.ts +2 -1
- package/lib/interface/ComponentInterface.js +30 -48
- package/lib/interface/Interface.d.ts +6 -2
- package/lib/interface/Interface.js +69 -70
- package/lib/interface/builtinInterfaces.d.ts +1941 -2
- package/lib/interface/builtinInterfaces.js +56 -46
- package/lib/plugins/PluginManager.d.ts +8 -2
- package/lib/plugins/PluginManager.js +28 -35
- package/lib/plugins/draft-and-publish/index.d.ts +1 -1
- package/lib/plugins/draft-and-publish/index.js +17 -21
- package/lib/plugins/i18n/index.d.ts +1 -1
- package/lib/plugins/i18n/index.js +17 -22
- package/lib/plugins/index.js +4 -4
- package/lib/plugins/types.d.ts +1 -1
- package/lib/plugins/types.js +1 -4
- package/lib/plugins/url-alias/index.js +12 -15
- package/lib/plugins/url-alias/type.js +21 -32
- package/lib/program/InterfaceManager.d.ts +374 -24
- package/lib/program/InterfaceManager.js +128 -376
- package/lib/readers/by-file.d.ts +321 -0
- package/lib/readers/by-file.js +116 -0
- package/lib/readers/load-strapi/index.d.ts +319 -0
- package/lib/readers/load-strapi/index.js +106 -0
- package/lib/readers/types/attributes.d.ts +1639 -0
- package/lib/readers/types/attributes.js +144 -0
- package/lib/readers/types/component.d.ts +723 -0
- package/lib/readers/types/component.js +11 -0
- package/lib/readers/types/content-type-reader.d.ts +16 -0
- package/lib/readers/types/content-type-reader.js +2 -0
- package/lib/readers/types/content-type.d.ts +766 -0
- package/lib/readers/types/content-type.js +16 -0
- package/lib/utils/casing/index.js +2 -2
- package/lib/utils/index.js +5 -39
- package/lib/writers/basic-writer.d.ts +24 -0
- package/lib/writers/basic-writer.js +75 -0
- package/lib/writers/types/writer.d.ts +4 -0
- package/lib/writers/types/writer.js +2 -0
- package/package.json +4 -2
- package/tests/strapi-project/.editorconfig +16 -0
- package/tests/strapi-project/.env.example +6 -0
- package/tests/strapi-project/README.md +57 -0
- package/tests/strapi-project/config/admin.ts +13 -0
- package/tests/strapi-project/config/api.ts +7 -0
- package/tests/strapi-project/config/database.ts +93 -0
- package/tests/strapi-project/config/middlewares.ts +12 -0
- package/tests/strapi-project/config/server.ts +10 -0
- package/tests/strapi-project/database/migrations/.gitkeep +0 -0
- package/tests/strapi-project/favicon.png +0 -0
- package/tests/strapi-project/package-lock.json +16125 -0
- package/tests/strapi-project/package.json +30 -0
- package/tests/strapi-project/public/robots.txt +3 -0
- package/tests/strapi-project/public/uploads/.gitkeep +0 -0
- package/tests/strapi-project/src/admin/app.example.tsx +35 -0
- package/tests/strapi-project/src/admin/webpack.config.example.js +9 -0
- package/tests/strapi-project/src/api/.gitkeep +0 -0
- package/tests/strapi-project/src/api/collection-1/content-types/collection-1/schema.json +18 -0
- package/tests/strapi-project/src/api/collection-1/content-types/generated-type/schema.json +18 -0
- package/tests/strapi-project/src/api/collection-1/controllers/collection-1.ts +7 -0
- package/tests/strapi-project/src/api/collection-1/controllers/generated-type.ts +7 -0
- package/tests/strapi-project/src/api/collection-1/routes/collection-1.ts +7 -0
- package/tests/strapi-project/src/api/collection-1/routes/generated-type.ts +7 -0
- package/tests/strapi-project/src/api/collection-1/services/collection-1.ts +7 -0
- package/tests/strapi-project/src/api/collection-1/services/generated-type.ts +7 -0
- package/tests/strapi-project/src/api/standalone-controller/controllers/standalone-controller.ts +13 -0
- package/tests/strapi-project/src/components/my-category/all-types.json +88 -0
- package/tests/strapi-project/src/components/other-category/sub-component.json +12 -0
- package/tests/strapi-project/src/extensions/.gitkeep +0 -0
- package/tests/strapi-project/src/index.ts +18 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.strapiContentType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const attributes_1 = require("./attributes");
|
|
6
|
+
exports.strapiContentType = zod_1.z.object({
|
|
7
|
+
attributes: zod_1.z.record(attributes_1.contentTypeAttribute),
|
|
8
|
+
collectionName: zod_1.z.string(),
|
|
9
|
+
options: zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
draftAndPublish: zod_1.z.boolean().optional().default(false),
|
|
12
|
+
})
|
|
13
|
+
.optional(),
|
|
14
|
+
pluginOptions: zod_1.z.record(zod_1.z.any()).optional(),
|
|
15
|
+
uid: zod_1.z.string().optional(),
|
|
16
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeCase = exports.checkCaseType = exports.caseTypesArray = void 0;
|
|
4
|
-
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
5
|
exports.caseTypesArray = [
|
|
6
6
|
'camel',
|
|
7
7
|
'capital',
|
|
@@ -16,7 +16,7 @@ function checkCaseType(caseName) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.checkCaseType = checkCaseType;
|
|
18
18
|
function changeCase(text, caseName) {
|
|
19
|
-
|
|
19
|
+
let name = text;
|
|
20
20
|
switch (caseName) {
|
|
21
21
|
case 'dot':
|
|
22
22
|
name = (0, change_case_1.dotCase)(name);
|
package/lib/utils/index.js
CHANGED
|
@@ -8,51 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.prefixDotSlash = exports.readDirFiltered = void 0;
|
|
40
|
-
|
|
13
|
+
const promises_1 = require("fs/promises");
|
|
41
14
|
function readDirFiltered(dir) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0: return [4 /*yield*/, (0, promises_1.readdir)(dir)];
|
|
47
|
-
case 1:
|
|
48
|
-
folders = _a.sent();
|
|
49
|
-
return [2 /*return*/, folders.filter(function (folder) { return !folder.startsWith('.'); })];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const folders = yield (0, promises_1.readdir)(dir);
|
|
17
|
+
return folders.filter((folder) => !folder.startsWith('.'));
|
|
52
18
|
});
|
|
53
19
|
}
|
|
54
20
|
exports.readDirFiltered = readDirFiltered;
|
|
55
21
|
function prefixDotSlash(path) {
|
|
56
|
-
return
|
|
22
|
+
return /^\.?\.\//.test(path) ? path : './' + path;
|
|
57
23
|
}
|
|
58
24
|
exports.prefixDotSlash = prefixDotSlash;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { File } from '../file/File';
|
|
2
|
+
import { InterfaceWriter } from './types/writer';
|
|
3
|
+
import prettier from 'prettier';
|
|
4
|
+
declare type BasicWriterOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Warning: this will delete all files in the output directory!
|
|
7
|
+
* @default false
|
|
8
|
+
* @type {boolean}
|
|
9
|
+
*/
|
|
10
|
+
deleteOld?: boolean;
|
|
11
|
+
prettierOptions?: prettier.Options;
|
|
12
|
+
indexFile?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare class BasicWriter implements InterfaceWriter {
|
|
15
|
+
protected OutRootPath: string;
|
|
16
|
+
private DeleteOld;
|
|
17
|
+
private PrettierOptions;
|
|
18
|
+
private IndexFile;
|
|
19
|
+
constructor(outRootPath: string, { deleteOld, indexFile, prettierOptions, }: BasicWriterOptions);
|
|
20
|
+
write(data: File[]): Promise<void>;
|
|
21
|
+
writeIndexFile(data: File[]): Promise<void>;
|
|
22
|
+
makeFolders(data: File[]): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BasicWriter = void 0;
|
|
16
|
+
const promises_1 = require("fs/promises");
|
|
17
|
+
const posix_1 = require("path/posix");
|
|
18
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
19
|
+
class BasicWriter {
|
|
20
|
+
constructor(outRootPath, { deleteOld = false, indexFile = true, prettierOptions = { parser: 'typescript' }, }) {
|
|
21
|
+
this.OutRootPath = outRootPath;
|
|
22
|
+
this.DeleteOld = deleteOld;
|
|
23
|
+
this.IndexFile = indexFile;
|
|
24
|
+
this.PrettierOptions = prettierOptions;
|
|
25
|
+
}
|
|
26
|
+
write(data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
if (this.DeleteOld) {
|
|
29
|
+
yield (0, promises_1.rm)(this.OutRootPath, { recursive: true, force: true });
|
|
30
|
+
}
|
|
31
|
+
// make folders
|
|
32
|
+
yield this.makeFolders(data);
|
|
33
|
+
// write files
|
|
34
|
+
const promises = data.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const fileData = file.toString();
|
|
36
|
+
const formattedFileData = prettier_1.default.format(fileData, this.PrettierOptions);
|
|
37
|
+
const filePath = (0, posix_1.join)(this.OutRootPath, file.getRelativeRootPathFile());
|
|
38
|
+
yield (0, promises_1.mkdir)((0, posix_1.dirname)(filePath), {
|
|
39
|
+
recursive: true,
|
|
40
|
+
});
|
|
41
|
+
yield (0, promises_1.writeFile)(filePath, formattedFileData);
|
|
42
|
+
}));
|
|
43
|
+
if (this.IndexFile) {
|
|
44
|
+
yield this.writeIndexFile(data);
|
|
45
|
+
}
|
|
46
|
+
yield Promise.all(promises);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
writeIndexFile(data) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const strings = data.map((inter) => {
|
|
52
|
+
return `export * from '${inter.getRelativeRootPath()}'`;
|
|
53
|
+
});
|
|
54
|
+
const fileData = strings.join('\n');
|
|
55
|
+
const formattedFileData = prettier_1.default.format(fileData, this.PrettierOptions);
|
|
56
|
+
const filePath = (0, posix_1.join)(this.OutRootPath, 'index.ts');
|
|
57
|
+
yield (0, promises_1.writeFile)(filePath, formattedFileData);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
makeFolders(data) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const folderPaths = new Set();
|
|
63
|
+
data.map((file) => {
|
|
64
|
+
const filePath = (0, posix_1.join)(this.OutRootPath, file.getRelativeRootPathFile());
|
|
65
|
+
const folderPath = (0, posix_1.dirname)(filePath);
|
|
66
|
+
folderPaths.add(folderPath);
|
|
67
|
+
});
|
|
68
|
+
const promises = Array.from(folderPaths).map((folderPath) => {
|
|
69
|
+
return (0, promises_1.mkdir)(folderPath, { recursive: true });
|
|
70
|
+
});
|
|
71
|
+
yield Promise.all(promises);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.BasicWriter = BasicWriter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oak-digital/types-4-strapi-2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "Typescript interface generator for Strapi 4 models",
|
|
5
5
|
"bin": {
|
|
6
6
|
"t4s": "./bin/index.js"
|
|
@@ -33,12 +33,14 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"change-case": "^4.1.2",
|
|
35
35
|
"commander": "^9.4.0",
|
|
36
|
-
"prettier": "^2.7.1"
|
|
36
|
+
"prettier": "^2.7.1",
|
|
37
|
+
"zod": "^3.21.4"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"build": "rimraf lib && tsc -p .",
|
|
40
41
|
"testtypes": "node ./bin/index.js",
|
|
41
42
|
"lint": "eslint src/",
|
|
43
|
+
"prettier": "prettier --write \"src/**/*.ts\"",
|
|
42
44
|
"t4s": "node ./bin/index.js"
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 2
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
charset = utf-8
|
|
8
|
+
trim_trailing_whitespace = true
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
|
|
11
|
+
[{package.json,*.yml}]
|
|
12
|
+
indent_style = space
|
|
13
|
+
indent_size = 2
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 🚀 Getting started with Strapi
|
|
2
|
+
|
|
3
|
+
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds.
|
|
4
|
+
|
|
5
|
+
### `develop`
|
|
6
|
+
|
|
7
|
+
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop)
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm run develop
|
|
11
|
+
# or
|
|
12
|
+
yarn develop
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### `start`
|
|
16
|
+
|
|
17
|
+
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start)
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm run start
|
|
21
|
+
# or
|
|
22
|
+
yarn start
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### `build`
|
|
26
|
+
|
|
27
|
+
Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build)
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npm run build
|
|
31
|
+
# or
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ⚙️ Deployment
|
|
36
|
+
|
|
37
|
+
Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html).
|
|
38
|
+
|
|
39
|
+
## 📚 Learn more
|
|
40
|
+
|
|
41
|
+
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
|
|
42
|
+
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
|
|
43
|
+
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
|
|
44
|
+
- [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community.
|
|
45
|
+
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
|
|
46
|
+
|
|
47
|
+
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
|
|
48
|
+
|
|
49
|
+
## ✨ Community
|
|
50
|
+
|
|
51
|
+
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
|
|
52
|
+
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
|
|
53
|
+
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
export default ({ env }) => {
|
|
4
|
+
const client = env('DATABASE_CLIENT', 'sqlite');
|
|
5
|
+
|
|
6
|
+
const connections = {
|
|
7
|
+
mysql: {
|
|
8
|
+
connection: {
|
|
9
|
+
connectionString: env('DATABASE_URL'),
|
|
10
|
+
host: env('DATABASE_HOST', 'localhost'),
|
|
11
|
+
port: env.int('DATABASE_PORT', 3306),
|
|
12
|
+
database: env('DATABASE_NAME', 'strapi'),
|
|
13
|
+
user: env('DATABASE_USERNAME', 'strapi'),
|
|
14
|
+
password: env('DATABASE_PASSWORD', 'strapi'),
|
|
15
|
+
ssl: env.bool('DATABASE_SSL', false) && {
|
|
16
|
+
key: env('DATABASE_SSL_KEY', undefined),
|
|
17
|
+
cert: env('DATABASE_SSL_CERT', undefined),
|
|
18
|
+
ca: env('DATABASE_SSL_CA', undefined),
|
|
19
|
+
capath: env('DATABASE_SSL_CAPATH', undefined),
|
|
20
|
+
cipher: env('DATABASE_SSL_CIPHER', undefined),
|
|
21
|
+
rejectUnauthorized: env.bool(
|
|
22
|
+
'DATABASE_SSL_REJECT_UNAUTHORIZED',
|
|
23
|
+
true
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
|
|
28
|
+
},
|
|
29
|
+
mysql2: {
|
|
30
|
+
connection: {
|
|
31
|
+
host: env('DATABASE_HOST', 'localhost'),
|
|
32
|
+
port: env.int('DATABASE_PORT', 3306),
|
|
33
|
+
database: env('DATABASE_NAME', 'strapi'),
|
|
34
|
+
user: env('DATABASE_USERNAME', 'strapi'),
|
|
35
|
+
password: env('DATABASE_PASSWORD', 'strapi'),
|
|
36
|
+
ssl: env.bool('DATABASE_SSL', false) && {
|
|
37
|
+
key: env('DATABASE_SSL_KEY', undefined),
|
|
38
|
+
cert: env('DATABASE_SSL_CERT', undefined),
|
|
39
|
+
ca: env('DATABASE_SSL_CA', undefined),
|
|
40
|
+
capath: env('DATABASE_SSL_CAPATH', undefined),
|
|
41
|
+
cipher: env('DATABASE_SSL_CIPHER', undefined),
|
|
42
|
+
rejectUnauthorized: env.bool(
|
|
43
|
+
'DATABASE_SSL_REJECT_UNAUTHORIZED',
|
|
44
|
+
true
|
|
45
|
+
),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
|
|
49
|
+
},
|
|
50
|
+
postgres: {
|
|
51
|
+
connection: {
|
|
52
|
+
connectionString: env('DATABASE_URL'),
|
|
53
|
+
host: env('DATABASE_HOST', 'localhost'),
|
|
54
|
+
port: env.int('DATABASE_PORT', 5432),
|
|
55
|
+
database: env('DATABASE_NAME', 'strapi'),
|
|
56
|
+
user: env('DATABASE_USERNAME', 'strapi'),
|
|
57
|
+
password: env('DATABASE_PASSWORD', 'strapi'),
|
|
58
|
+
ssl: env.bool('DATABASE_SSL', false) && {
|
|
59
|
+
key: env('DATABASE_SSL_KEY', undefined),
|
|
60
|
+
cert: env('DATABASE_SSL_CERT', undefined),
|
|
61
|
+
ca: env('DATABASE_SSL_CA', undefined),
|
|
62
|
+
capath: env('DATABASE_SSL_CAPATH', undefined),
|
|
63
|
+
cipher: env('DATABASE_SSL_CIPHER', undefined),
|
|
64
|
+
rejectUnauthorized: env.bool(
|
|
65
|
+
'DATABASE_SSL_REJECT_UNAUTHORIZED',
|
|
66
|
+
true
|
|
67
|
+
),
|
|
68
|
+
},
|
|
69
|
+
schema: env('DATABASE_SCHEMA', 'public'),
|
|
70
|
+
},
|
|
71
|
+
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
|
|
72
|
+
},
|
|
73
|
+
sqlite: {
|
|
74
|
+
connection: {
|
|
75
|
+
filename: path.join(
|
|
76
|
+
__dirname,
|
|
77
|
+
'..',
|
|
78
|
+
'..',
|
|
79
|
+
env('DATABASE_FILENAME', 'data.db')
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
useNullAsDefault: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
connection: {
|
|
88
|
+
client,
|
|
89
|
+
...connections[client],
|
|
90
|
+
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|
|
File without changes
|
|
Binary file
|