@dbos-inc/dbos-sdk 0.7.18-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dbos-config.schema.json +121 -0
- package/dbos-test-config.yaml +16 -0
- package/dist/schemas/system_db_schema.d.ts +34 -0
- package/dist/schemas/system_db_schema.d.ts.map +1 -0
- package/dist/schemas/system_db_schema.js +75 -0
- package/dist/schemas/system_db_schema.js.map +1 -0
- package/dist/schemas/user_db_schema.d.ts +11 -0
- package/dist/schemas/user_db_schema.d.ts.map +1 -0
- package/dist/schemas/user_db_schema.js +16 -0
- package/dist/schemas/user_db_schema.js.map +1 -0
- package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
- package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/configure.js +57 -0
- package/dist/src/cloud-cli/applications/configure.js.map +1 -0
- package/dist/src/cloud-cli/applications/delete-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/delete-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/delete-app.js +36 -0
- package/dist/src/cloud-cli/applications/delete-app.js.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts +2 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js +64 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -0
- package/dist/src/cloud-cli/applications/get-app-logs.d.ts +2 -0
- package/dist/src/cloud-cli/applications/get-app-logs.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/get-app-logs.js +37 -0
- package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -0
- package/dist/src/cloud-cli/applications/index.d.ts +8 -0
- package/dist/src/cloud-cli/applications/index.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/index.js +18 -0
- package/dist/src/cloud-cli/applications/index.js.map +1 -0
- package/dist/src/cloud-cli/applications/list-apps.d.ts +2 -0
- package/dist/src/cloud-cli/applications/list-apps.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/list-apps.js +45 -0
- package/dist/src/cloud-cli/applications/list-apps.js.map +1 -0
- package/dist/src/cloud-cli/applications/register-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/register-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/register-app.js +41 -0
- package/dist/src/cloud-cli/applications/register-app.js.map +1 -0
- package/dist/src/cloud-cli/applications/types.d.ts +7 -0
- package/dist/src/cloud-cli/applications/types.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/types.js +3 -0
- package/dist/src/cloud-cli/applications/types.js.map +1 -0
- package/dist/src/cloud-cli/applications/update-app.d.ts +2 -0
- package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -0
- package/dist/src/cloud-cli/applications/update-app.js +42 -0
- package/dist/src/cloud-cli/applications/update-app.js.map +1 -0
- package/dist/src/cloud-cli/cli.d.ts +3 -0
- package/dist/src/cloud-cli/cli.d.ts.map +1 -0
- package/dist/src/cloud-cli/cli.js +148 -0
- package/dist/src/cloud-cli/cli.js.map +1 -0
- package/dist/src/cloud-cli/login.d.ts +7 -0
- package/dist/src/cloud-cli/login.d.ts.map +1 -0
- package/dist/src/cloud-cli/login.js +40 -0
- package/dist/src/cloud-cli/login.js.map +1 -0
- package/dist/src/cloud-cli/register.d.ts +2 -0
- package/dist/src/cloud-cli/register.d.ts.map +1 -0
- package/dist/src/cloud-cli/register.js +35 -0
- package/dist/src/cloud-cli/register.js.map +1 -0
- package/dist/src/cloud-cli/userdb.d.ts +4 -0
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -0
- package/dist/src/cloud-cli/userdb.js +149 -0
- package/dist/src/cloud-cli/userdb.js.map +1 -0
- package/dist/src/cloud-cli/utils.d.ts +3 -0
- package/dist/src/cloud-cli/utils.d.ts.map +1 -0
- package/dist/src/cloud-cli/utils.js +17 -0
- package/dist/src/cloud-cli/utils.js.map +1 -0
- package/dist/src/communicator.d.ts +24 -0
- package/dist/src/communicator.d.ts.map +1 -0
- package/dist/src/communicator.js +26 -0
- package/dist/src/communicator.js.map +1 -0
- package/dist/src/context.d.ts +60 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +94 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/data_validation.d.ts +3 -0
- package/dist/src/data_validation.d.ts.map +1 -0
- package/dist/src/data_validation.js +168 -0
- package/dist/src/data_validation.js.map +1 -0
- package/dist/src/dbos-executor.d.ts +79 -0
- package/dist/src/dbos-executor.d.ts.map +1 -0
- package/dist/src/dbos-executor.js +408 -0
- package/dist/src/dbos-executor.js.map +1 -0
- package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
- package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
- package/dist/src/dbos-runtime/TypeParser.js +104 -0
- package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
- package/dist/src/dbos-runtime/applicationVersion.d.ts +3 -0
- package/dist/src/dbos-runtime/applicationVersion.d.ts.map +1 -0
- package/dist/src/dbos-runtime/applicationVersion.js +13 -0
- package/dist/src/dbos-runtime/applicationVersion.js.map +1 -0
- package/dist/src/dbos-runtime/cli.d.ts +8 -0
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -0
- package/dist/src/dbos-runtime/cli.js +52 -0
- package/dist/src/dbos-runtime/cli.js.map +1 -0
- package/dist/src/dbos-runtime/config.d.ts +28 -0
- package/dist/src/dbos-runtime/config.d.ts.map +1 -0
- package/dist/src/dbos-runtime/config.js +111 -0
- package/dist/src/dbos-runtime/config.js.map +1 -0
- package/dist/src/dbos-runtime/init.d.ts +7 -0
- package/dist/src/dbos-runtime/init.d.ts.map +1 -0
- package/dist/src/dbos-runtime/init.js +51 -0
- package/dist/src/dbos-runtime/init.js.map +1 -0
- package/dist/src/dbos-runtime/openApi.d.ts +35 -0
- package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
- package/dist/src/dbos-runtime/openApi.js +595 -0
- package/dist/src/dbos-runtime/openApi.js.map +1 -0
- package/dist/src/dbos-runtime/runtime.d.ts +28 -0
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -0
- package/dist/src/dbos-runtime/runtime.js +96 -0
- package/dist/src/dbos-runtime/runtime.js.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
- package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
- package/dist/src/decorators.d.ts +118 -0
- package/dist/src/decorators.d.ts.map +1 -0
- package/dist/src/decorators.js +467 -0
- package/dist/src/decorators.js.map +1 -0
- package/dist/src/error.d.ts +44 -0
- package/dist/src/error.d.ts.map +1 -0
- package/dist/src/error.js +164 -0
- package/dist/src/error.js.map +1 -0
- package/dist/src/httpServer/handler.d.ts +62 -0
- package/dist/src/httpServer/handler.d.ts.map +1 -0
- package/dist/src/httpServer/handler.js +168 -0
- package/dist/src/httpServer/handler.js.map +1 -0
- package/dist/src/httpServer/middleware.d.ts +56 -0
- package/dist/src/httpServer/middleware.d.ts.map +1 -0
- package/dist/src/httpServer/middleware.js +57 -0
- package/dist/src/httpServer/middleware.js.map +1 -0
- package/dist/src/httpServer/server.d.ts +40 -0
- package/dist/src/httpServer/server.d.ts.map +1 -0
- package/dist/src/httpServer/server.js +231 -0
- package/dist/src/httpServer/server.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +75 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/provenance/provenance_daemon.d.ts +34 -0
- package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
- package/dist/src/provenance/provenance_daemon.js +86 -0
- package/dist/src/provenance/provenance_daemon.js.map +1 -0
- package/dist/src/system_database.d.ts +69 -0
- package/dist/src/system_database.d.ts.map +1 -0
- package/dist/src/system_database.js +384 -0
- package/dist/src/system_database.js.map +1 -0
- package/dist/src/telemetry/collector.d.ts +17 -0
- package/dist/src/telemetry/collector.d.ts.map +1 -0
- package/dist/src/telemetry/collector.js +77 -0
- package/dist/src/telemetry/collector.js.map +1 -0
- package/dist/src/telemetry/exporters.d.ts +29 -0
- package/dist/src/telemetry/exporters.d.ts.map +1 -0
- package/dist/src/telemetry/exporters.js +186 -0
- package/dist/src/telemetry/exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +7 -0
- package/dist/src/telemetry/index.d.ts.map +1 -0
- package/dist/src/telemetry/index.js +3 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/logs.d.ts +25 -0
- package/dist/src/telemetry/logs.d.ts.map +1 -0
- package/dist/src/telemetry/logs.js +91 -0
- package/dist/src/telemetry/logs.js.map +1 -0
- package/dist/src/telemetry/signals.d.ts +30 -0
- package/dist/src/telemetry/signals.d.ts.map +1 -0
- package/dist/src/telemetry/signals.js +11 -0
- package/dist/src/telemetry/signals.js.map +1 -0
- package/dist/src/telemetry/traces.d.ts +17 -0
- package/dist/src/telemetry/traces.d.ts.map +1 -0
- package/dist/src/telemetry/traces.js +76 -0
- package/dist/src/telemetry/traces.js.map +1 -0
- package/dist/src/testing/testing_runtime.d.ts +76 -0
- package/dist/src/testing/testing_runtime.d.ts.map +1 -0
- package/dist/src/testing/testing_runtime.js +147 -0
- package/dist/src/testing/testing_runtime.js.map +1 -0
- package/dist/src/transaction.d.ts +28 -0
- package/dist/src/transaction.d.ts.map +1 -0
- package/dist/src/transaction.js +27 -0
- package/dist/src/transaction.js.map +1 -0
- package/dist/src/user_database.d.ts +132 -0
- package/dist/src/user_database.d.ts.map +1 -0
- package/dist/src/user_database.js +324 -0
- package/dist/src/user_database.js.map +1 -0
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +35 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/src/workflow.d.ts +179 -0
- package/dist/src/workflow.d.ts.map +1 -0
- package/dist/src/workflow.js +446 -0
- package/dist/src/workflow.js.map +1 -0
- package/examples/hello/README.md +41 -0
- package/examples/hello/dbos-config.yaml +15 -0
- package/examples/hello/jest.config.js +8 -0
- package/examples/hello/knexfile.ts +23 -0
- package/examples/hello/migrations/create_dbos_hello_tables.ts +12 -0
- package/examples/hello/package.json +21 -0
- package/examples/hello/src/operations.test.ts +38 -0
- package/examples/hello/src/operations.ts +21 -0
- package/examples/hello/start_postgres_docker.sh +23 -0
- package/examples/hello/tsconfig.json +24 -0
- package/package.json +78 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Check if PGPASSWORD is set
|
4
|
+
if [[ -z "${PGPASSWORD}" ]]; then
|
5
|
+
echo "Error: PGPASSWORD is not set." >&2
|
6
|
+
exit 1
|
7
|
+
fi
|
8
|
+
|
9
|
+
# Start Postgres in a local Docker container
|
10
|
+
docker run --rm --name=dbos-db --env=POSTGRES_PASSWORD=${PGPASSWORD} --env=PGDATA=/var/lib/postgresql/data --volume=/var/lib/postgresql/data -p 5432:5432 -d postgres:15.4
|
11
|
+
|
12
|
+
# Wait for PostgreSQL to start
|
13
|
+
echo "Waiting for PostgreSQL to start..."
|
14
|
+
for i in {1..30}; do
|
15
|
+
if docker exec dbos-db pg_isready -U postgres | grep -q "accepting connections"; then
|
16
|
+
echo "PostgreSQL started!"
|
17
|
+
break
|
18
|
+
fi
|
19
|
+
sleep 1
|
20
|
+
done
|
21
|
+
|
22
|
+
# Create a database in Postgres.
|
23
|
+
docker exec dbos-db psql -U postgres -c "CREATE DATABASE hello;"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
2
|
+
{
|
3
|
+
"compilerOptions": {
|
4
|
+
"target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
5
|
+
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
6
|
+
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
7
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
8
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
9
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
10
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
11
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
12
|
+
"newLine": "lf", /* Set the newline character for emitting files. */
|
13
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
14
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
15
|
+
"strict": true, /* Enable all strict type-checking options. */
|
16
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
17
|
+
},
|
18
|
+
"include": [ /* Specifies an array of filenames or patterns to include in the program. */
|
19
|
+
"src",
|
20
|
+
],
|
21
|
+
"exclude": [
|
22
|
+
"**/*.test.ts"
|
23
|
+
]
|
24
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"name": "@dbos-inc/dbos-sdk",
|
3
|
+
"version": "0.7.18-preview",
|
4
|
+
"description": "A Typescript framework built on the database",
|
5
|
+
"license": "MIT",
|
6
|
+
"repository": {
|
7
|
+
"type": "git",
|
8
|
+
"url": "https://github.com/dbos-inc/dbos-ts"
|
9
|
+
},
|
10
|
+
"homepage": "https://docs.dbos.dev/",
|
11
|
+
"main": "dist/src/index.js",
|
12
|
+
"types": "dist/src/index.d.ts",
|
13
|
+
"scripts": {
|
14
|
+
"build": "tsc --project tsconfig.build.json && chmod +x ./dist/src/dbos-runtime/cli.js",
|
15
|
+
"build-fdb": "tsc --project tsconfig.build-fdb.json && chmod +x ./dist/src/dbos-runtime/cli.js",
|
16
|
+
"lint": "eslint --fix --ext .ts --ignore-pattern foundationdb/ .",
|
17
|
+
"lint-fdb": "eslint --fix --ext .ts .",
|
18
|
+
"setversion": "grunt setversion",
|
19
|
+
"test": "npx prisma generate --schema tests/prisma/schema.prisma && npm run build && jest --coverage --collectCoverageFrom='src/**/*' --collectCoverageFrom='!src/foundationdb/**/*' --detectOpenHandles --testPathIgnorePatterns=examples/* --testPathIgnorePatterns=tests/foundationdb/* --testPathIgnorePatterns=tests/provenance/*",
|
20
|
+
"test-fdb": "npx prisma generate --schema tests/prisma/schema.prisma && npm run build-fdb && jest --runInBand --coverage"
|
21
|
+
},
|
22
|
+
"bin": {
|
23
|
+
"dbos": "./dist/src/dbos-runtime/cli.js",
|
24
|
+
"dbos-cloud": "./dist/src/cloud-cli/cli.js"
|
25
|
+
},
|
26
|
+
"devDependencies": {
|
27
|
+
"@prisma/client": "^5.3.1",
|
28
|
+
"@types/jest": "^29.5.3",
|
29
|
+
"@types/koa__cors": "^4.0.0",
|
30
|
+
"@types/koa__router": "^12.0.0",
|
31
|
+
"@types/koa-logger": "^3.1.2",
|
32
|
+
"@types/node": "^20.6.3",
|
33
|
+
"@types/supertest": "^2.0.12",
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
35
|
+
"@typescript-eslint/parser": "^6.7.2",
|
36
|
+
"eslint": "^8.49.0",
|
37
|
+
"grunt": "^1.6.1",
|
38
|
+
"jest": "^29.6.1",
|
39
|
+
"nerdbank-gitversioning": "^3.6.133",
|
40
|
+
"prisma": "^5.1.1",
|
41
|
+
"supertest": "^6.3.3",
|
42
|
+
"ts-jest": "^29.1.1",
|
43
|
+
"typeorm": "^0.3.17"
|
44
|
+
},
|
45
|
+
"dependencies": {
|
46
|
+
"@koa/bodyparser": "^5.0.0",
|
47
|
+
"@koa/cors": "^4.0.0",
|
48
|
+
"@koa/router": "^12.0.0",
|
49
|
+
"@opentelemetry/api": "^1.4.1",
|
50
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.41.2",
|
51
|
+
"@opentelemetry/sdk-trace-base": "^1.15.2",
|
52
|
+
"@types/koa": "^2.13.8",
|
53
|
+
"@types/lodash": "^4.14.197",
|
54
|
+
"@types/pg": "^8.10.2",
|
55
|
+
"@types/uuid": "^9.0.2",
|
56
|
+
"axios": "^1.6.0",
|
57
|
+
"commander": "^11.0.0",
|
58
|
+
"fast-glob": "^3.3.1",
|
59
|
+
"form-data": "^4.0.0",
|
60
|
+
"jwt-simple": "^0.5.6",
|
61
|
+
"knex": "^3.0.1",
|
62
|
+
"koa": "^2.14.2",
|
63
|
+
"koa-logger": "^3.2.1",
|
64
|
+
"lodash": "^4.17.21",
|
65
|
+
"openapi-types": "^12.1.3",
|
66
|
+
"pg": "^8.11.1",
|
67
|
+
"reflect-metadata": "^0.1.13",
|
68
|
+
"serialize-error": "8.1.0",
|
69
|
+
"ts-json-schema-generator": "^1.4.0",
|
70
|
+
"typescript": "^5.2.2",
|
71
|
+
"uuid": "^9.0.0",
|
72
|
+
"winston": "^3.10.0",
|
73
|
+
"yaml": "^2.3.1"
|
74
|
+
},
|
75
|
+
"optionalDependencies": {
|
76
|
+
"foundationdb": "^2.0.1"
|
77
|
+
}
|
78
|
+
}
|