pwi-plata-type 0.4.166 → 0.4.167
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/README.md +2 -2
- package/__BUILD__/libs/sql.js +4 -1
- package/__BUILD__/libs/sql.js.map +1 -1
- package/package.json +53 -53
- package/src/@types/build.d.ts +26 -26
- package/src/@types/cluster.actions.d.ts +27 -27
- package/src/@types/cluster.d.ts +55 -55
- package/src/@types/create-cli.d.ts +8 -8
- package/src/@types/exported.d.ts +31 -31
- package/src/@types/fs.d.ts +6 -6
- package/src/@types/global.d.ts +113 -113
- package/src/@types/knex.d.ts +13 -13
- package/src/@types/model.d.ts +143 -143
- package/src/@types/router.d.ts +107 -107
- package/src/@types/sql.d.ts +75 -75
- package/src/@types/swagger.d.ts +22 -22
- package/src/bin/extras/create-api-cli.ts +218 -218
- package/src/bin/extras/create-cluster-cli.ts +160 -160
- package/src/bin/extras/create-lib-cli.ts +84 -84
- package/src/bin/extras/plata-create-tools.ts +97 -97
- package/src/bin/plata-api.ts +189 -189
- package/src/bin/plata-build.ts +17 -17
- package/src/bin/plata-cluster.ts +42 -42
- package/src/bin/plata-cmd.ts +18 -18
- package/src/bin/plata-create.ts +49 -49
- package/src/bin/plata-runtime.ts +131 -131
- package/src/bin/plata-swagger.ts +99 -99
- package/src/bin/runtime/_setupRuntime.ts +48 -48
- package/src/bin/runtime/_types.d.ts +7 -7
- package/src/bin/runtime/class.ts +20 -20
- package/src/bin/runtime/dirs.ts +25 -25
- package/src/bin/runtime/effect.ts +60 -60
- package/src/bin/runtime/fs.ts +10 -10
- package/src/bin/runtime/promises.ts +18 -18
- package/src/bin/runtime/require.ts +113 -113
- package/src/bin/runtime/sql.ts +12 -12
- package/src/bin/runtime/switch.ts +60 -60
- package/src/index.ts +19 -19
- package/src/libs/axios.ts +51 -51
- package/src/libs/build.ts +162 -162
- package/src/libs/cluster/cluster-controller.ts +93 -93
- package/src/libs/cluster.ts +330 -330
- package/src/libs/custom.ts +15 -15
- package/src/libs/env.ts +10 -10
- package/src/libs/fs.ts +399 -399
- package/src/libs/hot-reload.ts +63 -63
- package/src/libs/models/index.ts +4 -4
- package/src/libs/models/model-template-combine.ts +93 -93
- package/src/libs/models/model-template-env.ts +58 -58
- package/src/libs/models/model-template-union.ts +83 -83
- package/src/libs/models/model-template.ts +107 -107
- package/src/libs/models/model-validations.ts +443 -443
- package/src/libs/models/tools.ts +194 -194
- package/src/libs/router.ts +185 -185
- package/src/libs/sql.ts +792 -788
- package/src/libs/swagger.ts +81 -81
- package/src/libs/tools.ts +240 -240
- package/src/scripts/post-install/api.ts +32 -32
- package/src/scripts/post-install/cluster.ts +28 -28
- package/src/scripts/post-install/lib.ts +25 -25
- package/src/scripts/post-install.ts +64 -64
- package/src/scripts/pre-test.ts +33 -33
- package/src/tests/assets/sql/example.sql +76 -76
- package/src/tests/config.test.ts +12 -12
- package/src/tests/effect.test.ts +62 -62
- package/src/tests/model.env.test.ts +66 -66
- package/src/tests/model.test.ts +141 -141
- package/src/tests/model.union.test.ts +160 -160
- package/src/tests/router.test.ts +44 -44
- package/src/tests/sql.test.ts +502 -502
- package/src/tests/switch.test.ts +76 -76
- package/templates/create-cli/class.ts +13 -13
- package/templates/create-cli/cluster.ts +14 -14
- package/templates/create-cli/cmd.ts +3 -3
- package/templates/create-cli/config.ts +2 -2
- package/templates/create-cli/lib.ts +3 -3
- package/templates/create-cli/model.ts +14 -14
- package/templates/create-cli/route.ts +8 -8
- package/templates/create-cli/task.ts +13 -13
- package/templates/postinstall/api/.vscode/launch.json +20 -20
- package/templates/postinstall/api/Dockerfile +24 -24
- package/templates/postinstall/api/configs/env.ts +2 -2
- package/templates/postinstall/api/envs/debug.env +15 -15
- package/templates/postinstall/api/envs/homolog.env +15 -15
- package/templates/postinstall/api/envs/prod.env +15 -15
- package/templates/postinstall/api/tsconfig.json +24 -24
- package/templates/postinstall/cluster/.vscode/launch.json +20 -20
- package/templates/postinstall/cluster/Dockerfile +24 -24
- package/templates/postinstall/cluster/configs/env.ts +2 -2
- package/templates/postinstall/cluster/envs/debug.env +10 -10
- package/templates/postinstall/cluster/envs/homolog.env +10 -10
- package/templates/postinstall/cluster/envs/prod.env +10 -10
- package/templates/postinstall/cluster/tsconfig.json +24 -24
- package/templates/postinstall/lib/postinstall-tools.mjs +111 -111
- package/templates/postinstall/lib/postinstall.js +33 -33
- package/templates/postinstall/lib/tsconfig.json +22 -22
- package/templates/swagger-cli/header.json +21 -21
- package/templates/swagger-cli/route/body.json +14 -14
- package/templates/swagger-cli/route/header.json +18 -18
- package/templates/swagger-cli/route/response.json +53 -53
- package/tsconfig.json +28 -28
package/src/tests/switch.test.ts
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { describe, it, before } from "node:test"
|
|
2
|
-
import assert from "node:assert"
|
|
3
|
-
import { PlataModels } from ".."
|
|
4
|
-
import { loadRuntimeLibs } from "../bin/runtime/_setupRuntime"
|
|
5
|
-
|
|
6
|
-
describe('Plata Switch', () => {
|
|
7
|
-
const plataPromise = (async () => {
|
|
8
|
-
const g = global as any
|
|
9
|
-
|
|
10
|
-
g.Plata = await loadRuntimeLibs()
|
|
11
|
-
})()
|
|
12
|
-
|
|
13
|
-
type TestUnion = 'Valor1' | 'Valor2'
|
|
14
|
-
|
|
15
|
-
type TestUnionObject = {
|
|
16
|
-
tipo: 'Tipo1'
|
|
17
|
-
valor: number
|
|
18
|
-
} | {
|
|
19
|
-
tipo: 'Tipo2'
|
|
20
|
-
valor: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
before(async () => {
|
|
24
|
-
await plataPromise
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('switch union (okay)', async () => {
|
|
28
|
-
|
|
29
|
-
const union = Math.ceil(Math.random() * 100) % 2 === 0 ? 'Valor1' : 'Valor2'
|
|
30
|
-
|
|
31
|
-
const result = await Plata.switchUnion(union, {
|
|
32
|
-
_default: async () => false,
|
|
33
|
-
Valor1: async () => true,
|
|
34
|
-
Valor2: async () => true,
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
assert.strictEqual(result, true)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('switch union (nao okay)', async () => {
|
|
41
|
-
const result = await Plata.switchUnion('Valor3' as TestUnion, {
|
|
42
|
-
_default: async () => false,
|
|
43
|
-
Valor1: async () => true,
|
|
44
|
-
Valor2: async () => true,
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
assert.strictEqual(result, false)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('switch union object (okay)', async () => {
|
|
51
|
-
const union: TestUnionObject = Math.ceil(Math.random() * 100) % 2 === 0 ? {
|
|
52
|
-
tipo: 'Tipo1',
|
|
53
|
-
valor: 1,
|
|
54
|
-
} : {
|
|
55
|
-
tipo: 'Tipo2',
|
|
56
|
-
valor: '',
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const result = await Plata.switchUnionObject(union, 'tipo', {
|
|
60
|
-
_default: async (v) => false,
|
|
61
|
-
Tipo1: async (v) => v.valor === 1,
|
|
62
|
-
Tipo2: async (v) => v.valor === '',
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
assert.strictEqual(result, true)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('switch union object (não okay)', async () => {
|
|
69
|
-
const result = await Plata.switchUnionObject({} as any, 'tipo', {
|
|
70
|
-
_default: async (v) => true,
|
|
71
|
-
Tipo1: async (v) => false,
|
|
72
|
-
Tipo2: async (v) => false,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
assert.strictEqual(result, true)
|
|
76
|
-
})
|
|
1
|
+
import { describe, it, before } from "node:test"
|
|
2
|
+
import assert from "node:assert"
|
|
3
|
+
import { PlataModels } from ".."
|
|
4
|
+
import { loadRuntimeLibs } from "../bin/runtime/_setupRuntime"
|
|
5
|
+
|
|
6
|
+
describe('Plata Switch', () => {
|
|
7
|
+
const plataPromise = (async () => {
|
|
8
|
+
const g = global as any
|
|
9
|
+
|
|
10
|
+
g.Plata = await loadRuntimeLibs()
|
|
11
|
+
})()
|
|
12
|
+
|
|
13
|
+
type TestUnion = 'Valor1' | 'Valor2'
|
|
14
|
+
|
|
15
|
+
type TestUnionObject = {
|
|
16
|
+
tipo: 'Tipo1'
|
|
17
|
+
valor: number
|
|
18
|
+
} | {
|
|
19
|
+
tipo: 'Tipo2'
|
|
20
|
+
valor: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
before(async () => {
|
|
24
|
+
await plataPromise
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('switch union (okay)', async () => {
|
|
28
|
+
|
|
29
|
+
const union = Math.ceil(Math.random() * 100) % 2 === 0 ? 'Valor1' : 'Valor2'
|
|
30
|
+
|
|
31
|
+
const result = await Plata.switchUnion(union, {
|
|
32
|
+
_default: async () => false,
|
|
33
|
+
Valor1: async () => true,
|
|
34
|
+
Valor2: async () => true,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
assert.strictEqual(result, true)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('switch union (nao okay)', async () => {
|
|
41
|
+
const result = await Plata.switchUnion('Valor3' as TestUnion, {
|
|
42
|
+
_default: async () => false,
|
|
43
|
+
Valor1: async () => true,
|
|
44
|
+
Valor2: async () => true,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
assert.strictEqual(result, false)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('switch union object (okay)', async () => {
|
|
51
|
+
const union: TestUnionObject = Math.ceil(Math.random() * 100) % 2 === 0 ? {
|
|
52
|
+
tipo: 'Tipo1',
|
|
53
|
+
valor: 1,
|
|
54
|
+
} : {
|
|
55
|
+
tipo: 'Tipo2',
|
|
56
|
+
valor: '',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const result = await Plata.switchUnionObject(union, 'tipo', {
|
|
60
|
+
_default: async (v) => false,
|
|
61
|
+
Tipo1: async (v) => v.valor === 1,
|
|
62
|
+
Tipo2: async (v) => v.valor === '',
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
assert.strictEqual(result, true)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('switch union object (não okay)', async () => {
|
|
69
|
+
const result = await Plata.switchUnionObject({} as any, 'tipo', {
|
|
70
|
+
_default: async (v) => true,
|
|
71
|
+
Tipo1: async (v) => false,
|
|
72
|
+
Tipo2: async (v) => false,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
assert.strictEqual(result, true)
|
|
76
|
+
})
|
|
77
77
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
export class $__Name__$ {
|
|
3
|
-
constructor() {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function new$__Name__$(): $__Name__$ {
|
|
9
|
-
return new $__Name__$()
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function get$__Name__$(): $__Name__$ {
|
|
13
|
-
return Plata.CacheClass(new$__Name__$)
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export class $__Name__$ {
|
|
3
|
+
constructor() {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function new$__Name__$(): $__Name__$ {
|
|
9
|
+
return new $__Name__$()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function get$__Name__$(): $__Name__$ {
|
|
13
|
+
return Plata.CacheClass(new$__Name__$)
|
|
14
14
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
export async function main() {
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function exit(worker: Cluster.Worker, code: number, signal: string) {
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
name: '$__name__$',
|
|
12
|
-
env: Plata.config.ENV ?? 'debug',
|
|
13
|
-
onStart: main,
|
|
14
|
-
onExit: exit,
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export async function main() {
|
|
3
|
+
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function exit(worker: Cluster.Worker, code: number, signal: string) {
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: '$__name__$',
|
|
12
|
+
env: Plata.config.ENV ?? 'debug',
|
|
13
|
+
onStart: main,
|
|
14
|
+
onExit: exit,
|
|
15
15
|
} satisfies Cluster.WorkerConfig
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export async function main() {
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
export async function main() {
|
|
2
|
+
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const $__Name__$Config = {
|
|
2
|
-
|
|
1
|
+
export const $__Name__$Config = {
|
|
2
|
+
|
|
3
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
export namespace $__Name__$ {
|
|
3
|
-
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export namespace $__Name__$ {
|
|
3
|
+
|
|
4
4
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
import { PlataModels } from '$__PlataName__$'
|
|
3
|
-
|
|
4
|
-
const $__Name__$ = new PlataModels.ModelTemplate({
|
|
5
|
-
param: [ PlataModels.Required(), PlataModels.Int() ],
|
|
6
|
-
object: {
|
|
7
|
-
param: [ PlataModels.Required(), PlataModels.DateTime() ],
|
|
8
|
-
},
|
|
9
|
-
array: [ [ PlataModels.VarChar(30) ] ],
|
|
10
|
-
array_objects: [{
|
|
11
|
-
param: [ PlataModels.Optional(), PlataModels.Decimal(10,2) ]
|
|
12
|
-
}]
|
|
13
|
-
} as const, {})
|
|
14
|
-
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { PlataModels } from '$__PlataName__$'
|
|
3
|
+
|
|
4
|
+
const $__Name__$ = new PlataModels.ModelTemplate({
|
|
5
|
+
param: [ PlataModels.Required(), PlataModels.Int() ],
|
|
6
|
+
object: {
|
|
7
|
+
param: [ PlataModels.Required(), PlataModels.DateTime() ],
|
|
8
|
+
},
|
|
9
|
+
array: [ [ PlataModels.VarChar(30) ] ],
|
|
10
|
+
array_objects: [{
|
|
11
|
+
param: [ PlataModels.Optional(), PlataModels.Decimal(10,2) ]
|
|
12
|
+
}]
|
|
13
|
+
} as const, {})
|
|
14
|
+
|
|
15
15
|
export const $__Name__$Model = $__Name__$
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
export default async (router: Router.Router): Promise<Router.Router> => {
|
|
3
|
-
|
|
4
|
-
router.get('/', async (req, res) => {
|
|
5
|
-
return res.status(200).json({})
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
return router
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export default async (router: Router.Router): Promise<Router.Router> => {
|
|
3
|
+
|
|
4
|
+
router.get('/', async (req, res) => {
|
|
5
|
+
return res.status(200).json({})
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
return router
|
|
9
9
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
import { PlataTasks, PlataTools } from "ç__PlataName__ç"
|
|
3
|
-
|
|
4
|
-
async function main(fireDate: Date): Promise<PlataTools.PlataError | null> {
|
|
5
|
-
return null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: '',
|
|
10
|
-
rule: null, // https://crontab.guru/
|
|
11
|
-
onPlataStart: false,
|
|
12
|
-
callback: main
|
|
13
|
-
} as PlataTasks.PlataTask
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { PlataTasks, PlataTools } from "ç__PlataName__ç"
|
|
3
|
+
|
|
4
|
+
async function main(fireDate: Date): Promise<PlataTools.PlataError | null> {
|
|
5
|
+
return null
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: '',
|
|
10
|
+
rule: null, // https://crontab.guru/
|
|
11
|
+
onPlataStart: false,
|
|
12
|
+
callback: main
|
|
13
|
+
} as PlataTasks.PlataTask
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"name": "DEV",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"runtimeArgs": [
|
|
11
|
-
"run-script",
|
|
12
|
-
"start"
|
|
13
|
-
],
|
|
14
|
-
"runtimeExecutable": "npm",
|
|
15
|
-
"skipFiles": [
|
|
16
|
-
"<node_internals>/**"
|
|
17
|
-
],
|
|
18
|
-
"type": "node"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "DEV",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"runtimeArgs": [
|
|
11
|
+
"run-script",
|
|
12
|
+
"start"
|
|
13
|
+
],
|
|
14
|
+
"runtimeExecutable": "npm",
|
|
15
|
+
"skipFiles": [
|
|
16
|
+
"<node_internals>/**"
|
|
17
|
+
],
|
|
18
|
+
"type": "node"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
21
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
FROM node:lts-alpine AS BUILD
|
|
2
|
-
|
|
3
|
-
WORKDIR /usr/src/app
|
|
4
|
-
|
|
5
|
-
COPY . ./
|
|
6
|
-
|
|
7
|
-
ARG BUILD_ENV
|
|
8
|
-
ENV BUILD_ENV=${BUILD_ENV:-docker}
|
|
9
|
-
|
|
10
|
-
RUN npm i
|
|
11
|
-
RUN npm run build
|
|
12
|
-
RUN cp package-lock.json /usr/src/app/__RELEASE__
|
|
13
|
-
WORKDIR /usr/src/app/__RELEASE__
|
|
14
|
-
|
|
15
|
-
RUN npm i
|
|
16
|
-
|
|
17
|
-
FROM node:lts-alpine AS RUNTIME
|
|
18
|
-
|
|
19
|
-
WORKDIR /usr/src/app
|
|
20
|
-
|
|
21
|
-
COPY --from=BUILD /usr/src/app/__RELEASE__ /usr/src/app/
|
|
22
|
-
|
|
23
|
-
EXPOSE 3050
|
|
24
|
-
|
|
1
|
+
FROM node:lts-alpine AS BUILD
|
|
2
|
+
|
|
3
|
+
WORKDIR /usr/src/app
|
|
4
|
+
|
|
5
|
+
COPY . ./
|
|
6
|
+
|
|
7
|
+
ARG BUILD_ENV
|
|
8
|
+
ENV BUILD_ENV=${BUILD_ENV:-docker}
|
|
9
|
+
|
|
10
|
+
RUN npm i
|
|
11
|
+
RUN npm run build
|
|
12
|
+
RUN cp package-lock.json /usr/src/app/__RELEASE__
|
|
13
|
+
WORKDIR /usr/src/app/__RELEASE__
|
|
14
|
+
|
|
15
|
+
RUN npm i
|
|
16
|
+
|
|
17
|
+
FROM node:lts-alpine AS RUNTIME
|
|
18
|
+
|
|
19
|
+
WORKDIR /usr/src/app
|
|
20
|
+
|
|
21
|
+
COPY --from=BUILD /usr/src/app/__RELEASE__ /usr/src/app/
|
|
22
|
+
|
|
23
|
+
EXPOSE 3050
|
|
24
|
+
|
|
25
25
|
CMD [ "npm", "start" ]
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const envConfig: PlataEnvConfig = {
|
|
2
|
-
env: 'debug'
|
|
1
|
+
export const envConfig: PlataEnvConfig = {
|
|
2
|
+
env: 'debug'
|
|
3
3
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Ambiente:
|
|
2
|
-
ENV=debug
|
|
3
|
-
|
|
4
|
-
# Tira timezone das datas que chegam para API
|
|
5
|
-
TZ=Etc/GMT
|
|
6
|
-
|
|
7
|
-
# Configurações da plata:
|
|
8
|
-
PORT=3050
|
|
9
|
-
_PLATA_API_ROOT=/api
|
|
10
|
-
_PLATA_API_SSL_KEY=
|
|
11
|
-
_PLATA_API_SSL_CERT=
|
|
12
|
-
_PLATA_API_SSL_PASS=
|
|
13
|
-
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
-
_PLATA_SQL_SHOWQUERY=1
|
|
15
|
-
_PLATA_SQL_CACHETABLE=0
|
|
1
|
+
# Ambiente:
|
|
2
|
+
ENV=debug
|
|
3
|
+
|
|
4
|
+
# Tira timezone das datas que chegam para API
|
|
5
|
+
TZ=Etc/GMT
|
|
6
|
+
|
|
7
|
+
# Configurações da plata:
|
|
8
|
+
PORT=3050
|
|
9
|
+
_PLATA_API_ROOT=/api
|
|
10
|
+
_PLATA_API_SSL_KEY=
|
|
11
|
+
_PLATA_API_SSL_CERT=
|
|
12
|
+
_PLATA_API_SSL_PASS=
|
|
13
|
+
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
+
_PLATA_SQL_SHOWQUERY=1
|
|
15
|
+
_PLATA_SQL_CACHETABLE=0
|
|
16
16
|
_PLATA_SQL_CACHETABLETIME=0
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Ambiente:
|
|
2
|
-
ENV=homolog
|
|
3
|
-
|
|
4
|
-
# Tira timezone das datas que chegam para API
|
|
5
|
-
TZ=Etc/GMT
|
|
6
|
-
|
|
7
|
-
# Configurações da plata:
|
|
8
|
-
PORT=3050
|
|
9
|
-
_PLATA_API_ROOT=/api
|
|
10
|
-
_PLATA_API_SSL_KEY=
|
|
11
|
-
_PLATA_API_SSL_CERT=
|
|
12
|
-
_PLATA_API_SSL_PASS=
|
|
13
|
-
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
-
_PLATA_SQL_SHOWQUERY=1
|
|
15
|
-
_PLATA_SQL_CACHETABLE=1
|
|
1
|
+
# Ambiente:
|
|
2
|
+
ENV=homolog
|
|
3
|
+
|
|
4
|
+
# Tira timezone das datas que chegam para API
|
|
5
|
+
TZ=Etc/GMT
|
|
6
|
+
|
|
7
|
+
# Configurações da plata:
|
|
8
|
+
PORT=3050
|
|
9
|
+
_PLATA_API_ROOT=/api
|
|
10
|
+
_PLATA_API_SSL_KEY=
|
|
11
|
+
_PLATA_API_SSL_CERT=
|
|
12
|
+
_PLATA_API_SSL_PASS=
|
|
13
|
+
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
+
_PLATA_SQL_SHOWQUERY=1
|
|
15
|
+
_PLATA_SQL_CACHETABLE=1
|
|
16
16
|
_PLATA_SQL_CACHETABLETIME=60
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Ambiente:
|
|
2
|
-
ENV=prod
|
|
3
|
-
|
|
4
|
-
# Tira timezone das datas que chegam para API
|
|
5
|
-
TZ=Etc/GMT
|
|
6
|
-
|
|
7
|
-
# Configurações da plata:
|
|
8
|
-
PORT=3050
|
|
9
|
-
_PLATA_API_ROOT=/api
|
|
10
|
-
_PLATA_API_SSL_KEY=
|
|
11
|
-
_PLATA_API_SSL_CERT=
|
|
12
|
-
_PLATA_API_SSL_PASS=
|
|
13
|
-
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
-
_PLATA_SQL_SHOWQUERY=0
|
|
15
|
-
_PLATA_SQL_CACHETABLE=1
|
|
1
|
+
# Ambiente:
|
|
2
|
+
ENV=prod
|
|
3
|
+
|
|
4
|
+
# Tira timezone das datas que chegam para API
|
|
5
|
+
TZ=Etc/GMT
|
|
6
|
+
|
|
7
|
+
# Configurações da plata:
|
|
8
|
+
PORT=3050
|
|
9
|
+
_PLATA_API_ROOT=/api
|
|
10
|
+
_PLATA_API_SSL_KEY=
|
|
11
|
+
_PLATA_API_SSL_CERT=
|
|
12
|
+
_PLATA_API_SSL_PASS=
|
|
13
|
+
_PLATA_API_JSON_SIZE=100kb
|
|
14
|
+
_PLATA_SQL_SHOWQUERY=0
|
|
15
|
+
_PLATA_SQL_CACHETABLE=1
|
|
16
16
|
_PLATA_SQL_CACHETABLETIME=60
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"lib": ["esnext"],
|
|
6
|
-
"declaration": false,
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"outDir": "./__BUILD__",
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"strictNullChecks": true,
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"types": [ "pwi-plata-type", "node" ],
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"baseUrl": ".",
|
|
18
|
-
"paths": {
|
|
19
|
-
"@@/*": [ "./*" ]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"include": [
|
|
23
|
-
"./**/*"
|
|
24
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"lib": ["esnext"],
|
|
6
|
+
"declaration": false,
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"outDir": "./__BUILD__",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"types": [ "pwi-plata-type", "node" ],
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@@/*": [ "./*" ]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"./**/*"
|
|
24
|
+
]
|
|
25
25
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"name": "DEV",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"runtimeArgs": [
|
|
11
|
-
"run-script",
|
|
12
|
-
"start"
|
|
13
|
-
],
|
|
14
|
-
"runtimeExecutable": "npm",
|
|
15
|
-
"skipFiles": [
|
|
16
|
-
"<node_internals>/**"
|
|
17
|
-
],
|
|
18
|
-
"type": "node"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "DEV",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"runtimeArgs": [
|
|
11
|
+
"run-script",
|
|
12
|
+
"start"
|
|
13
|
+
],
|
|
14
|
+
"runtimeExecutable": "npm",
|
|
15
|
+
"skipFiles": [
|
|
16
|
+
"<node_internals>/**"
|
|
17
|
+
],
|
|
18
|
+
"type": "node"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
21
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
FROM node:lts-alpine AS BUILD
|
|
2
|
-
|
|
3
|
-
WORKDIR /usr/src/app
|
|
4
|
-
|
|
5
|
-
COPY . ./
|
|
6
|
-
|
|
7
|
-
ARG BUILD_ENV
|
|
8
|
-
ENV BUILD_ENV=${BUILD_ENV:-docker}
|
|
9
|
-
|
|
10
|
-
RUN npm i
|
|
11
|
-
RUN npm run build
|
|
12
|
-
RUN cp package-lock.json /usr/src/app/__RELEASE__
|
|
13
|
-
WORKDIR /usr/src/app/__RELEASE__
|
|
14
|
-
|
|
15
|
-
RUN npm i
|
|
16
|
-
|
|
17
|
-
FROM node:lts-alpine AS RUNTIME
|
|
18
|
-
|
|
19
|
-
WORKDIR /usr/src/app
|
|
20
|
-
|
|
21
|
-
COPY --from=BUILD /usr/src/app/__RELEASE__ /usr/src/app/
|
|
22
|
-
|
|
23
|
-
EXPOSE 3050
|
|
24
|
-
|
|
1
|
+
FROM node:lts-alpine AS BUILD
|
|
2
|
+
|
|
3
|
+
WORKDIR /usr/src/app
|
|
4
|
+
|
|
5
|
+
COPY . ./
|
|
6
|
+
|
|
7
|
+
ARG BUILD_ENV
|
|
8
|
+
ENV BUILD_ENV=${BUILD_ENV:-docker}
|
|
9
|
+
|
|
10
|
+
RUN npm i
|
|
11
|
+
RUN npm run build
|
|
12
|
+
RUN cp package-lock.json /usr/src/app/__RELEASE__
|
|
13
|
+
WORKDIR /usr/src/app/__RELEASE__
|
|
14
|
+
|
|
15
|
+
RUN npm i
|
|
16
|
+
|
|
17
|
+
FROM node:lts-alpine AS RUNTIME
|
|
18
|
+
|
|
19
|
+
WORKDIR /usr/src/app
|
|
20
|
+
|
|
21
|
+
COPY --from=BUILD /usr/src/app/__RELEASE__ /usr/src/app/
|
|
22
|
+
|
|
23
|
+
EXPOSE 3050
|
|
24
|
+
|
|
25
25
|
CMD [ "npm", "start" ]
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const envConfig: PlataEnvConfig = {
|
|
2
|
-
env: 'debug'
|
|
1
|
+
export const envConfig: PlataEnvConfig = {
|
|
2
|
+
env: 'debug'
|
|
3
3
|
}
|