Skip to content

Commit

Permalink
Continues to split protolib into different libraries, to optimice per…
Browse files Browse the repository at this point in the history
…formance and simplify concepts and builds. Fixes regression preventing object creation from working.
  • Loading branch information
jcarlosn committed Jul 7, 2024
1 parent abb78ed commit b5a4c08
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
3 changes: 1 addition & 2 deletions apps/admin-api/src/adminapi/templates.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fs from 'fs';
import {templates} from 'app/templates'
import { handler, getApp} from 'protonode'
import { connectDB } from 'app/bundles/storageProviders'
import { getLogger } from 'protobase';
import { getLogger, templates } from 'protobase';

const logger = getLogger()

Expand Down
1 change: 0 additions & 1 deletion apps/admin-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"./app/BaseConfig.ts",
"./app/conf.ts",
"./app/initialData.ts",
"./app/templates/**/*",
"./protolib/src/bundles/adminapi.ts",
"./protolib/src/bundles/library.ts",
"./protolib/src/bundles/apiContext.ts",
Expand Down
1 change: 0 additions & 1 deletion apps/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"./app/bundles/storageProviders.ts",
"./app/BaseConfig.ts",
"./app/initialData.ts",
"./app/templates/**/*",
"./protolib/src/bundles/apiContext.ts",
"./protolib/src/bundles/devices/devices/devicesSchemas.ts",
"./protolib/src/bundles/library.ts",
Expand Down
2 changes: 0 additions & 2 deletions packages/app/models/index.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/protobase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"files": [
"dist"
],
"dependencies": {
"handlebars": "4.7.8"
},

"devDependencies": {
"typescript": "~5.3.3"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/protobase/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export * from './logger'
export * from './Protofy'
export * from './Session'
export * from './Config'
export * from './models'
export * from './models'
export * from './templates'
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Handlebars from "handlebars"
import { getLogger } from "protobase"
import { getLogger } from "../logger"

const logger = getLogger()

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/protolib/src/bundles/apis/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const getDB = (path, req, session) => {
const result = await API.post('/adminapi/v1/templates/file?token=' + getServiceToken(), {
name: value.name + '.ts',
data: {
options: { template: `/packages/protolib/bundles/apis/templates/${template}.tpl`, variables: {
options: { template: `/packages/protolib/src/bundles/apis/templates/${template}.tpl`, variables: {
codeName: codeName,
name: computedName,
codeNameLowerCase: codeNameLowerCase,
Expand Down
2 changes: 1 addition & 1 deletion packages/protolib/src/bundles/objects/objectsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const getDB = (path, req, session) => {
const result = await API.post('/adminapi/v1/templates/file?token=' + getServiceToken(), {
name: value.name + '.ts',
data: {
options: { template: '/packages/protolib/bundles/objects/templateSchema.tpl', variables: { lowername: value.name.toLowerCase(), name: value.name.charAt(0).toUpperCase() + value.name.slice(1) }},
options: { template: '/packages/protolib/src/bundles/objects/templateSchema.tpl', variables: { lowername: value.name.toLowerCase(), name: value.name.charAt(0).toUpperCase() + value.name.slice(1) }},
path: '/packages/app/bundles/custom/objects'
}
})
Expand Down
8 changes: 4 additions & 4 deletions packages/protolib/src/bundles/pages/pagesAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ const getDB = (path, req, session) => {
// console.log('File: ' + filePath + ' already exists, not executing template')
} catch (error) {
// console.log('permissions: ', value.permissions ? JSON.stringify(value.permissions) : '[]', value.permissions)
// console.log('executing template: ', `/packages/protolib/bundles/pages/templates/${template}.tpl`)
// console.log('executing template: ', `/packages/protolib/src/bundles/pages/templates/${template}.tpl`)
const result = await API.post('/adminapi/v1/templates/file?token=' + getServiceToken(), {
name: fspath.basename(value.name + '.tsx'),
data: {
options: {
template: `/packages/protolib/bundles/pages/templates/${template}.tpl`,
template: `/packages/protolib/src/bundles/pages/templates/${template}.tpl`,
variables: {
...value,
route: route,
Expand Down Expand Up @@ -218,7 +218,7 @@ const getDB = (path, req, session) => {
name: route + '.tsx',
data: {
options: {
template: `/packages/protolib/bundles/pages/templates/nextPage.tpl`,
template: `/packages/protolib/src/bundles/pages/templates/nextPage.tpl`,
variables: {
...value,
upperName: value.name ? value.name.charAt(0).toUpperCase() + value.name.slice(1) : ''
Expand Down Expand Up @@ -257,7 +257,7 @@ const getDB = (path, req, session) => {
name: value.route + '.tsx',
data: {
options: {
template: `/packages/protolib/bundles/pages/templates/electronPage.tpl`,
template: `/packages/protolib/src/bundles/pages/templates/electronPage.tpl`,
variables: {
...value,
upperName: value.name ? value.name.charAt(0).toUpperCase() + value.name.slice(1) : ''
Expand Down
4 changes: 2 additions & 2 deletions packages/protolib/src/bundles/users/adminPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default {
lastLogin: z.string().optional().search(),
from: z.string().min(1).search().generate((obj) => 'admin').help("Interface used to create the user. Users can be created from command line or from the admin panel")
})
the user management system is located at /packages/protolib/bundles/users. The api for managing users is for admins only, and its located at /adminapi/v1/accounts. To read a specify account, /adminapi/v1/accounts/:email.
The UI of the users page is located at /packages/protolib/bundles/users/adminPages.tsx and the schema and protomodel declaration at /packages/protolib/bundles/users/usersSchema.ts. The API file is located at /packages/protolib/bundles/users/usersAPI.ts.
the user management system is located at /packages/protolib/src/bundles/users. The api for managing users is for admins only, and its located at /adminapi/v1/accounts. To read a specify account, /adminapi/v1/accounts/:email.
The UI of the users page is located at /packages/protolib/src/bundles/users/adminPages.tsx and the schema and protomodel declaration at /packages/protolib/src/bundles/users/usersSchema.ts. The API file is located at /packages/protolib/src/bundles/users/usersAPI.ts.
The user management page allows to manage the users of the system. Users are able to login with their email and password.
`+ (
initialItems?.isLoaded ? 'Currently the system returned the following information: ' + JSON.stringify(initialItems.data) : ''
Expand Down

0 comments on commit b5a4c08

Please sign in to comment.