Skip to content
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ jobs:
run: >
npm update
@temporalio/activity @temporalio/client @temporalio/common
@temporalio/external-storage-gcs @temporalio/external-storage-gcs-google-sdk
@temporalio/external-storage-s3 @temporalio/external-storage-s3-aws-sdk
@temporalio/plugin @temporalio/proto @temporalio/worker @temporalio/workflow
- run: npm run build
- run: npm run lint
Expand Down
1 change: 0 additions & 1 deletion features/data_converter/binary_protobuf/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const g = globalThis as any;
g.Uint8Array = g.constructor.constructor('return globalThis.Uint8Array')();

const expectedResult = proto.temporal.api.common.v1.DataBlob.create({
encodingType: proto.temporal.api.enums.v1.EncodingType.ENCODING_TYPE_UNSPECIFIED,
data: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),
});

Expand Down
1 change: 0 additions & 1 deletion features/data_converter/json_protobuf/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const g = globalThis as any;
g.Buffer = g.constructor.constructor('return globalThis.Buffer')();

const expectedResult = proto.temporal.api.common.v1.DataBlob.create({
encodingType: proto.temporal.api.enums.v1.EncodingType.ENCODING_TYPE_UNSPECIFIED,
data: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// @@@SNIPSTART typescript-gcs-driver-create
import { Storage } from '@google-cloud/storage';
import { GcsStorageDriver } from '@temporalio/external-storage-gcs';
import { GoogleCloudGcsStorageDriverClient } from '@temporalio/external-storage-gcs-google-sdk';

const storage = new Storage();

const driver = new GcsStorageDriver({
client: new GoogleCloudGcsStorageDriverClient(storage),
bucket: 'my-temporal-payloads',
});
// @@@SNIPEND
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { S3Client } from '@aws-sdk/client-s3';
import { ExternalStorage, type StorageDriver } from '@temporalio/common';
import { S3StorageDriver } from '@temporalio/external-storage-s3';
import { AwsSdkS3StorageDriverClient } from '@temporalio/external-storage-s3-aws-sdk';
/* eslint-disable @typescript-eslint/no-unused-vars */

declare const s3Client: S3Client;
declare const LegacyStorageDriver: new () => StorageDriver;

{
// @@@SNIPSTART typescript-external-storage-multiple-drivers
const preferredDriver = new S3StorageDriver({
client: new AwsSdkS3StorageDriverClient(s3Client),
bucket: 'my-bucket',
});
const legacyDriver = new LegacyStorageDriver();

const externalStorage = new ExternalStorage({
drivers: [preferredDriver, legacyDriver],
driverSelector: () => preferredDriver,
});
// @@@SNIPEND
}
13 changes: 13 additions & 0 deletions features/snippets/external_storage/s3_setup/s3_driver_create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// @@@SNIPSTART typescript-s3-driver-create
import { S3Client } from '@aws-sdk/client-s3';
import { S3StorageDriver } from '@temporalio/external-storage-s3';
import { AwsSdkS3StorageDriverClient } from '@temporalio/external-storage-s3-aws-sdk';

const s3Client = new S3Client({ region: 'us-east-2' });

const driver = new S3StorageDriver({
client: new AwsSdkS3StorageDriverClient(s3Client),
bucket: 'my-temporal-payloads',
});
// @@@SNIPEND
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// @@@SNIPSTART typescript-s3-external-storage-setup
import { Client, Connection } from '@temporalio/client';
import { ExternalStorage } from '@temporalio/common';
import { Worker } from '@temporalio/worker';

async function createClientAndWorker() {
const dataConverter = {
externalStorage: new ExternalStorage({ drivers: [driver] }),
};

const connection = await Connection.connect();
const client = new Client({ connection, dataConverter });

const worker = await Worker.create({
workflowsPath: require.resolve('./workflows'),
taskQueue: 'my-task-queue',
dataConverter,
});
}
// @@@SNIPEND

declare const driver: import('@temporalio/common').StorageDriver;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ExternalStorage, type StorageDriver } from '@temporalio/common';
/* eslint-disable @typescript-eslint/no-unused-vars */

declare const driver: StorageDriver;

{
// @@@SNIPSTART typescript-external-storage-threshold
const dataConverter = {
externalStorage: new ExternalStorage({
drivers: [driver],
payloadSizeThreshold: 0,
}),
};
// @@@SNIPEND
}
Loading
Loading