@contractspec/integration.runtime 2.9.0 → 3.0.0

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.
Files changed (65) hide show
  1. package/dist/channel/dispatcher.d.ts +37 -0
  2. package/dist/channel/dispatcher.js +130 -0
  3. package/dist/channel/dispatcher.test.d.ts +1 -0
  4. package/dist/channel/github.d.ts +47 -0
  5. package/dist/channel/github.js +58 -0
  6. package/dist/channel/github.test.d.ts +1 -0
  7. package/dist/channel/index.d.ts +14 -0
  8. package/dist/channel/index.js +1420 -0
  9. package/dist/channel/memory-store.d.ts +28 -0
  10. package/dist/channel/memory-store.js +223 -0
  11. package/dist/channel/policy.d.ts +19 -0
  12. package/dist/channel/policy.js +110 -0
  13. package/dist/channel/policy.test.d.ts +1 -0
  14. package/dist/channel/postgres-queries.d.ts +11 -0
  15. package/dist/channel/postgres-queries.js +222 -0
  16. package/dist/channel/postgres-schema.d.ts +1 -0
  17. package/dist/channel/postgres-schema.js +94 -0
  18. package/dist/channel/postgres-store.d.ts +21 -0
  19. package/dist/channel/postgres-store.js +498 -0
  20. package/dist/channel/postgres-store.test.d.ts +1 -0
  21. package/dist/channel/replay-fixtures.d.ts +8 -0
  22. package/dist/channel/replay-fixtures.js +31 -0
  23. package/dist/channel/replay.test.d.ts +1 -0
  24. package/dist/channel/service.d.ts +26 -0
  25. package/dist/channel/service.js +287 -0
  26. package/dist/channel/service.test.d.ts +1 -0
  27. package/dist/channel/slack.d.ts +42 -0
  28. package/dist/channel/slack.js +82 -0
  29. package/dist/channel/slack.test.d.ts +1 -0
  30. package/dist/channel/store.d.ts +83 -0
  31. package/dist/channel/store.js +1 -0
  32. package/dist/channel/telemetry.d.ts +17 -0
  33. package/dist/channel/telemetry.js +1 -0
  34. package/dist/channel/types.d.ts +111 -0
  35. package/dist/channel/types.js +1 -0
  36. package/dist/channel/whatsapp-meta.d.ts +55 -0
  37. package/dist/channel/whatsapp-meta.js +66 -0
  38. package/dist/channel/whatsapp-meta.test.d.ts +1 -0
  39. package/dist/channel/whatsapp-twilio.d.ts +20 -0
  40. package/dist/channel/whatsapp-twilio.js +61 -0
  41. package/dist/channel/whatsapp-twilio.test.d.ts +1 -0
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +1443 -1
  44. package/dist/node/channel/dispatcher.js +129 -0
  45. package/dist/node/channel/github.js +57 -0
  46. package/dist/node/channel/index.js +1419 -0
  47. package/dist/node/channel/memory-store.js +222 -0
  48. package/dist/node/channel/policy.js +109 -0
  49. package/dist/node/channel/postgres-queries.js +221 -0
  50. package/dist/node/channel/postgres-schema.js +93 -0
  51. package/dist/node/channel/postgres-store.js +497 -0
  52. package/dist/node/channel/replay-fixtures.js +30 -0
  53. package/dist/node/channel/service.js +286 -0
  54. package/dist/node/channel/slack.js +81 -0
  55. package/dist/node/channel/store.js +0 -0
  56. package/dist/node/channel/telemetry.js +0 -0
  57. package/dist/node/channel/types.js +0 -0
  58. package/dist/node/channel/whatsapp-meta.js +65 -0
  59. package/dist/node/channel/whatsapp-twilio.js +60 -0
  60. package/dist/node/index.js +1443 -1
  61. package/dist/node/runtime.js +26 -1
  62. package/dist/runtime.d.ts +9 -0
  63. package/dist/runtime.health.test.d.ts +1 -0
  64. package/dist/runtime.js +26 -1
  65. package/package.json +213 -6
@@ -182,6 +182,28 @@ class IntegrationCallGuard {
182
182
  return "PROVIDER_ERROR";
183
183
  }
184
184
  }
185
+ var DEFAULT_HEALTH_STRATEGY_ORDER = [
186
+ "official-api",
187
+ "official-mcp",
188
+ "aggregator-api",
189
+ "aggregator-mcp",
190
+ "unofficial"
191
+ ];
192
+ function resolveHealthStrategyOrder(options) {
193
+ const ordered = options?.strategyOrder && options.strategyOrder.length > 0 ? options.strategyOrder : [...DEFAULT_HEALTH_STRATEGY_ORDER];
194
+ if (options?.allowUnofficial) {
195
+ return [...ordered];
196
+ }
197
+ return ordered.filter((item) => item !== "unofficial");
198
+ }
199
+ function isUnofficialHealthProviderAllowed(providerKey, options) {
200
+ if (!options?.allowUnofficial)
201
+ return false;
202
+ if (!options.unofficialAllowList || options.unofficialAllowList.length === 0) {
203
+ return true;
204
+ }
205
+ return options.unofficialAllowList.includes(providerKey);
206
+ }
185
207
  function ensureConnectionReady(integration) {
186
208
  const status = integration.connection.status;
187
209
  if (status === "disconnected" || status === "error") {
@@ -202,7 +224,10 @@ function connectionStatusLabel(status) {
202
224
  }
203
225
  }
204
226
  export {
227
+ resolveHealthStrategyOrder,
228
+ isUnofficialHealthProviderAllowed,
205
229
  ensureConnectionReady,
206
230
  connectionStatusLabel,
207
- IntegrationCallGuard
231
+ IntegrationCallGuard,
232
+ DEFAULT_HEALTH_STRATEGY_ORDER
208
233
  };
package/dist/runtime.d.ts CHANGED
@@ -90,5 +90,14 @@ export declare class IntegrationCallGuard {
90
90
  private makeContext;
91
91
  private errorCodeFor;
92
92
  }
93
+ export type HealthTransportStrategy = 'official-api' | 'official-mcp' | 'aggregator-api' | 'aggregator-mcp' | 'unofficial';
94
+ export interface HealthRuntimeStrategyOptions {
95
+ strategyOrder?: HealthTransportStrategy[];
96
+ allowUnofficial?: boolean;
97
+ unofficialAllowList?: string[];
98
+ }
99
+ export declare const DEFAULT_HEALTH_STRATEGY_ORDER: readonly HealthTransportStrategy[];
100
+ export declare function resolveHealthStrategyOrder(options?: HealthRuntimeStrategyOptions): HealthTransportStrategy[];
101
+ export declare function isUnofficialHealthProviderAllowed(providerKey: string, options?: HealthRuntimeStrategyOptions): boolean;
93
102
  export declare function ensureConnectionReady(integration: ResolvedIntegration): void;
94
103
  export declare function connectionStatusLabel(status: ConnectionStatus): string;
@@ -0,0 +1 @@
1
+ export {};
package/dist/runtime.js CHANGED
@@ -183,6 +183,28 @@ class IntegrationCallGuard {
183
183
  return "PROVIDER_ERROR";
184
184
  }
185
185
  }
186
+ var DEFAULT_HEALTH_STRATEGY_ORDER = [
187
+ "official-api",
188
+ "official-mcp",
189
+ "aggregator-api",
190
+ "aggregator-mcp",
191
+ "unofficial"
192
+ ];
193
+ function resolveHealthStrategyOrder(options) {
194
+ const ordered = options?.strategyOrder && options.strategyOrder.length > 0 ? options.strategyOrder : [...DEFAULT_HEALTH_STRATEGY_ORDER];
195
+ if (options?.allowUnofficial) {
196
+ return [...ordered];
197
+ }
198
+ return ordered.filter((item) => item !== "unofficial");
199
+ }
200
+ function isUnofficialHealthProviderAllowed(providerKey, options) {
201
+ if (!options?.allowUnofficial)
202
+ return false;
203
+ if (!options.unofficialAllowList || options.unofficialAllowList.length === 0) {
204
+ return true;
205
+ }
206
+ return options.unofficialAllowList.includes(providerKey);
207
+ }
186
208
  function ensureConnectionReady(integration) {
187
209
  const status = integration.connection.status;
188
210
  if (status === "disconnected" || status === "error") {
@@ -203,7 +225,10 @@ function connectionStatusLabel(status) {
203
225
  }
204
226
  }
205
227
  export {
228
+ resolveHealthStrategyOrder,
229
+ isUnofficialHealthProviderAllowed,
206
230
  ensureConnectionReady,
207
231
  connectionStatusLabel,
208
- IntegrationCallGuard
232
+ IntegrationCallGuard,
233
+ DEFAULT_HEALTH_STRATEGY_ORDER
209
234
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/integration.runtime",
3
- "version": "2.9.0",
3
+ "version": "3.0.0",
4
4
  "description": "Runtime integration with secret management",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -31,16 +31,19 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@contractspec/lib.contracts-spec": "2.9.0",
35
- "@contractspec/lib.contracts-integrations": "2.9.0",
36
- "@contractspec/lib.logger": "2.9.0",
34
+ "@contractspec/lib.contracts-spec": "3.0.0",
35
+ "@contractspec/lib.contracts-integrations": "3.0.0",
36
+ "@contractspec/lib.logger": "3.0.0",
37
37
  "@google-cloud/secret-manager": "^6.1.1",
38
38
  "google-gax": "^5.0.0"
39
39
  },
40
+ "optionalDependencies": {
41
+ "pg": "^8.19.0"
42
+ },
40
43
  "devDependencies": {
41
- "@contractspec/tool.typescript": "2.9.0",
44
+ "@contractspec/tool.typescript": "3.0.0",
42
45
  "typescript": "^5.9.3",
43
- "@contractspec/tool.bun": "2.9.0"
46
+ "@contractspec/tool.bun": "3.0.0"
44
47
  },
45
48
  "exports": {
46
49
  ".": {
@@ -49,6 +52,108 @@
49
52
  "node": "./dist/node/index.js",
50
53
  "default": "./dist/index.js"
51
54
  },
55
+ "./channel": {
56
+ "types": "./dist/channel/index.d.ts",
57
+ "bun": "./dist/channel/index.js",
58
+ "node": "./dist/node/channel/index.js",
59
+ "default": "./dist/channel/index.js"
60
+ },
61
+ "./channel/dispatcher": {
62
+ "types": "./dist/channel/dispatcher.d.ts",
63
+ "bun": "./dist/channel/dispatcher.js",
64
+ "node": "./dist/node/channel/dispatcher.js",
65
+ "default": "./dist/channel/dispatcher.js"
66
+ },
67
+ "./channel/github": {
68
+ "types": "./dist/channel/github.d.ts",
69
+ "bun": "./dist/channel/github.js",
70
+ "node": "./dist/node/channel/github.js",
71
+ "default": "./dist/channel/github.js"
72
+ },
73
+ "./channel/index": {
74
+ "types": "./dist/channel/index.d.ts",
75
+ "bun": "./dist/channel/index.js",
76
+ "node": "./dist/node/channel/index.js",
77
+ "default": "./dist/channel/index.js"
78
+ },
79
+ "./channel/memory-store": {
80
+ "types": "./dist/channel/memory-store.d.ts",
81
+ "bun": "./dist/channel/memory-store.js",
82
+ "node": "./dist/node/channel/memory-store.js",
83
+ "default": "./dist/channel/memory-store.js"
84
+ },
85
+ "./channel/policy": {
86
+ "types": "./dist/channel/policy.d.ts",
87
+ "bun": "./dist/channel/policy.js",
88
+ "node": "./dist/node/channel/policy.js",
89
+ "default": "./dist/channel/policy.js"
90
+ },
91
+ "./channel/postgres-queries": {
92
+ "types": "./dist/channel/postgres-queries.d.ts",
93
+ "bun": "./dist/channel/postgres-queries.js",
94
+ "node": "./dist/node/channel/postgres-queries.js",
95
+ "default": "./dist/channel/postgres-queries.js"
96
+ },
97
+ "./channel/postgres-schema": {
98
+ "types": "./dist/channel/postgres-schema.d.ts",
99
+ "bun": "./dist/channel/postgres-schema.js",
100
+ "node": "./dist/node/channel/postgres-schema.js",
101
+ "default": "./dist/channel/postgres-schema.js"
102
+ },
103
+ "./channel/postgres-store": {
104
+ "types": "./dist/channel/postgres-store.d.ts",
105
+ "bun": "./dist/channel/postgres-store.js",
106
+ "node": "./dist/node/channel/postgres-store.js",
107
+ "default": "./dist/channel/postgres-store.js"
108
+ },
109
+ "./channel/replay-fixtures": {
110
+ "types": "./dist/channel/replay-fixtures.d.ts",
111
+ "bun": "./dist/channel/replay-fixtures.js",
112
+ "node": "./dist/node/channel/replay-fixtures.js",
113
+ "default": "./dist/channel/replay-fixtures.js"
114
+ },
115
+ "./channel/service": {
116
+ "types": "./dist/channel/service.d.ts",
117
+ "bun": "./dist/channel/service.js",
118
+ "node": "./dist/node/channel/service.js",
119
+ "default": "./dist/channel/service.js"
120
+ },
121
+ "./channel/slack": {
122
+ "types": "./dist/channel/slack.d.ts",
123
+ "bun": "./dist/channel/slack.js",
124
+ "node": "./dist/node/channel/slack.js",
125
+ "default": "./dist/channel/slack.js"
126
+ },
127
+ "./channel/store": {
128
+ "types": "./dist/channel/store.d.ts",
129
+ "bun": "./dist/channel/store.js",
130
+ "node": "./dist/node/channel/store.js",
131
+ "default": "./dist/channel/store.js"
132
+ },
133
+ "./channel/telemetry": {
134
+ "types": "./dist/channel/telemetry.d.ts",
135
+ "bun": "./dist/channel/telemetry.js",
136
+ "node": "./dist/node/channel/telemetry.js",
137
+ "default": "./dist/channel/telemetry.js"
138
+ },
139
+ "./channel/types": {
140
+ "types": "./dist/channel/types.d.ts",
141
+ "bun": "./dist/channel/types.js",
142
+ "node": "./dist/node/channel/types.js",
143
+ "default": "./dist/channel/types.js"
144
+ },
145
+ "./channel/whatsapp-meta": {
146
+ "types": "./dist/channel/whatsapp-meta.d.ts",
147
+ "bun": "./dist/channel/whatsapp-meta.js",
148
+ "node": "./dist/node/channel/whatsapp-meta.js",
149
+ "default": "./dist/channel/whatsapp-meta.js"
150
+ },
151
+ "./channel/whatsapp-twilio": {
152
+ "types": "./dist/channel/whatsapp-twilio.d.ts",
153
+ "bun": "./dist/channel/whatsapp-twilio.js",
154
+ "node": "./dist/node/channel/whatsapp-twilio.js",
155
+ "default": "./dist/channel/whatsapp-twilio.js"
156
+ },
52
157
  "./health": {
53
158
  "types": "./dist/health.d.ts",
54
159
  "bun": "./dist/health.js",
@@ -107,6 +212,108 @@
107
212
  "node": "./dist/node/index.js",
108
213
  "default": "./dist/index.js"
109
214
  },
215
+ "./channel": {
216
+ "types": "./dist/channel/index.d.ts",
217
+ "bun": "./dist/channel/index.js",
218
+ "node": "./dist/node/channel/index.js",
219
+ "default": "./dist/channel/index.js"
220
+ },
221
+ "./channel/dispatcher": {
222
+ "types": "./dist/channel/dispatcher.d.ts",
223
+ "bun": "./dist/channel/dispatcher.js",
224
+ "node": "./dist/node/channel/dispatcher.js",
225
+ "default": "./dist/channel/dispatcher.js"
226
+ },
227
+ "./channel/github": {
228
+ "types": "./dist/channel/github.d.ts",
229
+ "bun": "./dist/channel/github.js",
230
+ "node": "./dist/node/channel/github.js",
231
+ "default": "./dist/channel/github.js"
232
+ },
233
+ "./channel/index": {
234
+ "types": "./dist/channel/index.d.ts",
235
+ "bun": "./dist/channel/index.js",
236
+ "node": "./dist/node/channel/index.js",
237
+ "default": "./dist/channel/index.js"
238
+ },
239
+ "./channel/memory-store": {
240
+ "types": "./dist/channel/memory-store.d.ts",
241
+ "bun": "./dist/channel/memory-store.js",
242
+ "node": "./dist/node/channel/memory-store.js",
243
+ "default": "./dist/channel/memory-store.js"
244
+ },
245
+ "./channel/policy": {
246
+ "types": "./dist/channel/policy.d.ts",
247
+ "bun": "./dist/channel/policy.js",
248
+ "node": "./dist/node/channel/policy.js",
249
+ "default": "./dist/channel/policy.js"
250
+ },
251
+ "./channel/postgres-queries": {
252
+ "types": "./dist/channel/postgres-queries.d.ts",
253
+ "bun": "./dist/channel/postgres-queries.js",
254
+ "node": "./dist/node/channel/postgres-queries.js",
255
+ "default": "./dist/channel/postgres-queries.js"
256
+ },
257
+ "./channel/postgres-schema": {
258
+ "types": "./dist/channel/postgres-schema.d.ts",
259
+ "bun": "./dist/channel/postgres-schema.js",
260
+ "node": "./dist/node/channel/postgres-schema.js",
261
+ "default": "./dist/channel/postgres-schema.js"
262
+ },
263
+ "./channel/postgres-store": {
264
+ "types": "./dist/channel/postgres-store.d.ts",
265
+ "bun": "./dist/channel/postgres-store.js",
266
+ "node": "./dist/node/channel/postgres-store.js",
267
+ "default": "./dist/channel/postgres-store.js"
268
+ },
269
+ "./channel/replay-fixtures": {
270
+ "types": "./dist/channel/replay-fixtures.d.ts",
271
+ "bun": "./dist/channel/replay-fixtures.js",
272
+ "node": "./dist/node/channel/replay-fixtures.js",
273
+ "default": "./dist/channel/replay-fixtures.js"
274
+ },
275
+ "./channel/service": {
276
+ "types": "./dist/channel/service.d.ts",
277
+ "bun": "./dist/channel/service.js",
278
+ "node": "./dist/node/channel/service.js",
279
+ "default": "./dist/channel/service.js"
280
+ },
281
+ "./channel/slack": {
282
+ "types": "./dist/channel/slack.d.ts",
283
+ "bun": "./dist/channel/slack.js",
284
+ "node": "./dist/node/channel/slack.js",
285
+ "default": "./dist/channel/slack.js"
286
+ },
287
+ "./channel/store": {
288
+ "types": "./dist/channel/store.d.ts",
289
+ "bun": "./dist/channel/store.js",
290
+ "node": "./dist/node/channel/store.js",
291
+ "default": "./dist/channel/store.js"
292
+ },
293
+ "./channel/telemetry": {
294
+ "types": "./dist/channel/telemetry.d.ts",
295
+ "bun": "./dist/channel/telemetry.js",
296
+ "node": "./dist/node/channel/telemetry.js",
297
+ "default": "./dist/channel/telemetry.js"
298
+ },
299
+ "./channel/types": {
300
+ "types": "./dist/channel/types.d.ts",
301
+ "bun": "./dist/channel/types.js",
302
+ "node": "./dist/node/channel/types.js",
303
+ "default": "./dist/channel/types.js"
304
+ },
305
+ "./channel/whatsapp-meta": {
306
+ "types": "./dist/channel/whatsapp-meta.d.ts",
307
+ "bun": "./dist/channel/whatsapp-meta.js",
308
+ "node": "./dist/node/channel/whatsapp-meta.js",
309
+ "default": "./dist/channel/whatsapp-meta.js"
310
+ },
311
+ "./channel/whatsapp-twilio": {
312
+ "types": "./dist/channel/whatsapp-twilio.d.ts",
313
+ "bun": "./dist/channel/whatsapp-twilio.js",
314
+ "node": "./dist/node/channel/whatsapp-twilio.js",
315
+ "default": "./dist/channel/whatsapp-twilio.js"
316
+ },
110
317
  "./health": {
111
318
  "types": "./dist/health.d.ts",
112
319
  "bun": "./dist/health.js",