Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
9c84205633 | |||
a71d5f1bde | |||
e19a5b6195 | |||
02d204e606 | |||
7d9d023d6b | |||
07a3df944a | |||
0c0a35bc90 | |||
d346ca5237 | |||
a2c366392c | |||
e3d80f78fb |
31
changelog.md
Normal file
31
changelog.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-10-02 - 1.0.7 - fix(core)
|
||||
Update dependencies and add logging for email and SMS functions
|
||||
|
||||
- Updated devDependencies and dependencies in package.json
|
||||
- Added logger import and logging statements in classes.emailconnector.ts and classes.smsconnector.ts
|
||||
- Fixed formatting issues in test/test.ts
|
||||
- Cleaned up and removed unused imports in index.ts and plugins.ts
|
||||
|
||||
## 2024-07-26 - 1.0.6 - fix(core)
|
||||
Update @types/node dependency version
|
||||
|
||||
- Dependencies updated: @types/node updated from ^20.14.11 to ^20.14.12
|
||||
|
||||
## 2024-07-23 - 1.0.5 - fix(dependencies)
|
||||
Updated dependencies to latest versions and removed unused service server class
|
||||
|
||||
- Updated devDependencies and dependencies to their latest versions in package.json
|
||||
- Removed the unused ServiceServer class
|
||||
- Updated index.ts to reflect changes in imports
|
||||
|
||||
## 2024-05-11 - 1.0.3 to 1.0.4 - General Updates
|
||||
Maintenance updates
|
||||
|
||||
- Fix(core): update
|
||||
|
||||
## 2024-02-17 - 1.0.1 to 1.0.3 - General Updates
|
||||
Maintenance updates
|
||||
|
||||
- Fix(core): update
|
22
package.json
22
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@serve.zone/platformclient",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.7",
|
||||
"private": false,
|
||||
"description": "a module that makes it really easy to use the serve.zone platform inside your app",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -14,21 +14,21 @@
|
||||
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.25",
|
||||
"@git.zone/tsbuild": "^2.1.84",
|
||||
"@git.zone/tsbundle": "^2.0.5",
|
||||
"@git.zone/tsrun": "^1.2.46",
|
||||
"@git.zone/tstest": "^1.0.44",
|
||||
"@push.rocks/tapbundle": "^5.0.15",
|
||||
"@types/node": "^20.11.19"
|
||||
"@git.zone/tsrun": "^1.2.49",
|
||||
"@git.zone/tstest": "^1.0.90",
|
||||
"@push.rocks/tapbundle": "^5.3.0",
|
||||
"@types/node": "^22.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@api.global/typedrequest": "^3.0.4",
|
||||
"@api.global/typedserver": "^3.0.20",
|
||||
"@api.global/typedsocket": "^3.0.0",
|
||||
"@api.global/typedrequest": "^3.0.32",
|
||||
"@api.global/typedserver": "^3.0.51",
|
||||
"@api.global/typedsocket": "^3.0.1",
|
||||
"@push.rocks/qenv": "^6.0.5",
|
||||
"@push.rocks/smartlog": "^3.0.3",
|
||||
"@push.rocks/smartlog": "^3.0.7",
|
||||
"@push.rocks/smartntml": "^2.0.4",
|
||||
"@serve.zone/interfaces": "^1.0.35"
|
||||
"@serve.zone/interfaces": "^1.0.81"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
8473
pnpm-lock.yaml
generated
8473
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
@ -1,8 +1,8 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import * as platformclient from '../ts/index.js'
|
||||
import * as platformclient from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(platformclient)
|
||||
})
|
||||
console.log(platformclient);
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@serve.zone/platformclient',
|
||||
version: '1.0.2',
|
||||
version: '1.0.7',
|
||||
description: 'a module that makes it really easy to use the serve.zone platform inside your app'
|
||||
}
|
||||
|
@ -11,11 +11,14 @@ export class SzPlatformClient {
|
||||
public emailConnector = new SzEmailConnector(this);
|
||||
public smsConnector = new SzSmsConnector(this);
|
||||
|
||||
constructor(authorizationStringArg: string) {
|
||||
constructor(authorizationStringArg?: string) {
|
||||
this.authorizationString = authorizationStringArg;
|
||||
}
|
||||
|
||||
public async init() {
|
||||
public async init(authorizationStringArg?: string) {
|
||||
if (authorizationStringArg) this.authorizationString = authorizationStringArg;
|
||||
if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION;
|
||||
if (!this.authorizationString) throw new Error('authorizationString is required');
|
||||
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(this.typedrouter, await this.getConnectionAddress());
|
||||
}
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { InfoHtml } from './infohtml/index.js';
|
||||
|
||||
export interface IServiceServerConstructorOptions {
|
||||
addCustomRoutes?: (serverArg: plugins.typedserver.servertools.Server) => Promise<any>;
|
||||
serviceName: string;
|
||||
serviceVersion: string;
|
||||
serviceDomain: string;
|
||||
port?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* a server for serving your app to the outside world
|
||||
*/
|
||||
export class ServiceServer {
|
||||
public options: IServiceServerConstructorOptions;
|
||||
public typedServer: plugins.typedserver.TypedServer;
|
||||
|
||||
constructor(optionsArg: IServiceServerConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
public async start() {
|
||||
console.log('starting lole-serviceserver...')
|
||||
this.typedServer = new plugins.typedserver.TypedServer({
|
||||
cors: true,
|
||||
domain: this.options.serviceDomain,
|
||||
forceSsl: false,
|
||||
port: this.options.port || 3000,
|
||||
robots: true,
|
||||
defaultAnswer: async () => {
|
||||
return (
|
||||
await InfoHtml.fromSimpleText(
|
||||
`${this.options.serviceName} (version ${this.options.serviceVersion})`
|
||||
)
|
||||
).htmlString;
|
||||
},
|
||||
});
|
||||
|
||||
// lets add any custom routes
|
||||
if (this.options.addCustomRoutes) {
|
||||
await this.options.addCustomRoutes(this.typedServer.server);
|
||||
}
|
||||
|
||||
await this.typedServer.start();
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
await this.typedServer.stop();
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import type { SzPlatformClient } from '../classes.platformclient.js';
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
import { logger } from '../logger.js';
|
||||
|
||||
export class SzEmailConnector {
|
||||
public platformClientRef: SzPlatformClient;
|
||||
|
||||
@ -16,6 +18,15 @@ export class SzEmailConnector {
|
||||
'sendEmail'
|
||||
);
|
||||
const response = await typedRequest.fire(optionsArg);
|
||||
|
||||
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
|
||||
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
|
||||
body:
|
||||
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
|
||||
|
||||
`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async sendNotification(optionsArg: { toArg: string; subject: string; text: string }) {}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { SzPlatformClient } from '../classes.platformclient.js';
|
||||
import { logger } from '../logger.js';
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export class SzSmsConnector {
|
||||
@ -13,6 +14,16 @@ export class SzSmsConnector {
|
||||
'sendSms'
|
||||
);
|
||||
const response = await typedrequest.fire(messageArg);
|
||||
|
||||
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
|
||||
logger.log('info', `sent sms to ${messageArg.toNumber}}
|
||||
body:
|
||||
${messageArg.messageText.split('\n').map(line => ` ${line}`).join('\n')}
|
||||
|
||||
`);
|
||||
}
|
||||
|
||||
|
||||
return response.status;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1 @@
|
||||
export * from './classes.serviceserver.js';
|
||||
|
||||
// Things for building a server
|
||||
import { servertools } from '@api.global/typedserver';
|
||||
const { Handler, HandlerTypedRouter } = servertools;
|
||||
export { Handler, HandlerTypedRouter };
|
||||
|
||||
export * from './classes.platformclient.js';
|
||||
|
@ -7,3 +7,5 @@ export const logger = new plugins.smartlog.Smartlog({
|
||||
zone: 'serve.zone',
|
||||
}
|
||||
});
|
||||
|
||||
logger.enableConsole();
|
@ -8,12 +8,10 @@ export {
|
||||
// @push.rocks scope
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartntml from '@push.rocks/smartntml';
|
||||
|
||||
export {
|
||||
qenv,
|
||||
smartlog,
|
||||
smartntml,
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user