@dbos-inc/dbos-sdk 1.0.2 → 1.1.9-preview.gb854acef85

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,19 +1,40 @@
1
- # DBOS Typescript SDK
1
+ # DBOS TypeScript SDK
2
2
 
3
- The DBOS SDK (from [DBOS, Inc.](https://dbos.dev)) is a **transactional serverless Typescript framework.**
4
- DBOS fully embraces the power of your application database, helping you write backend applications that are reliable by default.
5
- It runs your Typescript functions as database transactions, guarantees they run "once and only once" for each request, and orchestrates them into workflows so reliable that if your service is interrupted, they resume exactly where they left off.
3
+ DBOS is a **transactional serverless** SDK and platform that helps you develop and deploy database-backed TypeScript applications.
4
+ You develop your applications in TypeScript and PostgreSQL with this SDK, test them locally, then deploy them to DBOS Cloud in minutes.
6
5
 
7
6
  You want to build your next database-backed application with DBOS because:
8
7
 
9
- - **It's simple**. Write your business logic using serverless functions, test them locally, and deploy them to [DBOS Cloud](https://docs.dbos.dev/getting-started/quickstart-cloud) with the push of a button. Store all your data in Postgres—we'll manage the connections and transactions for you.
10
- - **It's reliable by default**. If your workflows are interrupted for any reason, they [will always resume from where they left off](https://docs.dbos.dev/tutorials/workflow-tutorial#reliability-guarantees). Reliable message delivery is [built in](https://docs.dbos.dev//tutorials/workflow-communication-tutorial#reliability-guarantees-1). Idempotency is [built in](https://docs.dbos.dev/tutorials/idempotency-tutorial).
11
- - **It makes debugging easy**. With our [time travel debugger](https://docs.dbos.dev/cloud-tutorials/timetravel-debugging), you can "rewind time" and replay any DBOS Cloud trace locally on your computer, exactly as it originally happened. Whatever the issue is, we'll help you reproduce it.
8
+ - **It's simple**. Write your business logic using serverless functions, test them locally, and deploy them to [DBOS Cloud](https://docs.dbos.dev/getting-started/quickstart-cloud) in minutes. Store all your data in Postgres—we'll manage the connections and transactions for you.
9
+ - **It's reliable by default**. If your workflows are interrupted for any reason, they [will always resume from where they left off](https://docs.dbos.dev/tutorials/workflow-tutorial#reliability-guarantees). Reliable message delivery is [built in](https://docs.dbos.dev/tutorials/workflow-communication-tutorial#reliability-guarantees-1). Idempotency is [built in](https://docs.dbos.dev/tutorials/idempotency-tutorial).
10
+ - **It makes debugging easy**. With our [time travel debugger](https://docs.dbos.dev/cloud-tutorials/timetravel-debugging), you can "rewind time" and replay any DBOS Cloud trace locally on your computer, exactly as it originally happened.
12
11
 
13
12
  ## Getting Started
14
13
 
15
14
  The fastest way to get started with DBOS is by following the [quickstart](https://docs.dbos.dev/getting-started/quickstart), where you'll learn how to get a DBOS application running in less than five minutes.
16
15
 
16
+ ## Main Features
17
+
18
+ Here are some of the core features of the DBOS TypeScript SDK:
19
+
20
+ | Feature | Description
21
+ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
22
+ | [Transactions](https://docs.dbos.dev/tutorials/transaction-tutorial) | Easily and safely query your application database
23
+ | [Workflows](https://docs.dbos.dev/tutorials/workflow-tutorial) | Reliable workflow orchestration—resume your program after any failure.
24
+ | [HTTP Serving](https://docs.dbos.dev/tutorials/http-serving-tutorial) | Set up endpoints to serve requests from your application.
25
+ | [Idempotency](https://docs.dbos.dev/tutorials/idempotency-tutorial) | Automatically make any request idempotent, so your requests happen exactly once.
26
+ | [Authentication and Authorization](https://docs.dbos.dev/tutorials/authentication-authorization) | Secure your HTTP endpoints so only authorized users can access them.
27
+ | [Testing and Debugging](https://docs.dbos.dev/tutorials/testing-tutorial) | Easily write unit tests for your applications, compatible with Jest and other popular testing frameworks.
28
+
29
+ And DBOS Cloud:
30
+
31
+ | Feature | Description
32
+ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
33
+ | [Serverless App Deployment](https://docs.dbos.dev/cloud-tutorials/application-management) | Deploy apps to DBOS Cloud in minutes.
34
+ | [Time Travel Debugging](https://docs.dbos.dev/cloud-tutorials/timetravel-debugging) | Replay any DBOS Cloud trace locally on your computer.
35
+ | [Cloud Database Management](https://docs.dbos.dev/cloud-tutorials/database-management) | Provision cloud Postgres instances for your applications.
36
+ | [Built-in Observability](https://docs.dbos.dev/cloud-tutorials/monitoring-dashboard) | Built-in log capture, request tracing, and dashboards.
37
+
17
38
  ## Documentation
18
39
 
19
40
  You can find our full documentation at [https://docs.dbos.dev/](https://docs.dbos.dev/).
@@ -22,7 +43,7 @@ Check out our [Getting Started](https://docs.dbos.dev/getting-started/) for an o
22
43
 
23
44
  Our documentation has the following sections:
24
45
 
25
- - [Getting Started](https://docs.dbos.dev/getting-started/)
46
+ - [Getting Started](https://docs.dbos.dev/getting-started)
26
47
  - [DBOS SDK Tutorials](https://docs.dbos.dev/category/dbos-sdk-tutorials)
27
48
  - [DBOS Cloud Tutorials](https://docs.dbos.dev/category/dbos-cloud-tutorials)
28
49
  - [API Reference](https://docs.dbos.dev/category/reference)
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- /// <reference types="@koa/bodyparser/dist/body-parser" />
3
+ /// <reference types="node/http" />
4
4
  import { Span } from "@opentelemetry/sdk-trace-base";
5
5
  import { GlobalLogger as Logger, Logger as DBOSLogger } from "./telemetry/logs";
6
6
  import { IncomingHttpHeaders } from "http";
@@ -79,7 +79,7 @@ class DBOSRuntime {
79
79
  let exports;
80
80
  if (fs.existsSync(operations)) {
81
81
  /* eslint-disable-next-line @typescript-eslint/no-var-requires */
82
- exports = (await Promise.resolve(`${operations}`).then(s => __importStar(require(s))));
82
+ exports = (await import(operations));
83
83
  }
84
84
  else {
85
85
  throw new error_1.DBOSFailLoadOperationsError(`Failed to load operations from the entrypoint ${entrypoint}`);
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/dbos-runtime/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4D;AAC5D,iDAAsD;AACtD,uCAAyB;AACzB,mCAAkC;AAClC,oCAAuD;AACvD,0DAA6B;AAa7B,MAAa,WAAW;IAM+B;IAL7C,UAAU,CAAa;IACvB,QAAQ,GAAwB,IAAI,C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AE,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,IAAA,iBAAQ,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAW,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QAClF,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;YAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;QAEI;IACJ,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;YAC9B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QAClC,CAAC;QACD,MAAM,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;CACF;AA7ED,kCA6EC"}
@@ -1,6 +1,6 @@
1
- /// <reference types="@koa/bodyparser/dist/body-parser" />
2
1
  /// <reference types="koa__router" />
3
2
  /// <reference types="node" />
3
+ /// <reference types="node/http" />
4
4
  import Koa from 'koa';
5
5
  import Router from '@koa/router';
6
6
  import { DBOSExecutor } from "../dbos-executor";
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="@koa/bodyparser/dist/body-parser" />
3
2
  /// <reference types="node" />
3
+ /// <reference types="node/http" />
4
4
  import { IncomingMessage } from "http";
5
5
  import { HTTPRequest } from "../context";
6
6
  import { InvokeFuncs } from "../httpServer/handler";