@dbos-inc/koa-serve 3.0.2-preview → 3.0.7-preview

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbos-inc/koa-serve",
3
- "version": "3.0.2-preview",
3
+ "version": "3.0.7-preview",
4
4
  "description": "DBOS HTTP Package for serving workflows with Koa",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/dboshttp.ts CHANGED
@@ -178,7 +178,7 @@ export class DBOSHTTPBase extends DBOSLifecycleCallback {
178
178
  for (const e of eps) {
179
179
  const { methodConfig, methodReg } = e;
180
180
  const httpmethod = methodConfig as DBOSHTTPMethodInfo;
181
- for (const ro of httpmethod.registrations ?? []) {
181
+ for (const ro of httpmethod?.registrations ?? []) {
182
182
  if (ro.apiURL) {
183
183
  DBOS.logger.info(' ' + ro.apiType.padEnd(6) + ' : ' + ro.apiURL);
184
184
  const roles = methodReg.getRequiredRoles();
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { DBOSKoa } from './dboskoa';
2
+
1
3
  export {
2
4
  ArgSources,
3
5
  DBOSHTTP,
@@ -12,3 +14,17 @@ export {
12
14
  } from './dboshttp';
13
15
 
14
16
  export { DBOSKoa, DBOSKoaAuthContext, DBOSKoaClassReg, DBOSKoaAuthMiddleware, DBOSKoaConfig } from './dboskoa';
17
+
18
+ // Export these as unbound functions. We know this is safe,
19
+ // and it more closely matches the existing library syntax.
20
+ // (Using the static function as a decorator, for some reason,
21
+ // is erroneously getting considered as unbound by some lint versions,
22
+ // as there are no parens following it?)
23
+ export const DefaultArgOptional = DBOSKoa.defaultArgOptional;
24
+ export const DefaultArgRequired = DBOSKoa.defaultArgRequired;
25
+ export const DefaultArgValidate = DBOSKoa.defaultArgValidate;
26
+ export const ArgDate = DBOSKoa.argDate;
27
+ export const ArgOptional = DBOSKoa.argOptional;
28
+ export const ArgRequired = DBOSKoa.argRequired;
29
+ export const ArgSource = DBOSKoa.argSource;
30
+ export const ArgVarchar = DBOSKoa.argVarchar;
@@ -26,7 +26,6 @@ describe('httpserver-argsource-tests', () => {
26
26
  DBOS.registerLifecycleCallback(dhttp);
27
27
  const _classes = [ArgTestEndpoints];
28
28
  await DBOS.launch();
29
- DBOS.setUpHandlerCallback();
30
29
  app = new Koa();
31
30
  appRouter = new Router();
32
31
  dhttp.registerWithApp(app, appRouter);
@@ -43,7 +43,6 @@ describe('httpserver-tests', () => {
43
43
  DBOS.registerLifecycleCallback(dhttp);
44
44
  const _classes = [TestEndpoints];
45
45
  await DBOS.launch();
46
- DBOS.setUpHandlerCallback();
47
46
  await DBOS.queryUserDB(`DROP TABLE IF EXISTS ${testTableName};`);
48
47
  await DBOS.queryUserDB(`CREATE TABLE IF NOT EXISTS ${testTableName} (id INT PRIMARY KEY, value TEXT);`);
49
48
  app = new Koa();