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.
Files changed (101) hide show
  1. package/README.md +2 -2
  2. package/__BUILD__/libs/sql.js +4 -1
  3. package/__BUILD__/libs/sql.js.map +1 -1
  4. package/package.json +53 -53
  5. package/src/@types/build.d.ts +26 -26
  6. package/src/@types/cluster.actions.d.ts +27 -27
  7. package/src/@types/cluster.d.ts +55 -55
  8. package/src/@types/create-cli.d.ts +8 -8
  9. package/src/@types/exported.d.ts +31 -31
  10. package/src/@types/fs.d.ts +6 -6
  11. package/src/@types/global.d.ts +113 -113
  12. package/src/@types/knex.d.ts +13 -13
  13. package/src/@types/model.d.ts +143 -143
  14. package/src/@types/router.d.ts +107 -107
  15. package/src/@types/sql.d.ts +75 -75
  16. package/src/@types/swagger.d.ts +22 -22
  17. package/src/bin/extras/create-api-cli.ts +218 -218
  18. package/src/bin/extras/create-cluster-cli.ts +160 -160
  19. package/src/bin/extras/create-lib-cli.ts +84 -84
  20. package/src/bin/extras/plata-create-tools.ts +97 -97
  21. package/src/bin/plata-api.ts +189 -189
  22. package/src/bin/plata-build.ts +17 -17
  23. package/src/bin/plata-cluster.ts +42 -42
  24. package/src/bin/plata-cmd.ts +18 -18
  25. package/src/bin/plata-create.ts +49 -49
  26. package/src/bin/plata-runtime.ts +131 -131
  27. package/src/bin/plata-swagger.ts +99 -99
  28. package/src/bin/runtime/_setupRuntime.ts +48 -48
  29. package/src/bin/runtime/_types.d.ts +7 -7
  30. package/src/bin/runtime/class.ts +20 -20
  31. package/src/bin/runtime/dirs.ts +25 -25
  32. package/src/bin/runtime/effect.ts +60 -60
  33. package/src/bin/runtime/fs.ts +10 -10
  34. package/src/bin/runtime/promises.ts +18 -18
  35. package/src/bin/runtime/require.ts +113 -113
  36. package/src/bin/runtime/sql.ts +12 -12
  37. package/src/bin/runtime/switch.ts +60 -60
  38. package/src/index.ts +19 -19
  39. package/src/libs/axios.ts +51 -51
  40. package/src/libs/build.ts +162 -162
  41. package/src/libs/cluster/cluster-controller.ts +93 -93
  42. package/src/libs/cluster.ts +330 -330
  43. package/src/libs/custom.ts +15 -15
  44. package/src/libs/env.ts +10 -10
  45. package/src/libs/fs.ts +399 -399
  46. package/src/libs/hot-reload.ts +63 -63
  47. package/src/libs/models/index.ts +4 -4
  48. package/src/libs/models/model-template-combine.ts +93 -93
  49. package/src/libs/models/model-template-env.ts +58 -58
  50. package/src/libs/models/model-template-union.ts +83 -83
  51. package/src/libs/models/model-template.ts +107 -107
  52. package/src/libs/models/model-validations.ts +443 -443
  53. package/src/libs/models/tools.ts +194 -194
  54. package/src/libs/router.ts +185 -185
  55. package/src/libs/sql.ts +792 -788
  56. package/src/libs/swagger.ts +81 -81
  57. package/src/libs/tools.ts +240 -240
  58. package/src/scripts/post-install/api.ts +32 -32
  59. package/src/scripts/post-install/cluster.ts +28 -28
  60. package/src/scripts/post-install/lib.ts +25 -25
  61. package/src/scripts/post-install.ts +64 -64
  62. package/src/scripts/pre-test.ts +33 -33
  63. package/src/tests/assets/sql/example.sql +76 -76
  64. package/src/tests/config.test.ts +12 -12
  65. package/src/tests/effect.test.ts +62 -62
  66. package/src/tests/model.env.test.ts +66 -66
  67. package/src/tests/model.test.ts +141 -141
  68. package/src/tests/model.union.test.ts +160 -160
  69. package/src/tests/router.test.ts +44 -44
  70. package/src/tests/sql.test.ts +502 -502
  71. package/src/tests/switch.test.ts +76 -76
  72. package/templates/create-cli/class.ts +13 -13
  73. package/templates/create-cli/cluster.ts +14 -14
  74. package/templates/create-cli/cmd.ts +3 -3
  75. package/templates/create-cli/config.ts +2 -2
  76. package/templates/create-cli/lib.ts +3 -3
  77. package/templates/create-cli/model.ts +14 -14
  78. package/templates/create-cli/route.ts +8 -8
  79. package/templates/create-cli/task.ts +13 -13
  80. package/templates/postinstall/api/.vscode/launch.json +20 -20
  81. package/templates/postinstall/api/Dockerfile +24 -24
  82. package/templates/postinstall/api/configs/env.ts +2 -2
  83. package/templates/postinstall/api/envs/debug.env +15 -15
  84. package/templates/postinstall/api/envs/homolog.env +15 -15
  85. package/templates/postinstall/api/envs/prod.env +15 -15
  86. package/templates/postinstall/api/tsconfig.json +24 -24
  87. package/templates/postinstall/cluster/.vscode/launch.json +20 -20
  88. package/templates/postinstall/cluster/Dockerfile +24 -24
  89. package/templates/postinstall/cluster/configs/env.ts +2 -2
  90. package/templates/postinstall/cluster/envs/debug.env +10 -10
  91. package/templates/postinstall/cluster/envs/homolog.env +10 -10
  92. package/templates/postinstall/cluster/envs/prod.env +10 -10
  93. package/templates/postinstall/cluster/tsconfig.json +24 -24
  94. package/templates/postinstall/lib/postinstall-tools.mjs +111 -111
  95. package/templates/postinstall/lib/postinstall.js +33 -33
  96. package/templates/postinstall/lib/tsconfig.json +22 -22
  97. package/templates/swagger-cli/header.json +21 -21
  98. package/templates/swagger-cli/route/body.json +14 -14
  99. package/templates/swagger-cli/route/header.json +18 -18
  100. package/templates/swagger-cli/route/response.json +53 -53
  101. package/tsconfig.json +28 -28
@@ -1,100 +1,100 @@
1
- import path from 'node:path'
2
- import fs from 'node:fs'
3
- import { buildExpressRouter, loadRoutesFromProject } from "++/libs/router"
4
-
5
- export async function dumpRoutes() {
6
- const requiredRoutes = await loadRoutesFromProject()
7
-
8
- if (requiredRoutes.errorID !== undefined) {
9
- console.log(requiredRoutes)
10
- process.exit(1)
11
- }
12
-
13
- const router = await buildExpressRouter(requiredRoutes)
14
-
15
- if (router.errorID !== undefined) {
16
- console.log(router)
17
- process.exit(1)
18
- }
19
-
20
- const dumpedRoutes: SwaggerGen.Route[] = []
21
- const regex = /:(.*?)\??\//g
22
-
23
- for (const r of router.routes) {
24
- if (r.swaggerHide) {
25
- continue
26
- }
27
-
28
- r.path = path.normalize(`${r.path ?? '/'}/`).replace(/\\/g, '/')
29
-
30
- const dumpedRouteParams: SwaggerGen.RouteParameter[] = []
31
- const urlParms = r.path.match(regex) ?? []
32
-
33
- for (const p of urlParms) {
34
- dumpedRouteParams.push({
35
- name: p.replace(regex, '$1'),
36
- required: p[p.length - 2] !== '?',
37
- in: 'path',
38
- type: 'string'
39
- })
40
- }
41
-
42
- dumpedRoutes.push({
43
- httpRoute: r.path.replace(regex, '{$1}/'),
44
- method: r.method,
45
- params: dumpedRouteParams,
46
- })
47
- }
48
-
49
- return dumpedRoutes
50
- }
51
-
52
- export async function toProjectSwagger(file: string, content: any): Promise<void> {
53
- try {
54
- const p = path.resolve(Plata.ProjectDir, 'swagger', file)
55
-
56
- if (!fs.existsSync(p)) {
57
- fs.mkdirSync(path.dirname(p), { recursive: true })
58
- fs.writeFileSync(p, JSON.stringify(content, null, 4))
59
- }
60
-
61
- } catch (e) {
62
- console.log(e)
63
- process.exit(1)
64
- }
65
- }
66
-
67
- export const main = async () => {
68
- const routes = await dumpRoutes()
69
-
70
- const templateFolder = path.join(Plata.PlataDir, 'templates', 'swagger-cli')
71
-
72
- const files: SwaggerGen.Files = {
73
- swaggerHeader: require(path.join(templateFolder, 'header.json')),
74
- route: {
75
- header: require(path.join(templateFolder, 'route', 'header.json')),
76
- body: require(path.join(templateFolder, 'route', 'body.json')),
77
- response: require(path.join(templateFolder, 'route', 'response.json')),
78
- }
79
- }
80
-
81
- for (const route of routes) {
82
-
83
- // https://developer.mozilla.org/en-US/docs/Glossary/Deep_copy
84
- const fileCopy:SwaggerGen.Files = JSON.parse(JSON.stringify(files))
85
-
86
- for(const json in fileCopy.route) {
87
- await toProjectSwagger(
88
- path.join('routes', route.httpRoute, route.method.toLowerCase(), `${json}.json`),
89
- fileCopy.route[json]
90
- )
91
- }
92
- }
93
-
94
- await toProjectSwagger(
95
- 'header.json',
96
- files.swaggerHeader
97
- )
98
-
99
- console.log('Done')
1
+ import path from 'node:path'
2
+ import fs from 'node:fs'
3
+ import { buildExpressRouter, loadRoutesFromProject } from "++/libs/router"
4
+
5
+ export async function dumpRoutes() {
6
+ const requiredRoutes = await loadRoutesFromProject()
7
+
8
+ if (requiredRoutes.errorID !== undefined) {
9
+ console.log(requiredRoutes)
10
+ process.exit(1)
11
+ }
12
+
13
+ const router = await buildExpressRouter(requiredRoutes)
14
+
15
+ if (router.errorID !== undefined) {
16
+ console.log(router)
17
+ process.exit(1)
18
+ }
19
+
20
+ const dumpedRoutes: SwaggerGen.Route[] = []
21
+ const regex = /:(.*?)\??\//g
22
+
23
+ for (const r of router.routes) {
24
+ if (r.swaggerHide) {
25
+ continue
26
+ }
27
+
28
+ r.path = path.normalize(`${r.path ?? '/'}/`).replace(/\\/g, '/')
29
+
30
+ const dumpedRouteParams: SwaggerGen.RouteParameter[] = []
31
+ const urlParms = r.path.match(regex) ?? []
32
+
33
+ for (const p of urlParms) {
34
+ dumpedRouteParams.push({
35
+ name: p.replace(regex, '$1'),
36
+ required: p[p.length - 2] !== '?',
37
+ in: 'path',
38
+ type: 'string'
39
+ })
40
+ }
41
+
42
+ dumpedRoutes.push({
43
+ httpRoute: r.path.replace(regex, '{$1}/'),
44
+ method: r.method,
45
+ params: dumpedRouteParams,
46
+ })
47
+ }
48
+
49
+ return dumpedRoutes
50
+ }
51
+
52
+ export async function toProjectSwagger(file: string, content: any): Promise<void> {
53
+ try {
54
+ const p = path.resolve(Plata.ProjectDir, 'swagger', file)
55
+
56
+ if (!fs.existsSync(p)) {
57
+ fs.mkdirSync(path.dirname(p), { recursive: true })
58
+ fs.writeFileSync(p, JSON.stringify(content, null, 4))
59
+ }
60
+
61
+ } catch (e) {
62
+ console.log(e)
63
+ process.exit(1)
64
+ }
65
+ }
66
+
67
+ export const main = async () => {
68
+ const routes = await dumpRoutes()
69
+
70
+ const templateFolder = path.join(Plata.PlataDir, 'templates', 'swagger-cli')
71
+
72
+ const files: SwaggerGen.Files = {
73
+ swaggerHeader: require(path.join(templateFolder, 'header.json')),
74
+ route: {
75
+ header: require(path.join(templateFolder, 'route', 'header.json')),
76
+ body: require(path.join(templateFolder, 'route', 'body.json')),
77
+ response: require(path.join(templateFolder, 'route', 'response.json')),
78
+ }
79
+ }
80
+
81
+ for (const route of routes) {
82
+
83
+ // https://developer.mozilla.org/en-US/docs/Glossary/Deep_copy
84
+ const fileCopy:SwaggerGen.Files = JSON.parse(JSON.stringify(files))
85
+
86
+ for(const json in fileCopy.route) {
87
+ await toProjectSwagger(
88
+ path.join('routes', route.httpRoute, route.method.toLowerCase(), `${json}.json`),
89
+ fileCopy.route[json]
90
+ )
91
+ }
92
+ }
93
+
94
+ await toProjectSwagger(
95
+ 'header.json',
96
+ files.swaggerHeader
97
+ )
98
+
99
+ console.log('Done')
100
100
  }
@@ -1,49 +1,49 @@
1
- import fs from 'node:fs/promises'
2
- import path from 'node:path'
3
-
4
- export async function loadRuntimeLibs() {
5
- const plata = Object.create(null)
6
-
7
- const runtimeLibs: PlataResult<string[]> = await fs.readdir(path.join(__dirname)).catch(err => {
8
- return {
9
- errorID: 'PRLORUNTIME',
10
- msg: err.message,
11
- error: err
12
- }
13
- })
14
-
15
- if (runtimeLibs.errorID !== undefined) {
16
- console.error(runtimeLibs)
17
- process.exit(1)
18
- }
19
-
20
- const promises = runtimeLibs.map(lib => Promise.resolve().then(() => new Promise(resolve => {
21
- if (lib.slice(-4) === 'd.ts')
22
- return resolve(true)
23
- ;
24
-
25
- if (path.extname(lib) === '.map')
26
- return resolve(true)
27
- ;
28
-
29
- const r: { PlataRuntimeE?: any } = require(path.join(__dirname, lib))
30
-
31
- if (r.PlataRuntimeE === undefined) {
32
- return resolve(true)
33
- }
34
-
35
- for (const key in r.PlataRuntimeE) {
36
- plata[key] = r.PlataRuntimeE[key]
37
- }
38
-
39
- return resolve(true)
40
- })))
41
-
42
- await Promise.all(promises).catch(err => {
43
- console.error(err)
44
- process.exit(1)
45
- })
46
-
47
-
48
- return plata
1
+ import fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
+
4
+ export async function loadRuntimeLibs() {
5
+ const plata = Object.create(null)
6
+
7
+ const runtimeLibs: PlataResult<string[]> = await fs.readdir(path.join(__dirname)).catch(err => {
8
+ return {
9
+ errorID: 'PRLORUNTIME',
10
+ msg: err.message,
11
+ error: err
12
+ }
13
+ })
14
+
15
+ if (runtimeLibs.errorID !== undefined) {
16
+ console.error(runtimeLibs)
17
+ process.exit(1)
18
+ }
19
+
20
+ const promises = runtimeLibs.map(lib => Promise.resolve().then(() => new Promise(resolve => {
21
+ if (lib.slice(-4) === 'd.ts')
22
+ return resolve(true)
23
+ ;
24
+
25
+ if (path.extname(lib) === '.map')
26
+ return resolve(true)
27
+ ;
28
+
29
+ const r: { PlataRuntimeE?: any } = require(path.join(__dirname, lib))
30
+
31
+ if (r.PlataRuntimeE === undefined) {
32
+ return resolve(true)
33
+ }
34
+
35
+ for (const key in r.PlataRuntimeE) {
36
+ plata[key] = r.PlataRuntimeE[key]
37
+ }
38
+
39
+ return resolve(true)
40
+ })))
41
+
42
+ await Promise.all(promises).catch(err => {
43
+ console.error(err)
44
+ process.exit(1)
45
+ })
46
+
47
+
48
+ return plata
49
49
  }
@@ -1,8 +1,8 @@
1
- /// <reference path="class.ts" />
2
- /// <reference path="dirs.ts" />
3
- /// <reference path="promises.ts" />
4
- /// <reference path="require.ts" />
5
- /// <reference path="fs.ts" />
6
- /// <reference path="sql.ts" />
7
- /// <reference path="switch.ts" />
1
+ /// <reference path="class.ts" />
2
+ /// <reference path="dirs.ts" />
3
+ /// <reference path="promises.ts" />
4
+ /// <reference path="require.ts" />
5
+ /// <reference path="fs.ts" />
6
+ /// <reference path="sql.ts" />
7
+ /// <reference path="switch.ts" />
8
8
  /// <reference path="effect.ts" />
@@ -1,21 +1,21 @@
1
- declare global {
2
- interface PlataRuntime extends PlataRuntimeEType {}
3
- }
4
-
5
- type PlataRuntimeEType = typeof PlataRuntimeE
6
-
7
- export namespace PlataRuntimeE {
8
- export function CacheClass<T>(newFunction: (...args: any) => T): T {
9
- const p = process as any
10
-
11
- if (p.cache === undefined) {
12
- p.cache = Object.create(null)
13
- }
14
-
15
- if (p.cache[newFunction.name] === undefined) {
16
- p.cache[newFunction.name] = newFunction()
17
- }
18
-
19
- return p.cache[newFunction.name]
20
- }
1
+ declare global {
2
+ interface PlataRuntime extends PlataRuntimeEType {}
3
+ }
4
+
5
+ type PlataRuntimeEType = typeof PlataRuntimeE
6
+
7
+ export namespace PlataRuntimeE {
8
+ export function CacheClass<T>(newFunction: (...args: any) => T): T {
9
+ const p = process as any
10
+
11
+ if (p.cache === undefined) {
12
+ p.cache = Object.create(null)
13
+ }
14
+
15
+ if (p.cache[newFunction.name] === undefined) {
16
+ p.cache[newFunction.name] = newFunction()
17
+ }
18
+
19
+ return p.cache[newFunction.name]
20
+ }
21
21
  }
@@ -1,26 +1,26 @@
1
- import fs from 'node:fs'
2
- import path from 'node:path'
3
-
4
- declare global {
5
- interface PlataRuntime extends PlataRuntimeEType {}
6
- }
7
-
8
- type PlataRuntimeEType = typeof PlataRuntimeE
9
-
10
- export namespace PlataRuntimeE {
11
- export const ProjectDir = path.resolve('.')
12
-
13
- export const ProjectJson = JSON.parse(
14
- fs.readFileSync(
15
- path.join(ProjectDir, 'package.json')
16
- ).toString()
17
- )
18
-
19
- export const PlataDir = path.resolve('.', 'node_modules', ProjectJson.plata_name ?? '..')
20
-
21
- export const PlataJson = JSON.parse(
22
- fs.readFileSync(
23
- path.join(PlataDir, 'package.json')
24
- ).toString()
25
- )
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+
4
+ declare global {
5
+ interface PlataRuntime extends PlataRuntimeEType {}
6
+ }
7
+
8
+ type PlataRuntimeEType = typeof PlataRuntimeE
9
+
10
+ export namespace PlataRuntimeE {
11
+ export const ProjectDir = path.resolve('.')
12
+
13
+ export const ProjectJson = JSON.parse(
14
+ fs.readFileSync(
15
+ path.join(ProjectDir, 'package.json')
16
+ ).toString()
17
+ )
18
+
19
+ export const PlataDir = path.resolve('.', 'node_modules', ProjectJson.plata_name ?? '..')
20
+
21
+ export const PlataJson = JSON.parse(
22
+ fs.readFileSync(
23
+ path.join(PlataDir, 'package.json')
24
+ ).toString()
25
+ )
26
26
  }
@@ -1,61 +1,61 @@
1
- import { Effect } from 'effect'
2
-
3
- declare global {
4
- interface PlataRuntime extends PlataRuntimeEType {}
5
- }
6
-
7
- type PlataRuntimeEType = typeof PlataRuntimeE
8
-
9
-
10
- export namespace PlataRuntimeE {
11
- export async function PromiseAll<
12
- T extends readonly unknown[] | [],
13
- R = RemovePlataResultOnPromiseAll<{ -readonly [P in keyof T]: Awaited<T[P]> }>
14
- >(promises: T): PlataPromise<
15
- R extends [] ?
16
- T extends Promise<infer U>[] ? RemovePlataResult<U>[]
17
- : never
18
- : R
19
- > {
20
- if (promises.length === 0) {
21
- return [] as any
22
- }
23
-
24
- const results: any[] = []
25
- let error: PlataError | null = null
26
- const promisesWithID = promises.map((p, i) => ({
27
- promise: p,
28
- id: i
29
- }))
30
-
31
- const effect = Effect.forEach(promisesWithID, (p) => Effect.gen(function* (_) {
32
- const result: PlataResult<any> = yield* _(Effect.promise(() => p.promise))
33
-
34
- if (result.errorID !== undefined) {
35
- error = result
36
- return yield* _(Effect.interrupt)
37
- }
38
-
39
- results[p.id] = result
40
- }), { concurrency: 'unbounded' })
41
-
42
- await Effect.runPromise(effect).catch((err) => {
43
- if (error === null)
44
- error = {
45
- errorID: 'PBRUNEFFPROALL001',
46
- msg: 'Erro ao realizar a operação',
47
- error: {
48
- message: err?.toString(),
49
- stack: err?.stack ?? new Error().stack
50
- }
51
- }
52
- ;
53
- })
54
-
55
- if (error !== null) {
56
- return error
57
- }
58
-
59
- return results as any
60
- }
1
+ import { Effect } from 'effect'
2
+
3
+ declare global {
4
+ interface PlataRuntime extends PlataRuntimeEType {}
5
+ }
6
+
7
+ type PlataRuntimeEType = typeof PlataRuntimeE
8
+
9
+
10
+ export namespace PlataRuntimeE {
11
+ export async function PromiseAll<
12
+ T extends readonly unknown[] | [],
13
+ R = RemovePlataResultOnPromiseAll<{ -readonly [P in keyof T]: Awaited<T[P]> }>
14
+ >(promises: T): PlataPromise<
15
+ R extends [] ?
16
+ T extends Promise<infer U>[] ? RemovePlataResult<U>[]
17
+ : never
18
+ : R
19
+ > {
20
+ if (promises.length === 0) {
21
+ return [] as any
22
+ }
23
+
24
+ const results: any[] = []
25
+ let error: PlataError | null = null
26
+ const promisesWithID = promises.map((p, i) => ({
27
+ promise: p,
28
+ id: i
29
+ }))
30
+
31
+ const effect = Effect.forEach(promisesWithID, (p) => Effect.gen(function* (_) {
32
+ const result: PlataResult<any> = yield* _(Effect.promise(() => p.promise))
33
+
34
+ if (result.errorID !== undefined) {
35
+ error = result
36
+ return yield* _(Effect.interrupt)
37
+ }
38
+
39
+ results[p.id] = result
40
+ }), { concurrency: 'unbounded' })
41
+
42
+ await Effect.runPromise(effect).catch((err) => {
43
+ if (error === null)
44
+ error = {
45
+ errorID: 'PBRUNEFFPROALL001',
46
+ msg: 'Erro ao realizar a operação',
47
+ error: {
48
+ message: err?.toString(),
49
+ stack: err?.stack ?? new Error().stack
50
+ }
51
+ }
52
+ ;
53
+ })
54
+
55
+ if (error !== null) {
56
+ return error
57
+ }
58
+
59
+ return results as any
60
+ }
61
61
  }
@@ -1,11 +1,11 @@
1
- import { PlataFs } from "../../libs/fs"
2
-
3
- declare global {
4
- interface PlataRuntime extends PlataRuntimeEType {}
5
- }
6
-
7
- type PlataRuntimeEType = typeof PlataRuntimeE
8
-
9
- export namespace PlataRuntimeE {
10
- export const files = PlataFs
1
+ import { PlataFs } from "../../libs/fs"
2
+
3
+ declare global {
4
+ interface PlataRuntime extends PlataRuntimeEType {}
5
+ }
6
+
7
+ type PlataRuntimeEType = typeof PlataRuntimeE
8
+
9
+ export namespace PlataRuntimeE {
10
+ export const files = PlataFs
11
11
  }
@@ -1,19 +1,19 @@
1
- declare global {
2
- interface PlataRuntime extends PlataRuntimeEType {}
3
- }
4
-
5
- type PlataRuntimeEType = typeof PlataRuntimeE
6
-
7
- export namespace PlataRuntimeE {
8
- export function FastPromise<T>(p: () => Promise<T>): Promise<T> {
9
- return Promise.resolve().then(p)
10
- }
11
-
12
- export function BuildPlataError(e: PlataError): PlataError {
13
- return e
14
- }
15
-
16
- export function BuildObject<T>(o: T): T {
17
- return o
18
- }
1
+ declare global {
2
+ interface PlataRuntime extends PlataRuntimeEType {}
3
+ }
4
+
5
+ type PlataRuntimeEType = typeof PlataRuntimeE
6
+
7
+ export namespace PlataRuntimeE {
8
+ export function FastPromise<T>(p: () => Promise<T>): Promise<T> {
9
+ return Promise.resolve().then(p)
10
+ }
11
+
12
+ export function BuildPlataError(e: PlataError): PlataError {
13
+ return e
14
+ }
15
+
16
+ export function BuildObject<T>(o: T): T {
17
+ return o
18
+ }
19
19
  }