pwi-plata-type 0.4.61 → 0.4.62
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/__BUILD__/bin/runtime/fs.js +9 -0
- package/__BUILD__/bin/runtime/fs.js.map +1 -0
- package/__BUILD__/index.js +3 -1
- package/__BUILD__/index.js.map +1 -1
- package/package.json +1 -1
- package/src/@types/cluster.d.ts +2 -0
- package/src/@types/exported.d.ts +3 -0
- package/src/@types/fs.d.ts +7 -0
- package/src/@types/global.d.ts +65 -69
- package/src/bin/runtime/_types.d.ts +2 -1
- package/src/bin/runtime/fs.ts +11 -0
- package/src/index.ts +2 -0
- package/templates/postinstall/lib/postinstall.js +3 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlataRuntimeE = void 0;
|
|
4
|
+
const fs_1 = require("../../libs/fs");
|
|
5
|
+
var PlataRuntimeE;
|
|
6
|
+
(function (PlataRuntimeE) {
|
|
7
|
+
PlataRuntimeE.files = fs_1.PlataFs;
|
|
8
|
+
})(PlataRuntimeE = exports.PlataRuntimeE || (exports.PlataRuntimeE = {}));
|
|
9
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/bin/runtime/fs.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AAQvC,IAAiB,aAAa,CAE7B;AAFD,WAAiB,aAAa;IACb,mBAAK,GAAG,YAAO,CAAA;AAChC,CAAC,EAFgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAE7B"}
|
package/__BUILD__/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.PlataAxiosUnsafe = exports.PlataAxios = exports.PlataTasks = exports.PlataSwagger = exports.PlataModels = exports.PlataTools = exports.PlataRoutes = exports.PlataCluster = void 0;
|
|
26
|
+
exports.PlataFs = exports.PlataAxiosUnsafe = exports.PlataAxios = exports.PlataTasks = exports.PlataSwagger = exports.PlataModels = exports.PlataTools = exports.PlataRoutes = exports.PlataCluster = void 0;
|
|
27
27
|
const PlataCluster = __importStar(require("./libs/cluster"));
|
|
28
28
|
exports.PlataCluster = PlataCluster;
|
|
29
29
|
const PlataRoutes = __importStar(require("./libs/router"));
|
|
@@ -36,6 +36,8 @@ const PlataTasks = __importStar(require("./libs/tasks"));
|
|
|
36
36
|
exports.PlataTasks = PlataTasks;
|
|
37
37
|
const PlataSwagger = __importStar(require("./libs/swagger"));
|
|
38
38
|
exports.PlataSwagger = PlataSwagger;
|
|
39
|
+
const fs_1 = require("./libs/fs");
|
|
40
|
+
Object.defineProperty(exports, "PlataFs", { enumerable: true, get: function () { return fs_1.PlataFs; } });
|
|
39
41
|
const axios_1 = require("./libs/axios");
|
|
40
42
|
Object.defineProperty(exports, "PlataAxios", { enumerable: true, get: function () { return axios_1.PlataAxios; } });
|
|
41
43
|
Object.defineProperty(exports, "PlataAxiosUnsafe", { enumerable: true, get: function () { return axios_1.PlataAxiosUnsafe; } });
|
package/__BUILD__/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAU1C,oCAAY;AAThB,2DAA4C;AAUxC,kCAAW;AATf,yDAA0C;AAUtC,gCAAU;AATd,0DAA2C;AAUvC,kCAAW;AATf,yDAA0C;AAWtC,gCAAU;AAVd,6DAA8C;AAS1C,oCAAY;AARhB,kCAAmC;AAY/B,wFAZK,YAAO,OAYL;AAXX,wCAA2D;AASvD,2FATK,kBAAU,OASL;AACV,iGAViB,wBAAgB,OAUjB"}
|
package/package.json
CHANGED
package/src/@types/cluster.d.ts
CHANGED
package/src/@types/exported.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference path="model.d.ts" />
|
|
3
3
|
/// <reference path="cluster.d.ts" />
|
|
4
4
|
/// <reference path="router.d.ts" />
|
|
5
|
+
/// <reference path="fs.d.ts" />
|
|
5
6
|
/// <reference path="../bin/runtime/_types.d.ts" />
|
|
6
7
|
|
|
7
8
|
import * as PlataCluster from '../libs/cluster'
|
|
@@ -10,6 +11,7 @@ import * as PlataTools from '../libs/tools'
|
|
|
10
11
|
import * as PlataModels from '../libs/model'
|
|
11
12
|
import * as PlataTasks from '../libs/tasks'
|
|
12
13
|
import * as PlataSwagger from '../libs/swagger'
|
|
14
|
+
import { PlataFs } from '../libs/fs'
|
|
13
15
|
import { PlataAxios, PlataAxiosUnsafe } from '../libs/axios'
|
|
14
16
|
|
|
15
17
|
export {
|
|
@@ -21,4 +23,5 @@ export {
|
|
|
21
23
|
PlataTasks,
|
|
22
24
|
PlataAxios,
|
|
23
25
|
PlataAxiosUnsafe,
|
|
26
|
+
PlataFs
|
|
24
27
|
}
|
package/src/@types/global.d.ts
CHANGED
|
@@ -1,73 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports: T
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type RequireAsyncReturn<T> = PlataPromise<RequiredInterface<T>>
|
|
10
|
-
type RequireFolderReturn<T> = PlataPromise<RequiredInterface<T>[]>
|
|
11
|
-
type RequiredFolder<T> = Awaited<RequireFolderReturn<T>>
|
|
12
|
-
|
|
13
|
-
type AnyRecord<T> = {
|
|
14
|
-
[P in string]: T;
|
|
15
|
-
}
|
|
16
|
-
type LooseAutocomplete<T extends string> = T | Omit<string, T>
|
|
17
|
-
|
|
18
|
-
type Replace<T, O, U> = T extends O ? Exclude<T, O> | U : T
|
|
19
|
-
|
|
20
|
-
type PlataEnv = LooseAutocomplete<"prod" | "homolog" | "debug">
|
|
21
|
-
|
|
22
|
-
interface PlataEnvConfig {
|
|
23
|
-
env: PlataEnv
|
|
24
|
-
}
|
|
1
|
+
interface RequiredInterface<T> {
|
|
2
|
+
filePath: string,
|
|
3
|
+
name: string,
|
|
4
|
+
exports: T
|
|
5
|
+
}
|
|
25
6
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_PLATA_API_SSL_KEY?: string
|
|
41
|
-
_PLATA_API_SSL_CERT?: string
|
|
42
|
-
_PLATA_API_SSL_PASS?: string
|
|
43
|
-
_PLATA_API_JSON_SIZE?: string
|
|
44
|
-
_PLATA_WORKER_NAME?: string
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const Plata: Plata
|
|
49
|
-
|
|
50
|
-
interface EnvConfig {
|
|
51
|
-
env: PlataEnv
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface PlataError {
|
|
55
|
-
errorID: string
|
|
56
|
-
msg: string,
|
|
57
|
-
error?: any
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type MaybePlataError = null | PlataError
|
|
61
|
-
|
|
62
|
-
type PlataResult<T> = (T & { errorID?: undefined }) | PlataError
|
|
63
|
-
|
|
64
|
-
type PlataPromise<T> = Promise<PlataResult<T>>
|
|
65
|
-
|
|
66
|
-
type Dictionary<T> = {
|
|
67
|
-
[key: string]: T
|
|
68
|
-
}
|
|
7
|
+
type RequireAsyncReturn<T> = PlataPromise<RequiredInterface<T>>
|
|
8
|
+
type RequireFolderReturn<T> = PlataPromise<RequiredInterface<T>[]>
|
|
9
|
+
type RequiredFolder<T> = Awaited<RequireFolderReturn<T>>
|
|
10
|
+
|
|
11
|
+
type AnyRecord<T> = {
|
|
12
|
+
[P in string]: T;
|
|
13
|
+
}
|
|
14
|
+
type LooseAutocomplete<T extends string> = T | Omit<string, T>
|
|
15
|
+
|
|
16
|
+
type Replace<T, O, U> = T extends O ? Exclude<T, O> | U : T
|
|
17
|
+
|
|
18
|
+
type PlataEnv = LooseAutocomplete<"prod" | "homolog" | "debug">
|
|
19
|
+
|
|
20
|
+
type PlataFunctionWrapperReturn<F extends (...a: any) => any, T> = (...a: Parameters<F>) => T
|
|
69
21
|
|
|
70
|
-
|
|
71
|
-
|
|
22
|
+
interface PlataRuntime {}
|
|
23
|
+
|
|
24
|
+
interface Plata extends PlataRuntime {
|
|
25
|
+
cluster: {
|
|
26
|
+
isPrimary: true,
|
|
27
|
+
clusters: Cluster.ClusterConfig[]
|
|
28
|
+
} | { isPrimary: false, clusters?: undefined }
|
|
29
|
+
config: NodeJS.ProcessEnv & {
|
|
30
|
+
ENV?: PlataEnv
|
|
31
|
+
PORT?: string
|
|
32
|
+
_PLATA_API_ROOT?: string
|
|
33
|
+
_PLATA_API_SSL_KEY?: string
|
|
34
|
+
_PLATA_API_SSL_CERT?: string
|
|
35
|
+
_PLATA_API_SSL_PASS?: string
|
|
36
|
+
_PLATA_API_JSON_SIZE?: string
|
|
37
|
+
_PLATA_WORKER_NAME?: string
|
|
72
38
|
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const Plata: Plata
|
|
42
|
+
|
|
43
|
+
interface EnvConfig {
|
|
44
|
+
env: PlataEnv
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PlataError {
|
|
48
|
+
errorID: string
|
|
49
|
+
msg: string,
|
|
50
|
+
error?: any
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type MaybePlataError = null | PlataError
|
|
54
|
+
|
|
55
|
+
type PlataResult<T> = (T & { errorID?: undefined }) | PlataError
|
|
56
|
+
|
|
57
|
+
type PlataPromise<T> = Promise<PlataResult<T>>
|
|
58
|
+
|
|
59
|
+
type Dictionary<T> = {
|
|
60
|
+
[key: string]: T
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface PlataEnvConfig {
|
|
64
|
+
env: PlataEnv
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type DeepWritable<T extends {}> = {
|
|
68
|
+
-readonly [K in keyof T]: T[K] extends Dictionary<any> ? DeepWritable<T[K]> : T[K]
|
|
73
69
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as PlataTools from './libs/tools'
|
|
|
4
4
|
import * as PlataModels from './libs/model'
|
|
5
5
|
import * as PlataTasks from './libs/tasks'
|
|
6
6
|
import * as PlataSwagger from './libs/swagger'
|
|
7
|
+
import { PlataFs } from './libs/fs'
|
|
7
8
|
import { PlataAxios, PlataAxiosUnsafe } from './libs/axios'
|
|
8
9
|
|
|
9
10
|
export {
|
|
@@ -15,4 +16,5 @@ export {
|
|
|
15
16
|
PlataTasks,
|
|
16
17
|
PlataAxios,
|
|
17
18
|
PlataAxiosUnsafe,
|
|
19
|
+
PlataFs
|
|
18
20
|
}
|
|
@@ -4,6 +4,9 @@ import { tools } from './postinstall-tools.mjs'
|
|
|
4
4
|
|
|
5
5
|
const main = async() => {
|
|
6
6
|
const plataDir = path.resolve('.')
|
|
7
|
+
|
|
8
|
+
if (path.basename(path.dirname(plataDir)) !== 'node_modules') return
|
|
9
|
+
|
|
7
10
|
const projectDir = path.resolve(plataDir, '..', '..')
|
|
8
11
|
const projectPackageJson = JSON.parse(fs.readFileSync(path.join(projectDir, 'package.json')).toString())
|
|
9
12
|
|