@trayio/cdk-runtime 5.22.0-unstable → 5.22.1-unstable

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
40
40
  const { client, registerCalls } = createFakePollingServiceClient();
41
41
  const handlerFunction = jest.fn();
42
42
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(handlerFunction);
43
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records_poll', client);
43
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records', client);
44
44
  const input = {
45
45
  pollingInterval: { value: 15, unit: PollingTypes_1.PollingIntervalUnit.Minutes },
46
46
  maxFailureCount: 50,
@@ -54,7 +54,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
54
54
  expect(payload).toEqual({
55
55
  connectorName: 'salesforce',
56
56
  connectorVersion: '7.2.0',
57
- registeredHandlerName: 'new_records_poll',
57
+ registeredHandlerName: 'new_records',
58
58
  authenticationId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
59
59
  organizationId: 'org-uuid',
60
60
  workspaceId: 'ws-uuid',
@@ -73,7 +73,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
73
73
  const { client, deregisterCalls } = createFakePollingServiceClient();
74
74
  const handlerFunction = jest.fn();
75
75
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(handlerFunction);
76
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollDestroy, 'new_records_poll_destroy', client);
76
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollDestroy, 'new_records_destroy', client);
77
77
  const result = await execution.execute(fakePollingContext(), {});
78
78
  expect(result.isSuccess).toBe(true);
79
79
  expect(handlerFunction).not.toHaveBeenCalled();
@@ -82,7 +82,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
82
82
  expect(payload).toEqual({
83
83
  connectorName: 'salesforce',
84
84
  connectorVersion: '7.2.0',
85
- registeredHandlerName: 'new_records_poll_destroy',
85
+ registeredHandlerName: 'new_records_destroy',
86
86
  publicUrl: 'https://trigger.example.test/tab-123',
87
87
  preserveCursor: true,
88
88
  });
@@ -91,7 +91,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
91
91
  it('surfaces a consolidated failure listing every missing ctx field on register', async () => {
92
92
  const { client, registerCalls } = createFakePollingServiceClient();
93
93
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(jest.fn());
94
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records_poll', client);
94
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records', client);
95
95
  const result = await execution.execute({}, {});
96
96
  expect(registerCalls).toHaveLength(0);
97
97
  expect(result.isFailure).toBe(true);
@@ -104,7 +104,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
104
104
  it('fails register when the auth/org/workspace/project ctx fields are missing', async () => {
105
105
  const { client, registerCalls } = createFakePollingServiceClient();
106
106
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(jest.fn());
107
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records_poll', client);
107
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records', client);
108
108
  // Base polling ctx is present, but the identity fields the PS register
109
109
  // payload requires are not.
110
110
  const incompleteCtx = {
@@ -125,7 +125,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
125
125
  it('deregister does NOT require the register-only ctx fields', async () => {
126
126
  const { client, deregisterCalls } = createFakePollingServiceClient();
127
127
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(jest.fn());
128
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollDestroy, 'new_records_poll_destroy', client);
128
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollDestroy, 'new_records_destroy', client);
129
129
  // Only the base four ctx fields; auth / org / workspace / project absent.
130
130
  const destroyOnlyCtx = {
131
131
  connectorName: 'x',
@@ -143,7 +143,7 @@ describe('CompositeOperationExecution polling lifecycle branch', () => {
143
143
  deregister: jest.fn(),
144
144
  };
145
145
  const handler = new CompositeOperationHandler_1.CompositeOperationHandler(jest.fn());
146
- const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records_poll', client);
146
+ const execution = new CompositeOperationExecution_1.CompositeOperationExecution(noopHandlerInvocationFactory, handler, OperationHandler_1.OperationHandlerType.TriggerPollCreate, 'new_records', client);
147
147
  const result = await execution.execute(fakePollingContext(), {});
148
148
  expect(result.isFailure).toBe(true);
149
149
  const message = result._tag === 'Failure' ? result.error.message : '';
@@ -3,12 +3,7 @@ import { PollingInterval } from '@trayio/cdk-dsl/connector/operation/PollingType
3
3
  export type PollingServiceRegisterPayload = {
4
4
  connectorName: string;
5
5
  connectorVersion: string;
6
- /**
7
- * The registered handler name (e.g. `"new_records_poll"`). The client
8
- * normalizes to the canonical `_poll`-suffixed form before sending.
9
- */
10
6
  registeredHandlerName: string;
11
- /** Platform identity that the Polling Service keys the registration against. */
12
7
  authenticationId: string;
13
8
  organizationId: string;
14
9
  workspaceId: string;
@@ -22,8 +17,9 @@ export type PollingServiceDeregisterPayload = {
22
17
  connectorName: string;
23
18
  connectorVersion: string;
24
19
  /**
25
- * The registered handler name (e.g. `"new_records_poll_destroy"`). The
26
- * client normalizes to the canonical `_poll`-suffixed form before sending.
20
+ * The registered handler name (e.g. `"new_records_destroy"`). The client
21
+ * normalizes destroy handler names to the canonical create name before
22
+ * sending.
27
23
  */
28
24
  registeredHandlerName: string;
29
25
  publicUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PollingServiceClient.d.ts","sourceRoot":"","sources":["../../../src/connector/polling/PollingServiceClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAGN,eAAe,EAEf,MAAM,kDAAkD,CAAC;AA0B1D,MAAM,MAAM,6BAA6B,GAAG;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;CACxB,CAAC;AA4BF;;;;GAIG;AACH,qBAAa,oBAAoB;IACpB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEpC,QAAQ,CACb,OAAO,EAAE,6BAA6B,EACtC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC;IAwBV,UAAU,CACf,OAAO,EAAE,+BAA+B,EACxC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC;YAaF,QAAQ;CAgCtB"}
1
+ {"version":3,"file":"PollingServiceClient.d.ts","sourceRoot":"","sources":["../../../src/connector/polling/PollingServiceClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAGN,eAAe,EAEf,MAAM,kDAAkD,CAAC;AAuB1D,MAAM,MAAM,6BAA6B,GAAG;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;CACxB,CAAC;AA4BF;;;;GAIG;AACH,qBAAa,oBAAoB;IACpB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEpC,QAAQ,CACb,OAAO,EAAE,6BAA6B,EACtC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC;IAwBV,UAAU,CACf,OAAO,EAAE,+BAA+B,EACxC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC;YAaF,QAAQ;CAgCtB"}
@@ -31,16 +31,16 @@ const PollingTypes_1 = require("@trayio/cdk-dsl/connector/operation/PollingTypes
31
31
  const POLLING_SERVICE_URL_ENV = 'TRAY_POLLING_SERVICE_URL';
32
32
  const EXECUTION_TOKEN_HEADER = 'X-Tray-Execution-Token';
33
33
  const TRIGGERS_REGISTER_PATH = '/triggers/register';
34
- const POLL_SUFFIX = '_poll';
35
- const POLL_DESTROY_SUFFIX = '_poll_destroy';
34
+ const POLL_DESTROY_SUFFIX = '_destroy';
36
35
  /**
37
- * PS keys register+deregister against the canonical `_poll`-suffixed
38
- * operation name. `_poll_destroy` handlers rewrite to the matching `_poll`
39
- * name so both sides of the lifecycle target the same PS record.
36
+ * PS keys register+deregister against the canonical polling trigger operation
37
+ * name (the TriggerPollCreate handler name). Destroy handlers rewrite to the
38
+ * matching create name so both sides of the lifecycle target the same PS
39
+ * record.
40
40
  */
41
41
  const toCanonicalPollOperationName = (registeredHandlerName) => {
42
42
  if (registeredHandlerName.endsWith(POLL_DESTROY_SUFFIX)) {
43
- return `${registeredHandlerName.slice(0, -POLL_DESTROY_SUFFIX.length)}${POLL_SUFFIX}`;
43
+ return registeredHandlerName.slice(0, -POLL_DESTROY_SUFFIX.length);
44
44
  }
45
45
  return registeredHandlerName;
46
46
  };
@@ -54,7 +54,7 @@ const createMockHttpClient = (capture) => ({
54
54
  const minimalRegister = (overrides = {}) => ({
55
55
  connectorName: 'x',
56
56
  connectorVersion: '1.0.0',
57
- registeredHandlerName: 'x_poll',
57
+ registeredHandlerName: 'x',
58
58
  authenticationId: 'auth-uuid',
59
59
  organizationId: 'org-id',
60
60
  workspaceId: 'ws-id',
@@ -83,7 +83,7 @@ describe('PollingServiceClient', () => {
83
83
  await client.register({
84
84
  connectorName: 'salesforce',
85
85
  connectorVersion: '7.2.0',
86
- registeredHandlerName: 'new_records_poll',
86
+ registeredHandlerName: 'new_records',
87
87
  authenticationId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
88
88
  organizationId: 'org-uuid',
89
89
  workspaceId: 'ws-uuid',
@@ -107,7 +107,7 @@ describe('PollingServiceClient', () => {
107
107
  expect(call.body).toEqual({
108
108
  connectorName: 'salesforce',
109
109
  connectorVersion: '7.2.0',
110
- operationName: 'new_records_poll',
110
+ operationName: 'new_records',
111
111
  authenticationId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
112
112
  organizationId: 'org-uuid',
113
113
  workspaceId: 'ws-uuid',
@@ -182,7 +182,7 @@ describe('PollingServiceClient', () => {
182
182
  await client.deregister({
183
183
  connectorName: 'salesforce',
184
184
  connectorVersion: '7.2.0',
185
- registeredHandlerName: 'new_records_poll_destroy',
185
+ registeredHandlerName: 'new_records_destroy',
186
186
  publicUrl: 'https://trigger.example.test/abc',
187
187
  preserveCursor: true,
188
188
  }, 'exec-jwt-token');
@@ -196,22 +196,22 @@ describe('PollingServiceClient', () => {
196
196
  expect(call.body).toEqual({
197
197
  connectorName: 'salesforce',
198
198
  connectorVersion: '7.2.0',
199
- operationName: 'new_records_poll',
199
+ operationName: 'new_records',
200
200
  publicUrl: 'https://trigger.example.test/abc',
201
201
  preserveCursor: true,
202
202
  });
203
203
  });
204
- it('leaves an already-canonical _poll name unchanged', async () => {
204
+ it('leaves an already-canonical name unchanged', async () => {
205
205
  const captured = [];
206
206
  const client = new PollingServiceClient_1.PollingServiceClient(createMockHttpClient(captured));
207
207
  await client.deregister({
208
208
  connectorName: 'x',
209
209
  connectorVersion: '1.0.0',
210
- registeredHandlerName: 'x_poll',
210
+ registeredHandlerName: 'x',
211
211
  publicUrl: 'u',
212
212
  preserveCursor: false,
213
213
  }, 'tok');
214
- expect(captured[0].body.operationName).toBe('x_poll');
214
+ expect(captured[0].body.operationName).toBe('x');
215
215
  expect(captured[0].body.preserveCursor).toBe(false);
216
216
  });
217
217
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-runtime",
3
- "version": "5.22.0-unstable",
3
+ "version": "5.22.1-unstable",
4
4
  "description": "A Runtime that executes connector operations defined using the CDK DSL",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -14,10 +14,10 @@
14
14
  "node": ">=18.x"
15
15
  },
16
16
  "dependencies": {
17
- "@trayio/axios": "5.22.0-unstable",
18
- "@trayio/cdk-dsl": "5.22.0-unstable",
19
- "@trayio/express": "5.22.0-unstable",
20
- "@trayio/winston": "5.22.0-unstable",
17
+ "@trayio/axios": "5.22.1-unstable",
18
+ "@trayio/cdk-dsl": "5.22.1-unstable",
19
+ "@trayio/express": "5.22.1-unstable",
20
+ "@trayio/winston": "5.22.1-unstable",
21
21
  "mime": "3.0.0",
22
22
  "uuid": "9.0.0"
23
23
  },