@dbos-inc/dbos-sdk 0.8.30-preview → 0.8.32-preview
Sign up to get free protection for your applications and to get access to all the features.
- 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 +64 -0
- package/dist/src/cloud-cli/applications/configure.js.map +1 -0
- package/dist/src/cloud-cli/applications/deploy-app-code.js +7 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
- package/dist/src/cloud-cli/cli.js +0 -0
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -1
- package/dist/src/cloud-cli/userdb.js +3 -2
- package/dist/src/cloud-cli/userdb.js.map +1 -1
- 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/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/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/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/telemetry/signals.d.ts +20 -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/examples/hello/.eslintignore +4 -0
- package/examples/hello/.eslintrc +19 -0
- package/examples/hello/knexfile.ts +1 -1
- package/examples/hello/package.json +5 -2
- package/examples/hello/src/operations.ts +2 -2
- package/examples/hello/tsconfig.json +2 -2
- package/package.json +2 -2
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.DiagnosticsCollector = exports.logDiagnostics = exports.diagResult = exports.createDiagnostic = void 0;
|
27
|
+
const ts = __importStar(require("typescript"));
|
28
|
+
const printer = ts.createPrinter();
|
29
|
+
function createDiagnostic(messageText, options) {
|
30
|
+
const node = options?.node;
|
31
|
+
const category = options?.category ?? ts.DiagnosticCategory.Error;
|
32
|
+
const code = options?.code ?? 0;
|
33
|
+
return {
|
34
|
+
category,
|
35
|
+
code,
|
36
|
+
file: node?.getSourceFile(),
|
37
|
+
length: node?.getWidth(),
|
38
|
+
messageText,
|
39
|
+
start: node?.getStart(),
|
40
|
+
source: node ? printer.printNode(ts.EmitHint.Unspecified, node, node.getSourceFile()) : undefined,
|
41
|
+
};
|
42
|
+
}
|
43
|
+
exports.createDiagnostic = createDiagnostic;
|
44
|
+
function diagResult(value, diags) {
|
45
|
+
return diags.some(e => e.category === ts.DiagnosticCategory.Error) ? undefined : value;
|
46
|
+
}
|
47
|
+
exports.diagResult = diagResult;
|
48
|
+
function logDiagnostics(diags) {
|
49
|
+
if (diags.length > 0) {
|
50
|
+
const formatHost = {
|
51
|
+
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
52
|
+
getNewLine: () => ts.sys.newLine,
|
53
|
+
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames
|
54
|
+
? fileName : fileName.toLowerCase()
|
55
|
+
};
|
56
|
+
const text = ts.formatDiagnosticsWithColorAndContext(diags, formatHost);
|
57
|
+
console.log(text);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
exports.logDiagnostics = logDiagnostics;
|
61
|
+
class DiagnosticsCollector {
|
62
|
+
#diags = new Array();
|
63
|
+
get diags() { return this.#diags; }
|
64
|
+
raise(message, node) {
|
65
|
+
this.#diags.push(createDiagnostic(message, { node }));
|
66
|
+
}
|
67
|
+
warn(message, node) {
|
68
|
+
this.#diags.push(createDiagnostic(message, { node, category: ts.DiagnosticCategory.Warning }));
|
69
|
+
}
|
70
|
+
}
|
71
|
+
exports.DiagnosticsCollector = DiagnosticsCollector;
|
72
|
+
//# sourceMappingURL=tsDiagUtil.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tsDiagUtil.js","sourceRoot":"","sources":["../../../src/dbos-runtime/tsDiagUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;AAQnC,SAAgB,gBAAgB,CAAC,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QAAQ,CAAC,WAAW,EAAE;SACtC,CAAA;QAED,MAAM,IAAI,GAAG,EAAE,CAAC,oCAAoC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACxE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAZD,wCAYC;AAED,MAAa,oBAAoB;IACtB,MAAM,GAAG,IAAI,KAAK,EAAiB,CAAC;IAC7C,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAkC,CAAC,CAAC,CAAC;IAE/D,KAAK,CAAC,OAAe,EAAE,IAAc;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,IAAc;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC;CACF;AAXD,oDAWC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { Client } from "pg";
|
3
|
+
import { TelemetryCollector } from "../telemetry/collector";
|
4
|
+
import { DBOSConfig } from "../dbos-executor";
|
5
|
+
/**
|
6
|
+
* A class implementing a daemon which collects and exports provenance information,
|
7
|
+
* specifically a record of all INSERTs, UPDATEs, and DELETEs in the target database.
|
8
|
+
* Only one daemon is needed per database. The daemon need not run in the same process as workflow runtime.
|
9
|
+
* The daemon has three requirements and will fail to launch if any is not met:
|
10
|
+
*
|
11
|
+
* 1. The database must be configured with wal_level=logical.
|
12
|
+
* 2. An open replication slot must be available.
|
13
|
+
* 3. The wal2json Postgres plugin must be installed. It is installed by default on most cloud databases, including RDS.
|
14
|
+
*
|
15
|
+
* Because the daemon depends on Postgres logical replication, it can only export information on updates and deletes in tables
|
16
|
+
* whose rows are uniquely identifiable, either because the table has a primary key or a replica identity.
|
17
|
+
*/
|
18
|
+
export declare class ProvenanceDaemon {
|
19
|
+
readonly slotName: string;
|
20
|
+
readonly client: Client;
|
21
|
+
readonly daemonID: NodeJS.Timeout;
|
22
|
+
readonly recordProvenanceIntervalMs = 1000;
|
23
|
+
readonly telemetryCollector: TelemetryCollector;
|
24
|
+
initialized: boolean;
|
25
|
+
/**
|
26
|
+
* @param dbosConfig An DBOS config defining exporters and database connection information.
|
27
|
+
* @param slotName The name of a logical replication slot. This slot is persistent and must be deleted if the daemon is no longer to be used.
|
28
|
+
*/
|
29
|
+
constructor(dbosConfig: DBOSConfig, slotName: string);
|
30
|
+
start(): Promise<void>;
|
31
|
+
recordProvenance(): Promise<void>;
|
32
|
+
stop(): Promise<void>;
|
33
|
+
}
|
34
|
+
//# sourceMappingURL=provenance_daemon.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"provenance_daemon.d.ts","sourceRoot":"","sources":["../../../src/provenance/provenance_daemon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAiB,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqB9C;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAWS,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAV7D,QAAQ,CAAC,MAAM,SAAC;IAChB,QAAQ,CAAC,QAAQ,iBAAC;IAClB,QAAQ,CAAC,0BAA0B,QAAQ;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,WAAW,UAAS;IAEpB;;;OAGG;gBACS,UAAU,EAAE,UAAU,EAAW,QAAQ,EAAE,MAAM;IASvD,KAAK;IAkBL,gBAAgB;IAqBhB,IAAI;CAKX"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ProvenanceDaemon = void 0;
|
4
|
+
const pg_1 = require("pg");
|
5
|
+
const exporters_1 = require("../telemetry/exporters");
|
6
|
+
const collector_1 = require("../telemetry/collector");
|
7
|
+
/**
|
8
|
+
* A class implementing a daemon which collects and exports provenance information,
|
9
|
+
* specifically a record of all INSERTs, UPDATEs, and DELETEs in the target database.
|
10
|
+
* Only one daemon is needed per database. The daemon need not run in the same process as workflow runtime.
|
11
|
+
* The daemon has three requirements and will fail to launch if any is not met:
|
12
|
+
*
|
13
|
+
* 1. The database must be configured with wal_level=logical.
|
14
|
+
* 2. An open replication slot must be available.
|
15
|
+
* 3. The wal2json Postgres plugin must be installed. It is installed by default on most cloud databases, including RDS.
|
16
|
+
*
|
17
|
+
* Because the daemon depends on Postgres logical replication, it can only export information on updates and deletes in tables
|
18
|
+
* whose rows are uniquely identifiable, either because the table has a primary key or a replica identity.
|
19
|
+
*/
|
20
|
+
class ProvenanceDaemon {
|
21
|
+
slotName;
|
22
|
+
client;
|
23
|
+
daemonID;
|
24
|
+
recordProvenanceIntervalMs = 1000;
|
25
|
+
telemetryCollector;
|
26
|
+
initialized = false;
|
27
|
+
/**
|
28
|
+
* @param dbosConfig An DBOS config defining exporters and database connection information.
|
29
|
+
* @param slotName The name of a logical replication slot. This slot is persistent and must be deleted if the daemon is no longer to be used.
|
30
|
+
*/
|
31
|
+
constructor(dbosConfig, slotName) {
|
32
|
+
this.slotName = slotName;
|
33
|
+
this.client = new pg_1.Client(dbosConfig.poolConfig);
|
34
|
+
this.daemonID = setInterval(() => {
|
35
|
+
void this.recordProvenance();
|
36
|
+
}, this.recordProvenanceIntervalMs);
|
37
|
+
const telemetryExporters = [new exporters_1.PostgresExporter(dbosConfig.poolConfig, dbosConfig?.observability_database)];
|
38
|
+
this.telemetryCollector = new collector_1.TelemetryCollector(telemetryExporters);
|
39
|
+
}
|
40
|
+
async start() {
|
41
|
+
await this.client.connect();
|
42
|
+
// Create a logical replication slot with the given name.
|
43
|
+
try { // TODO: Make this robust to daemon crashes, so records are not consumed until they've been exported.
|
44
|
+
await this.client.query("SELECT pg_create_logical_replication_slot($1, 'wal2json');", [this.slotName]);
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
const err = error;
|
48
|
+
if (err.code === "42710") {
|
49
|
+
// The slot has already been created.
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
console.error(err);
|
53
|
+
throw err;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
await this.telemetryCollector.init();
|
57
|
+
this.initialized = true;
|
58
|
+
}
|
59
|
+
async recordProvenance() {
|
60
|
+
if (this.initialized) {
|
61
|
+
const { rows } = await this.client.query("SELECT CAST(xid AS TEXT), data FROM pg_logical_slot_get_changes($1, NULL, NULL, 'filter-tables', 'dbos.*')", [this.slotName]);
|
62
|
+
for (const row of rows) {
|
63
|
+
const data = JSON.parse(row.data).change;
|
64
|
+
for (const change of data) {
|
65
|
+
const signal = {
|
66
|
+
provTransactionID: row.xid,
|
67
|
+
kind: change.kind,
|
68
|
+
schema: change.schema,
|
69
|
+
table: change.table,
|
70
|
+
columnnames: change.columnnames,
|
71
|
+
columntypes: change.columntypes,
|
72
|
+
columnvalues: change.columnvalues
|
73
|
+
};
|
74
|
+
this.telemetryCollector.push(signal);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
async stop() {
|
80
|
+
clearInterval(this.daemonID);
|
81
|
+
await this.client.end();
|
82
|
+
await this.telemetryCollector.destroy();
|
83
|
+
}
|
84
|
+
}
|
85
|
+
exports.ProvenanceDaemon = ProvenanceDaemon;
|
86
|
+
//# sourceMappingURL=provenance_daemon.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"provenance_daemon.js","sourceRoot":"","sources":["../../../src/provenance/provenance_daemon.ts"],"names":[],"mappings":";;;AAAA,2BAA2C;AAC3C,sDAA0D;AAC1D,sDAA4D;AAsB5D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IAC1B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAc,4GAA4G,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrL,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACtB,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAkB,CAAC,MAAM,CAAC;gBAC3D,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE;oBACzB,MAAM,MAAM,GAAqB;wBAC/B,iBAAiB,EAAE,GAAG,CAAC,GAAG;wBAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;qBAClC,CAAA;oBACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBACtC;aACF;SACF;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAC1C,CAAC;CACF;AAhED,4CAgEC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { ReadableSpan } from "@opentelemetry/sdk-trace-base";
|
2
|
+
import { ValuesOf } from "../utils";
|
3
|
+
export declare const LogSeverity: {
|
4
|
+
readonly Debug: "DEBUG";
|
5
|
+
readonly Info: "INFO";
|
6
|
+
readonly Warn: "WARN";
|
7
|
+
readonly Error: "ERROR";
|
8
|
+
readonly Log: "LOG";
|
9
|
+
};
|
10
|
+
export type LogSeverity = ValuesOf<typeof LogSeverity>;
|
11
|
+
export interface TelemetrySignal {
|
12
|
+
workflowUUID: string;
|
13
|
+
operationName: string;
|
14
|
+
runAs: string;
|
15
|
+
timestamp: number;
|
16
|
+
transactionID?: string;
|
17
|
+
traceID?: string;
|
18
|
+
traceSpan?: ReadableSpan;
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=signals.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../src/telemetry/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.LogSeverity = void 0;
|
4
|
+
exports.LogSeverity = {
|
5
|
+
Debug: "DEBUG",
|
6
|
+
Info: "INFO",
|
7
|
+
Warn: "WARN",
|
8
|
+
Error: "ERROR",
|
9
|
+
Log: "LOG",
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=signals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../src/telemetry/signals.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAG;IACzB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;CACF,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"root": true,
|
3
|
+
"extends": [
|
4
|
+
"plugin:@dbos-inc/dbosRecommendedConfig"
|
5
|
+
],
|
6
|
+
"plugins": [
|
7
|
+
"@dbos-inc"
|
8
|
+
],
|
9
|
+
"env": {
|
10
|
+
"node": true,
|
11
|
+
"es6": true
|
12
|
+
},
|
13
|
+
"rules": {
|
14
|
+
},
|
15
|
+
"parser": "@typescript-eslint/parser",
|
16
|
+
"parserOptions": {
|
17
|
+
"project": "./tsconfig.json"
|
18
|
+
}
|
19
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// knexfile.ts
|
2
2
|
|
3
3
|
import { Knex } from 'knex';
|
4
|
-
import { parseConfigFile } from '@dbos-inc/dbos-sdk/dist/src/dbos-runtime/config'
|
4
|
+
import { parseConfigFile } from '@dbos-inc/dbos-sdk/dist/src/dbos-runtime/config';
|
5
5
|
import { DBOSConfig } from '@dbos-inc/dbos-sdk/dist/src/dbos-executor';
|
6
6
|
|
7
7
|
const [dbosConfig, ]: [DBOSConfig, unknown] = parseConfigFile();
|
@@ -3,12 +3,15 @@
|
|
3
3
|
"version": "0.0.1",
|
4
4
|
"scripts": {
|
5
5
|
"build": "tsc",
|
6
|
-
"test": "npx knex migrate:rollback && npx knex migrate:up && jest"
|
6
|
+
"test": "npx knex migrate:rollback && npx knex migrate:up && jest",
|
7
|
+
"lint": "eslint src",
|
8
|
+
"lint-fix": "eslint --fix src"
|
7
9
|
},
|
8
10
|
"devDependencies": {
|
11
|
+
"@dbos-inc/eslint-plugin": "^0.0.4",
|
9
12
|
"@types/jest": "^29.5.5",
|
10
13
|
"@types/supertest": "^2.0.14",
|
11
|
-
"
|
14
|
+
"eslint": "^8.56.0",
|
12
15
|
"jest": "^29.7.0",
|
13
16
|
"supertest": "^6.3.3",
|
14
17
|
"ts-jest": "^29.1.1",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk'
|
1
|
+
import { TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk';
|
2
2
|
import { Knex } from 'knex';
|
3
3
|
|
4
4
|
// The schema of the database table used in this example.
|
@@ -13,7 +13,7 @@ export class Hello {
|
|
13
13
|
@Transaction() // Run this function as a database transaction
|
14
14
|
static async helloTransaction(ctxt: TransactionContext<Knex>, @ArgSource(ArgSources.URL) user: string) {
|
15
15
|
// Retrieve and increment the number of times this user has been greeted.
|
16
|
-
const query = "INSERT INTO dbos_hello (name, greet_count) VALUES (?, 1) ON CONFLICT (name) DO UPDATE SET greet_count = dbos_hello.greet_count + 1 RETURNING greet_count;"
|
16
|
+
const query = "INSERT INTO dbos_hello (name, greet_count) VALUES (?, 1) ON CONFLICT (name) DO UPDATE SET greet_count = dbos_hello.greet_count + 1 RETURNING greet_count;";
|
17
17
|
const { rows } = await ctxt.client.raw(query, [user]) as { rows: dbos_hello[] };
|
18
18
|
const greet_count = rows[0].greet_count;
|
19
19
|
return `Hello, ${user}! You have been greeted ${greet_count} times.\n`;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dbos-inc/dbos-sdk",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.32-preview",
|
4
4
|
"description": "A Typescript framework built on the database",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"devDependencies": {
|
27
27
|
"@prisma/client": "^5.3.1",
|
28
28
|
"@types/jest": "^29.5.3",
|
29
|
-
"@types/koa__cors": "^
|
29
|
+
"@types/koa__cors": "^5.0.0",
|
30
30
|
"@types/koa__router": "^12.0.0",
|
31
31
|
"@types/koa-logger": "^3.1.2",
|
32
32
|
"@types/node": "^20.6.3",
|