Skip to content

Commit 7591d7d

Browse files
authored
Merge branch 'main' into env_config
2 parents 20fb24f + a1d91be commit 7591d7d

File tree

14 files changed

+498
-103
lines changed

14 files changed

+498
-103
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ env:
1919

2020
# Use these variables to force specific version of CLI/Time Skipping Server for SDK tests
2121
# TESTS_CLI_VERSION: 'v0.13.2'
22-
TESTS_CLI_VERSION: 'v1.3.1-persistence-fix.0'
2322
# TESTS_TIME_SKIPPING_SERVER_VERSION: 'v1.24.1'
2423

2524
jobs:

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ env:
1414

1515
# Use these variables to force specific version of CLI/Time Skipping Server for SDK tests
1616
# TESTS_CLI_VERSION: 'v0.13.2'
17-
TESTS_CLI_VERSION: 'v1.3.1-persistence-fix.0'
1817
# TESTS_TIME_SKIPPING_SERVER_VERSION: 'v1.24.1'
1918

2019
jobs:

packages/client/src/workflow-options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function versioningOverrideToProto(
142142
return {
143143
pinned: {
144144
version: vo.pinnedTo,
145+
behavior: temporal.api.workflow.v1.VersioningOverride.PinnedOverrideBehavior.PINNED_OVERRIDE_BEHAVIOR_PINNED,
145146
},
146147
behavior: temporal.api.enums.v1.VersioningBehavior.VERSIONING_BEHAVIOR_PINNED,
147148
pinnedVersion: toCanonicalString(vo.pinnedTo),

packages/common/src/converter/payload-converter.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,25 @@ export function mapFromPayloads<K extends string, T = unknown>(
100100
) as Record<K, T>;
101101
}
102102

103+
export declare const rawPayloadTypeBrand: unique symbol;
104+
/**
105+
* RawValue is a wrapper over a payload.
106+
* A payload that belongs to a RawValue is special in that it bypasses user-defined payload converters,
107+
* instead using the default payload converter. The payload still undergoes codec conversion.
108+
*/
109+
export class RawValue<T = unknown> {
110+
private readonly _payload: Payload;
111+
private readonly [rawPayloadTypeBrand]: T = undefined as T;
112+
113+
constructor(value: T, payloadConverter: PayloadConverter = defaultPayloadConverter) {
114+
this._payload = payloadConverter.toPayload(value);
115+
}
116+
117+
get payload(): Payload {
118+
return this._payload;
119+
}
120+
}
121+
103122
export interface PayloadConverterWithEncoding {
104123
/**
105124
* Converts a value to a {@link Payload}.
@@ -143,6 +162,9 @@ export class CompositePayloadConverter implements PayloadConverter {
143162
* Returns the first successful result, throws {@link ValueError} if there is no converter that can handle the value.
144163
*/
145164
public toPayload<T>(value: T): Payload {
165+
if (value instanceof RawValue) {
166+
return value.payload;
167+
}
146168
for (const converter of this.converters) {
147169
const result = converter.toPayload(value);
148170
if (result !== undefined) {
@@ -160,6 +182,7 @@ export class CompositePayloadConverter implements PayloadConverter {
160182
if (payload.metadata === undefined || payload.metadata === null) {
161183
throw new ValueError('Missing payload metadata');
162184
}
185+
163186
const encoding = decode(payload.metadata[METADATA_ENCODING_KEY]);
164187
const converter = this.converterByEncoding.get(encoding);
165188
if (converter === undefined) {

packages/common/src/reserved.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export const TEMPORAL_RESERVED_PREFIX = '__temporal_';
2+
export const STACK_TRACE_QUERY_NAME = '__stack_trace';
3+
export const ENHANCED_STACK_TRACE_QUERY_NAME = '__enhanced_stack_trace';
4+
5+
/**
6+
* Valid entity types that can be checked for reserved name violations
7+
*/
8+
export type ReservedNameEntityType = 'query' | 'signal' | 'update' | 'activity' | 'task queue' | 'sink' | 'workflow';
9+
10+
/**
11+
* Validates if the provided name contains any reserved prefixes or matches any reserved names.
12+
* Throws a TypeError if validation fails, with a specific message indicating whether the issue
13+
* is with a reserved prefix or an exact match to a reserved name.
14+
*
15+
* @param type The entity type being checked
16+
* @param name The name to check against reserved prefixes/names
17+
*/
18+
export function throwIfReservedName(type: ReservedNameEntityType, name: string): void {
19+
if (name.startsWith(TEMPORAL_RESERVED_PREFIX)) {
20+
throw new TypeError(`Cannot use ${type} name: '${name}', with reserved prefix: '${TEMPORAL_RESERVED_PREFIX}'`);
21+
}
22+
23+
if (name === STACK_TRACE_QUERY_NAME || name === ENHANCED_STACK_TRACE_QUERY_NAME) {
24+
throw new TypeError(`Cannot use ${type} name: '${name}', which is a reserved name`);
25+
}
26+
}

packages/test/src/helpers.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,6 @@ export async function getRandomPort(fn = (_port: number) => Promise.resolve()):
293293
});
294294
}
295295

296-
export function asSdkLoggerSink(
297-
fn: (info: WorkflowInfo, message: string, attrs?: Record<string, unknown>) => Promise<void>,
298-
opts?: Omit<worker.InjectedSinkFunction<any>, 'fn'>
299-
): worker.InjectedSinks<DefaultLoggerSinks> {
300-
return {
301-
__temporal_logger: {
302-
trace: { fn, ...opts },
303-
debug: { fn, ...opts },
304-
info: { fn, ...opts },
305-
warn: { fn, ...opts },
306-
error: { fn, ...opts },
307-
},
308-
};
309-
}
310-
311296
export async function loadHistory(fname: string): Promise<iface.temporal.api.history.v1.History> {
312297
const isJson = fname.endsWith('json');
313298
const fpath = path.resolve(__dirname, `../history_files/${fname}`);

0 commit comments

Comments
 (0)