From 3527a6f5d8fe02aeecc66b26af5d488af2ae1d83 Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Thu, 7 Apr 2022 13:56:03 -0500 Subject: [PATCH] Upgrade SDK to 0.20.0 (#129) --- .../package.json | 2 +- activities-dependency-injection/package.json | 2 +- activities-examples/package.json | 2 +- activities-examples/src/test/workflow.test.ts | 4 +-- activities-sticky-queues/package.json | 2 +- child-workflows/package.json | 2 +- continue-as-new/package.json | 2 +- cron-workflows/package.json | 2 +- dsl-interpreter/package.json | 2 +- ejson/package.json | 2 +- expense/package.json | 2 +- fetch-esm/package.json | 2 +- grpc-calls/package.json | 2 +- hello-world-js/package.json | 2 +- hello-world-mtls/package.json | 2 +- hello-world-mtls/src/worker.ts | 25 +++++++++---------- hello-world/package.json | 2 +- instrumentation/package.json | 2 +- instrumentation/src/worker.ts | 8 +++--- interceptors-opentelemetry/package.json | 4 +-- interceptors-opentelemetry/src/worker.ts | 4 +-- logging-sinks/package.json | 2 +- nextjs-ecommerce-oneclick/package.json | 2 +- patching-api/package.json | 2 +- production/package.json | 2 +- protobufs/package.json | 2 +- query-subscriptions/package.json | 2 +- replay-history/package.json | 2 +- search-attributes/package.json | 2 +- signals-queries/package.json | 2 +- timer-examples/package.json | 2 +- timer-progress/package.json | 2 +- 32 files changed, 49 insertions(+), 50 deletions(-) diff --git a/activities-cancellation-heartbeating/package.json b/activities-cancellation-heartbeating/package.json index 62678567..d9a6766f 100644 --- a/activities-cancellation-heartbeating/package.json +++ b/activities-cancellation-heartbeating/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/activities-dependency-injection/package.json b/activities-dependency-injection/package.json index 7ecaff77..88d9947f 100644 --- a/activities-dependency-injection/package.json +++ b/activities-dependency-injection/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/activities-examples/package.json b/activities-examples/package.json index 25fd0690..ba38dce4 100644 --- a/activities-examples/package.json +++ b/activities-examples/package.json @@ -24,7 +24,7 @@ "dependencies": { "axios": "0.21.1", "node-fetch": "2.x", - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/activities-examples/src/test/workflow.test.ts b/activities-examples/src/test/workflow.test.ts index ca52fa3c..e57ec3e9 100644 --- a/activities-examples/src/test/workflow.test.ts +++ b/activities-examples/src/test/workflow.test.ts @@ -1,5 +1,5 @@ import { ActivityFailure, ApplicationFailure, WorkflowClient, WorkflowFailedError } from '@temporalio/client'; -import { Core, DefaultLogger, Worker } from '@temporalio/worker'; +import { Runtime, DefaultLogger, Worker } from '@temporalio/worker'; import assert from 'assert'; import axios from 'axios'; import { after, afterEach, before, describe, it } from 'mocha'; @@ -17,7 +17,7 @@ describe('example workflow', function () { before(async function () { this.timeout(10 * 1000); // Filter INFO log messages for clearer test output - await Core.install({ logger: new DefaultLogger('WARN') }); + Runtime.install({ logger: new DefaultLogger('WARN') }); const worker = await Worker.create({ taskQueue: 'test-activities', workflowsPath: require.resolve('../workflows'), diff --git a/activities-sticky-queues/package.json b/activities-sticky-queues/package.json index 7257cf33..5afd4294 100644 --- a/activities-sticky-queues/package.json +++ b/activities-sticky-queues/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/child-workflows/package.json b/child-workflows/package.json index 453c6999..766450f7 100644 --- a/child-workflows/package.json +++ b/child-workflows/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/continue-as-new/package.json b/continue-as-new/package.json index 7362d60d..112bd4b3 100644 --- a/continue-as-new/package.json +++ b/continue-as-new/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/cron-workflows/package.json b/cron-workflows/package.json index 545ab915..a531bed1 100644 --- a/cron-workflows/package.json +++ b/cron-workflows/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/dsl-interpreter/package.json b/dsl-interpreter/package.json index d0d781a6..3778c986 100644 --- a/dsl-interpreter/package.json +++ b/dsl-interpreter/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "js-yaml": "^4.1.0", - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/ejson/package.json b/ejson/package.json index 02825b61..930241e3 100644 --- a/ejson/package.json +++ b/ejson/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "ejson": "^2.2.2", - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/expense/package.json b/expense/package.json index f13c5da3..9d3d1f27 100644 --- a/expense/package.json +++ b/expense/package.json @@ -25,7 +25,7 @@ "dependencies": { "axios": "^0.21.2", "express": "~4.17.1", - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "8.3.2" }, "devDependencies": { diff --git a/fetch-esm/package.json b/fetch-esm/package.json index 73b9b517..416bdd6f 100644 --- a/fetch-esm/package.json +++ b/fetch-esm/package.json @@ -21,7 +21,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/grpc-calls/package.json b/grpc-calls/package.json index 254d3ce5..8fa7b100 100644 --- a/grpc-calls/package.json +++ b/grpc-calls/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/hello-world-js/package.json b/hello-world-js/package.json index 8d01dd36..118c9431 100644 --- a/hello-world-js/package.json +++ b/hello-world-js/package.json @@ -15,7 +15,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "eslint": "^7.32.0", diff --git a/hello-world-mtls/package.json b/hello-world-mtls/package.json index 9ef5d2c8..1bc136ea 100644 --- a/hello-world-mtls/package.json +++ b/hello-world-mtls/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/hello-world-mtls/src/worker.ts b/hello-world-mtls/src/worker.ts index d11471f6..d40c337e 100644 --- a/hello-world-mtls/src/worker.ts +++ b/hello-world-mtls/src/worker.ts @@ -1,7 +1,7 @@ import fs from 'fs'; // @@@SNIPSTART typescript-mtls-worker -import { Worker, Core } from '@temporalio/worker'; +import { Worker, NativeConnection } from '@temporalio/worker'; import * as activities from './activities'; /** @@ -22,23 +22,22 @@ async function run({ serverRootCACertificate = fs.readFileSync(serverRootCACertificatePath); } - await Core.install({ - serverOptions: { - address, - namespace, - tls: { - serverNameOverride, - serverRootCACertificate, - // See docs for other TLS options - clientCertPair: { - crt: fs.readFileSync(clientCertPath), - key: fs.readFileSync(clientKeyPath), - }, + const connection = await NativeConnection.create({ + address, + tls: { + serverNameOverride, + serverRootCACertificate, + // See docs for other TLS options + clientCertPair: { + crt: fs.readFileSync(clientCertPath), + key: fs.readFileSync(clientKeyPath), }, }, }); const worker = await Worker.create({ + connection, + namespace, workflowsPath: require.resolve('./workflows'), activities, taskQueue, diff --git a/hello-world/package.json b/hello-world/package.json index 1916466c..43233d6e 100644 --- a/hello-world/package.json +++ b/hello-world/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/instrumentation/package.json b/instrumentation/package.json index 0bda6256..d6c986f9 100644 --- a/instrumentation/package.json +++ b/instrumentation/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x", + "temporalio": "0.20.x", "triple-beam": "^1.3.0", "winston": "^3.3.3" }, diff --git a/instrumentation/src/worker.ts b/instrumentation/src/worker.ts index a6a77adb..54beed81 100644 --- a/instrumentation/src/worker.ts +++ b/instrumentation/src/worker.ts @@ -1,4 +1,4 @@ -import { Core, DefaultLogger, Worker, InjectedSinks } from '@temporalio/worker'; +import { Runtime, DefaultLogger, Worker, InjectedSinks } from '@temporalio/worker'; import { LoggerSinks } from './workflows/logger'; import * as activities from './activities'; import { ActivityInboundLogInterceptor } from './activities/interceptors'; @@ -16,8 +16,8 @@ async function main() { const activityLogger = logger.child({ label: 'activity' }); // @@@SNIPSTART typescript-core-telemetry-options - // Configure Rust Core to export SDK logs, metrics and (optionally) internal traces - await Core.install({ + // Configure Rust Core runtime to export SDK logs, metrics and (optionally) internal traces + Runtime.install({ // Install a logger to collect logs generated by Node.js Workers and Rust Core. logger: new DefaultLogger('DEBUG', (entry) => { workerLogger.log({ @@ -73,7 +73,7 @@ async function main() { }; // @@@SNIPSTART typescript-worker-full-logging-setup - // Create a worker that will use the Core instance installed above + // Create a worker that uses the Runtime instance installed above const worker = await Worker.create({ workflowsPath: require.resolve('./workflows'), activities, diff --git a/interceptors-opentelemetry/package.json b/interceptors-opentelemetry/package.json index 2a2e3a35..b94a4163 100644 --- a/interceptors-opentelemetry/package.json +++ b/interceptors-opentelemetry/package.json @@ -24,8 +24,8 @@ "@opentelemetry/resources": "^1.0.0", "@opentelemetry/sdk-node": "^0.26.0", "@opentelemetry/sdk-trace-base": "^1.0.0", - "@temporalio/interceptors-opentelemetry": "0.19.x", - "temporalio": "0.19.x" + "@temporalio/interceptors-opentelemetry": "0.20.x", + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/interceptors-opentelemetry/src/worker.ts b/interceptors-opentelemetry/src/worker.ts index d65361f5..c1b17683 100644 --- a/interceptors-opentelemetry/src/worker.ts +++ b/interceptors-opentelemetry/src/worker.ts @@ -1,4 +1,4 @@ -import { DefaultLogger, Worker, Core } from '@temporalio/worker'; +import { DefaultLogger, Worker, Runtime } from '@temporalio/worker'; import { Resource } from '@opentelemetry/resources'; import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base'; @@ -20,7 +20,7 @@ async function main() { await otel.start(); // Silence the Worker logs to better see the span output in this sample - await Core.install({ logger: new DefaultLogger('WARN') }); + Runtime.install({ logger: new DefaultLogger('WARN') }); const worker = await Worker.create({ workflowsPath: require.resolve('./workflows'), diff --git a/logging-sinks/package.json b/logging-sinks/package.json index 7735835f..96d18e1f 100644 --- a/logging-sinks/package.json +++ b/logging-sinks/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/nextjs-ecommerce-oneclick/package.json b/nextjs-ecommerce-oneclick/package.json index a38d0af5..70a61d70 100644 --- a/nextjs-ecommerce-oneclick/package.json +++ b/nextjs-ecommerce-oneclick/package.json @@ -22,7 +22,7 @@ "react-dom": "^17.0.2", "react-toastify": "^8.0.3", "swr": "^1.0.1", - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/patching-api/package.json b/patching-api/package.json index 476d93cd..98f28234 100644 --- a/patching-api/package.json +++ b/patching-api/package.json @@ -23,7 +23,7 @@ "axios": "0.21.1", "eslint": "7", "node-fetch": "2.x", - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/production/package.json b/production/package.json index 0391bace..3900f49c 100644 --- a/production/package.json +++ b/production/package.json @@ -21,7 +21,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/protobufs/package.json b/protobufs/package.json index 09c20323..7b60637f 100644 --- a/protobufs/package.json +++ b/protobufs/package.json @@ -23,7 +23,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x", + "temporalio": "0.20.x", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/query-subscriptions/package.json b/query-subscriptions/package.json index d401f722..792c03ba 100644 --- a/query-subscriptions/package.json +++ b/query-subscriptions/package.json @@ -22,7 +22,7 @@ "dependencies": { "immer": "^9.0.6", "ioredis": "^4.28.0", - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/replay-history/package.json b/replay-history/package.json index 73ac40bd..9eaa934f 100644 --- a/replay-history/package.json +++ b/replay-history/package.json @@ -21,7 +21,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/search-attributes/package.json b/search-attributes/package.json index 094d9262..ff406843 100644 --- a/search-attributes/package.json +++ b/search-attributes/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/signals-queries/package.json b/signals-queries/package.json index 34849562..091ea908 100644 --- a/signals-queries/package.json +++ b/signals-queries/package.json @@ -23,7 +23,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/timer-examples/package.json b/timer-examples/package.json index a4f14b74..41f2fa33 100644 --- a/timer-examples/package.json +++ b/timer-examples/package.json @@ -24,7 +24,7 @@ "dependencies": { "dotenv": "^10.0.0", "mailgun-js": "^0.22.0", - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0", diff --git a/timer-progress/package.json b/timer-progress/package.json index 590fd8f5..8bc97c49 100644 --- a/timer-progress/package.json +++ b/timer-progress/package.json @@ -20,7 +20,7 @@ ] }, "dependencies": { - "temporalio": "0.19.x" + "temporalio": "0.20.x" }, "devDependencies": { "@tsconfig/node16": "^1.0.0",