Skip to content

Commit 0cf66f0

Browse files
fixes
1 parent 0959a00 commit 0cf66f0

4 files changed

Lines changed: 57 additions & 31 deletions

File tree

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
export { CodedActionAppsService as CodedActionApps, CodedActionAppsService} from './coded-action-apps-service';
1+
// Side-effect import: bootstraps the CAA package's TelemetryClient
2+
// before any service is constructed. Kept explicit (rather than relying
3+
// on `coded-action-apps-service.ts` transitively importing `track` from
4+
// `./telemetry`) so initialization survives any future refactor of the
5+
// service file's imports.
6+
import './telemetry';
7+
8+
export { CodedActionAppsService as CodedActionApps, CodedActionAppsService } from './coded-action-apps-service';
29
export * from './coded-action-apps.models';
310
export * from './types';

packages/telemetry/tests/track.test.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ function multiply(a: number, b: number): number {
3434
return a * b;
3535
}
3636

37-
function namedFn(): void {}
37+
// Empty body — fixture only exists so the wrapper can read its `name` and
38+
// fall back to it (`'namedFn'`) for telemetry attribution.
39+
function namedFn(): void {
40+
/* fixture: intentionally empty */
41+
}
3842

39-
const anonFn = function () {};
43+
// Empty body — fixture only exists so the wrapper can detect the missing
44+
// `name` and fall back to `'unknown_function'`.
45+
const anonFn = function () {
46+
/* fixture: intentionally empty */
47+
};
4048
Object.defineProperty(anonFn, 'name', { value: '' });
4149

4250
describe('createTrack — method decorator', () => {
@@ -84,7 +92,9 @@ describe('createTrack — method decorator', () => {
8492

8593
class Service {
8694
@track('Tasks.Create', { attributes: { Source: 'unit-test' } })
87-
public create(): void {}
95+
public create(): void {
96+
/* fixture: only the decorator side effect matters */
97+
}
8898
}
8999

90100
new Service().create();
@@ -121,7 +131,9 @@ describe('createTrack — method decorator', () => {
121131
// public `TrackOptions.condition` signature; the callback
122132
// sees the runtime args as expected.
123133
@track('Tasks.Create', { condition: condition as unknown as (...args: unknown[]) => boolean })
124-
public create(_value: number): void {}
134+
public create(_value: number): void {
135+
/* fixture: only the decorator side effect matters */
136+
}
125137
}
126138

127139
const svc = new Service();
@@ -139,7 +151,9 @@ describe('createTrack — method decorator', () => {
139151

140152
class Service {
141153
@track('Tasks.Create')
142-
public create(): void {}
154+
public create(): void {
155+
/* fixture: only the decorator side effect matters */
156+
}
143157
}
144158

145159
const svc = new Service();
@@ -176,7 +190,9 @@ describe('createTrack — method decorator', () => {
176190

177191
class Service {
178192
@track('Tasks.Create')
179-
public create(): void {}
193+
public create(): void {
194+
/* fixture: only the decorator side effect matters */
195+
}
180196
}
181197

182198
new Service().create();

src/core/telemetry/constants.ts

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
/**
2-
* SDK Telemetry constants
2+
* SDK Telemetry constants.
33
*
4-
* The Application Insights connection string is no longer carried here —
5-
* it is injected into `@uipath/telemetry` itself at publish time. Only the
6-
* SDK's identity (version, service name, role name, …) lives here.
4+
* Only the SDK's identity (version, service name, role name, …) lives
5+
* here. The Application Insights connection string is injected into
6+
* `@uipath/telemetry` itself at publish time, and the generic attribute
7+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
8+
* `@uipath/telemetry` and re-exported from the shim in `index.ts`.
79
*/
810

9-
// SDK Version placeholder — patched by the SDK publish workflow.
10-
export const SDK_VERSION = "$SDK_VERSION";
11+
/** SDK version placeholder — patched by the SDK publish workflow. */
12+
export const SDK_VERSION = '$SDK_VERSION';
1113

12-
export const VERSION = "Version";
13-
export const SERVICE = "Service";
14-
export const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
15-
export const CLOUD_TENANT_NAME = "CloudTenantName";
16-
export const CLOUD_URL = "CloudUrl";
17-
export const CLOUD_CLIENT_ID = "CloudClientId";
18-
export const CLOUD_REDIRECT_URI = "CloudRedirectUri";
19-
export const APP_NAME = "ApplicationName";
20-
export const CLOUD_ROLE_NAME = "uipath-ts-sdk";
14+
export const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
15+
export const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
16+
export const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
2117

22-
// Service and logger names
23-
export const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
24-
export const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
25-
26-
// Event names
27-
export const SDK_RUN_EVENT = "Sdk.Run";
28-
29-
// Default value for unknown/empty attributes
30-
export const UNKNOWN = "";
18+
export const SDK_RUN_EVENT = 'Sdk.Run';

src/core/telemetry/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ export type {
4444
TelemetryContext as TelemetryConfig,
4545
TrackOptions,
4646
} from '@uipath/telemetry';
47+
48+
// Generic attribute-key constants live in `@uipath/telemetry` (single
49+
// source of truth). Re-exported here so the public
50+
// `@uipath/uipath-typescript/core` API surface stays unchanged.
51+
export {
52+
APP_NAME,
53+
CLOUD_CLIENT_ID,
54+
CLOUD_ORGANIZATION_NAME,
55+
CLOUD_REDIRECT_URI,
56+
CLOUD_TENANT_NAME,
57+
CLOUD_URL,
58+
SERVICE,
59+
UNKNOWN,
60+
VERSION,
61+
} from '@uipath/telemetry';
4762
export * from './constants';
4863

4964
/**

0 commit comments

Comments
 (0)