@aloma.io/integration-sdk 3.8.69 → 3.8.71

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 (117) hide show
  1. package/README.md +15 -2
  2. package/build/internal/connector/server/on-connect/make-oauth.mjs +27 -6
  3. package/build/internal/fetcher/fetcher.d.mts +22 -1
  4. package/build/internal/fetcher/fetcher.mjs +99 -14
  5. package/build/internal/fetcher/oauth-fetcher.d.mts +15 -2
  6. package/build/internal/fetcher/oauth-fetcher.mjs +72 -27
  7. package/build/internal/util/index.d.mts +8 -0
  8. package/build/internal/util/index.mjs +13 -1
  9. package/build/internal/util/jwe/index.mjs +3 -1
  10. package/build/openapi-to-connector.mjs +5 -2
  11. package/package.json +9 -4
  12. package/.prettierrc.cjs +0 -8
  13. package/MULTI_RESOURCE_GUIDE.md +0 -220
  14. package/OPENAPI_TO_CONNECTOR.md +0 -346
  15. package/examples/hello-world/package.json +0 -25
  16. package/examples/hello-world/src/controller/index.mts +0 -12
  17. package/examples/hello-world/src/index.mts +0 -6
  18. package/examples/hello-world/tsconfig.json +0 -27
  19. package/examples/sample-api.json +0 -325
  20. package/examples/sample-api.yaml +0 -222
  21. package/examples/simple-api.json +0 -39
  22. package/index.js +0 -4
  23. package/src/builder/index.mts +0 -274
  24. package/src/builder/runtime-context.mts +0 -129
  25. package/src/cli.mts +0 -533
  26. package/src/controller/index.mts +0 -278
  27. package/src/index.mts +0 -2
  28. package/src/internal/connector/config.mts +0 -59
  29. package/src/internal/connector/index.mts +0 -53
  30. package/src/internal/connector/metrics.mts +0 -34
  31. package/src/internal/connector/server/index.mts +0 -51
  32. package/src/internal/connector/server/on-connect/decrypt-config.mts +0 -27
  33. package/src/internal/connector/server/on-connect/finish-oauth.mts +0 -109
  34. package/src/internal/connector/server/on-connect/index.mts +0 -162
  35. package/src/internal/connector/server/on-connect/make-oauth.mts +0 -97
  36. package/src/internal/connector/server/on-connect/start-oauth.mts +0 -24
  37. package/src/internal/connector/server/on-message.mts +0 -13
  38. package/src/internal/dispatcher/index.mts +0 -231
  39. package/src/internal/fetcher/fetcher.mts +0 -166
  40. package/src/internal/fetcher/oauth-fetcher.mts +0 -153
  41. package/src/internal/index.mts +0 -3
  42. package/src/internal/util/index.mts +0 -52
  43. package/src/internal/util/jwe/cli.mts +0 -12
  44. package/src/internal/util/jwe/index.mts +0 -72
  45. package/src/internal/websocket/config.mjs +0 -109
  46. package/src/internal/websocket/connection/constants.mjs +0 -25
  47. package/src/internal/websocket/connection/index.mjs +0 -71
  48. package/src/internal/websocket/connection/registration.mjs +0 -42
  49. package/src/internal/websocket/index.mjs +0 -46
  50. package/src/internal/websocket/transport/durable.mjs +0 -71
  51. package/src/internal/websocket/transport/index.mjs +0 -194
  52. package/src/internal/websocket/transport/packet.mjs +0 -54
  53. package/src/internal/websocket/transport/processor.mjs +0 -66
  54. package/src/openapi-to-connector.mts +0 -1644
  55. package/src/testing/fake-aloma.mts +0 -306
  56. package/src/testing/harness.mts +0 -172
  57. package/src/testing/index.mts +0 -15
  58. package/src/testing/keys.mts +0 -19
  59. package/src/testing/network-guard.mts +0 -57
  60. package/src/testing/runtime-connector.mts +0 -50
  61. package/src/testing/vendor-mock.mts +0 -166
  62. package/src/transform/index.mts +0 -544
  63. package/test/MUTATION-entry.md +0 -21
  64. package/test/MUTATION.md +0 -43
  65. package/test/dispatcher-ctx-forwarding.test.mjs +0 -161
  66. package/test/fixtures/transform/basic/expected.json +0 -9
  67. package/test/fixtures/transform/basic/src/controller/abstract.mts +0 -5
  68. package/test/fixtures/transform/basic/src/controller/index.mts +0 -30
  69. package/test/fixtures/transform/basic/tsconfig.json +0 -1
  70. package/test/fixtures/transform/interface-param/src/controller/abstract.mts +0 -5
  71. package/test/fixtures/transform/interface-param/src/controller/index.mts +0 -12
  72. package/test/fixtures/transform/interface-param/tsconfig.json +0 -1
  73. package/test/fixtures/transform/overloads/expected.json +0 -6
  74. package/test/fixtures/transform/overloads/src/controller/abstract.mts +0 -5
  75. package/test/fixtures/transform/overloads/src/controller/index.mts +0 -11
  76. package/test/fixtures/transform/overloads/tsconfig.json +0 -1
  77. package/test/fixtures/transform/tdd-stub/expected.json +0 -8
  78. package/test/fixtures/transform/tdd-stub/src/controller/abstract.mts +0 -6
  79. package/test/fixtures/transform/tdd-stub/src/controller/index.mts +0 -204
  80. package/test/fixtures/transform/tdd-stub/tsconfig.json +0 -1
  81. package/test/fixtures/transform/two-exports/src/controller/abstract.mts +0 -5
  82. package/test/fixtures/transform/two-exports/src/controller/index.mts +0 -9
  83. package/test/fixtures/transform/two-exports/tsconfig.json +0 -1
  84. package/test/fixtures/transform/type-error/src/controller/abstract.mts +0 -5
  85. package/test/fixtures/transform/type-error/src/controller/index.mts +0 -7
  86. package/test/fixtures/transform/type-error/tsconfig.json +0 -1
  87. package/test/fixtures/transform/typed/expected.json +0 -8
  88. package/test/fixtures/transform/typed/src/controller/abstract.mts +0 -5
  89. package/test/fixtures/transform/typed/src/controller/index.mts +0 -13
  90. package/test/fixtures/transform/typed/tsconfig.json +0 -1
  91. package/test/fixtures/transform/visibility/expected.json +0 -9
  92. package/test/fixtures/transform/visibility/src/controller/abstract.mts +0 -5
  93. package/test/fixtures/transform/visibility/src/controller/index.mts +0 -19
  94. package/test/fixtures/transform/visibility/tsconfig.json +0 -1
  95. package/test/harness-connector-smoke.test.mjs +0 -72
  96. package/test/harness.test.mjs +0 -375
  97. package/test/nested-resolver.test.mjs +0 -184
  98. package/test/openapi-generator-bugs.test.mjs +0 -248
  99. package/test/openapi-identifier-sanitise.test.mjs +0 -69
  100. package/test/openapi-nested-paths.test.mjs +0 -100
  101. package/test/openapi-to-connector.test.mts +0 -225
  102. package/test/openapi-ts-compilation.test.mjs +0 -178
  103. package/test/scenarios/README.md +0 -148
  104. package/test/scenarios/complex/expected/controller.mts +0 -271
  105. package/test/scenarios/complex/expected/orders-resource.mts +0 -262
  106. package/test/scenarios/complex/expected/products-resource.mts +0 -237
  107. package/test/scenarios/complex/specs/orders.json +0 -362
  108. package/test/scenarios/complex/specs/products.json +0 -308
  109. package/test/scenarios/simple/expected-controller.mts +0 -60
  110. package/test/scenarios/simple/simple-api.json +0 -39
  111. package/test/scenarios.test.mts +0 -294
  112. package/test/transform.test.mjs +0 -68
  113. package/test/verify-scenarios.mjs +0 -298
  114. package/tools/mutation-run-entry.mjs +0 -52
  115. package/tools/mutation-run.mjs +0 -120
  116. package/tools/run-tests.mjs +0 -64
  117. package/tsconfig.json +0 -27
@@ -1,262 +0,0 @@
1
- // OrdersResource resource functions
2
- // These functions will be bound to the controller instance and accessible as orders.method()
3
-
4
- // Generated TypeScript interfaces from OpenAPI schemas
5
-
6
- export interface Order {
7
- /** Unique order identifier */
8
- id: string;
9
- /** Customer who placed the order */
10
- customerId: string;
11
- /** Items in the order */
12
- items: OrderItem[];
13
- /** Current order status */
14
- status: string;
15
- /** Total order amount */
16
- totalAmount: number;
17
- shippingAddress?: Address;
18
- billingAddress?: Address;
19
- /** Order creation timestamp */
20
- createdAt?: string;
21
- /** Last update timestamp */
22
- updatedAt?: string;
23
- }
24
-
25
- export interface OrderItem {
26
- /** Product identifier */
27
- productId: string;
28
- /** Product name */
29
- productName?: string;
30
- /** Quantity ordered */
31
- quantity: number;
32
- /** Price per unit */
33
- unitPrice: number;
34
- /** Total price for this item */
35
- totalPrice?: number;
36
- }
37
-
38
- export interface Address {
39
- /** Street address */
40
- street: string;
41
- /** City */
42
- city: string;
43
- /** State or province */
44
- state?: string;
45
- /** ZIP or postal code */
46
- zipCode: string;
47
- /** Country */
48
- country: string;
49
- }
50
-
51
- export interface OrderList {
52
- orders?: Order[];
53
- /** Total number of orders */
54
- total?: number;
55
- /** Whether there are more orders available */
56
- hasMore?: boolean;
57
- }
58
-
59
- export interface CreateOrderRequest {
60
- /** Customer who is placing the order */
61
- customerId: string;
62
- /** Items to order */
63
- items: OrderItemRequest[];
64
- shippingAddress?: Address;
65
- billingAddress?: Address;
66
- }
67
-
68
- export interface OrderItemRequest {
69
- /** Product to order */
70
- productId: string;
71
- /** Quantity to order */
72
- quantity: number;
73
- }
74
-
75
- export interface UpdateOrderStatusRequest {
76
- /** New order status */
77
- status: string;
78
- /** Tracking number (for shipped status) */
79
- trackingNumber?: string;
80
- }
81
-
82
-
83
- /**
84
- * List all orders
85
- *
86
- * @param {Object} options - Request options
87
- * @param {string} options.status (optional) - Filter by order status [query]
88
- * @param {string} options.customerId (optional) - Filter by customer ID [query]
89
- * @param {number} options.limit (optional) - Maximum number of orders to return [query]
90
- *
91
- * @returns {Promise<OrderList>} GET /orders response
92
- *
93
- * response fields:
94
- * - orders?: Order[]
95
- * - total?: number - Total number of orders
96
- * - hasMore?: boolean - Whether there are more orders available
97
- */
98
- export function getOrders(this: any, options?: {status?: string, customerId?: string, limit?: number, headers?: Record<string, string>}) {
99
- options = options || {};
100
-
101
- const url = '/orders';
102
-
103
- const fetchOptions: any = {
104
- method: 'GET',
105
- params: {},
106
- headers: options.headers,
107
- };
108
-
109
- // Add query parameters
110
- if (options.status !== undefined) {
111
- fetchOptions.params.status = options.status;
112
- }
113
- if (options.customerId !== undefined) {
114
- fetchOptions.params.customerId = options.customerId;
115
- }
116
- if (options.limit !== undefined) {
117
- fetchOptions.params.limit = options.limit;
118
- }
119
-
120
- return this.api.fetch(url, fetchOptions);
121
- }
122
-
123
- /**
124
- * Create a new order
125
- *
126
- * @param {Object} options - Request options
127
- * @param {string} options.customerId (required) - Customer who is placing the order [body property]
128
- * @param {OrderItemRequest[]} options.items (required) - Items to order [body property]
129
- * @param {Address} options.shippingAddress (required) - [body property]
130
- * @param {Address} options.billingAddress (required) - [body property]
131
- *
132
- * @returns {Promise<Order>} POST /orders response
133
- *
134
- * response fields:
135
- * - id: string - Unique order identifier
136
- * - customerId: string - Customer who placed the order
137
- * - items: OrderItem[] - Items in the order
138
- * - status: string - Current order status
139
- * - totalAmount: number - Total order amount
140
- * - shippingAddress?: Address
141
- * - billingAddress?: Address
142
- * - createdAt?: string - Order creation timestamp
143
- * - updatedAt?: string - Last update timestamp
144
- */
145
- export function createOrder(this: any, options: {customerId: string /** Customer who is placing the order */, items: OrderItemRequest[] /** Items to order */, shippingAddress: Address, billingAddress: Address, headers?: Record<string, string>}) {
146
- options = options || {};
147
-
148
- const url = '/orders';
149
-
150
- const { headers, ...bodyData } = options;
151
- const requestBody = Object.keys(bodyData).length > 0 ? bodyData : undefined;
152
-
153
- const fetchOptions: any = {
154
- method: 'POST',
155
- body: requestBody,
156
- headers: options.headers,
157
- };
158
-
159
- return this.api.fetch(url, fetchOptions);
160
- }
161
-
162
- /**
163
- * Get a specific order
164
- *
165
- * @param {string} orderId The order ID
166
- * @param {Object} options (optional) - Request options
167
- *
168
- * @returns {Promise<Order>} GET /orders/{orderId} response
169
- *
170
- * response fields:
171
- * - id: string - Unique order identifier
172
- * - customerId: string - Customer who placed the order
173
- * - items: OrderItem[] - Items in the order
174
- * - status: string - Current order status
175
- * - totalAmount: number - Total order amount
176
- * - shippingAddress?: Address
177
- * - billingAddress?: Address
178
- * - createdAt?: string - Order creation timestamp
179
- * - updatedAt?: string - Last update timestamp
180
- */
181
- export function getOrder(this: any, orderId: string, options?: {headers?: Record<string, string>}) {
182
- let url = '/orders/{orderId}';
183
- if (orderId) {
184
- url = url.replace('{orderId}', orderId);
185
- }
186
-
187
- return this.api.fetch(url, {
188
- method: 'GET',
189
- });
190
- }
191
-
192
- /**
193
- * Update order status
194
- *
195
- * @param {string} orderId The order ID
196
- * @param {Object} options - Request options
197
- * @param {string} options.status (required) - New order status [body property]
198
- * @param {string} options.trackingNumber (required) - Tracking number (for shipped status) [body property]
199
- *
200
- * @returns {Promise<Order>} PATCH /orders/{orderId} response
201
- *
202
- * response fields:
203
- * - id: string - Unique order identifier
204
- * - customerId: string - Customer who placed the order
205
- * - items: OrderItem[] - Items in the order
206
- * - status: string - Current order status
207
- * - totalAmount: number - Total order amount
208
- * - shippingAddress?: Address
209
- * - billingAddress?: Address
210
- * - createdAt?: string - Order creation timestamp
211
- * - updatedAt?: string - Last update timestamp
212
- */
213
- export function updateOrderStatus(this: any, orderId: string, options: {status: string /** New order status */, trackingNumber: string /** Tracking number (for shipped status */, headers?: Record<string, string>})) {
214
- options = options || {};
215
-
216
- // Build URL with path parameters
217
- let url = '/orders/{orderId}';
218
- if (orderId) {
219
- url = url.replace('{orderId}', orderId);
220
- }
221
-
222
- const { headers, ...bodyData } = options;
223
- const requestBody = Object.keys(bodyData).length > 0 ? bodyData : undefined;
224
-
225
- const fetchOptions: any = {
226
- method: 'PATCH',
227
- body: requestBody,
228
- headers: options.headers,
229
- };
230
-
231
- return this.api.fetch(url, fetchOptions);
232
- }
233
-
234
- /**
235
- * Cancel an order
236
- *
237
- * @param {string} orderId The order ID
238
- * @param {Object} options (optional) - Request options
239
- *
240
- * @returns {Promise<Order>} POST /orders/{orderId}/cancel response
241
- *
242
- * response fields:
243
- * - id: string - Unique order identifier
244
- * - customerId: string - Customer who placed the order
245
- * - items: OrderItem[] - Items in the order
246
- * - status: string - Current order status
247
- * - totalAmount: number - Total order amount
248
- * - shippingAddress?: Address
249
- * - billingAddress?: Address
250
- * - createdAt?: string - Order creation timestamp
251
- * - updatedAt?: string - Last update timestamp
252
- */
253
- export function cancelOrder(this: any, orderId: string, options?: {headers?: Record<string, string>}) {
254
- let url = '/orders/{orderId}/cancel';
255
- if (orderId) {
256
- url = url.replace('{orderId}', orderId);
257
- }
258
-
259
- return this.api.fetch(url, {
260
- method: 'POST',
261
- });
262
- }
@@ -1,237 +0,0 @@
1
- // ProductsResource resource functions
2
- // These functions will be bound to the controller instance and accessible as products.method()
3
-
4
- // Generated TypeScript interfaces from OpenAPI schemas
5
-
6
- export interface Product {
7
- /** Unique product identifier */
8
- id: string;
9
- /** Product name */
10
- name: string;
11
- /** Product description */
12
- description?: string;
13
- /** Product price */
14
- price: number;
15
- /** Product category */
16
- category?: string;
17
- /** Whether product is in stock */
18
- inStock?: boolean;
19
- /** Product tags */
20
- tags?: string[];
21
- /** Creation timestamp */
22
- createdAt?: string;
23
- /** Last update timestamp */
24
- updatedAt?: string;
25
- }
26
-
27
- export interface ProductList {
28
- products?: Product[];
29
- /** Total number of products */
30
- total?: number;
31
- /** Whether there are more products available */
32
- hasMore?: boolean;
33
- }
34
-
35
- export interface CreateProductRequest {
36
- /** Product name */
37
- name: string;
38
- /** Product description */
39
- description?: string;
40
- /** Product price */
41
- price: number;
42
- /** Product category */
43
- category?: string;
44
- /** Product tags */
45
- tags?: string[];
46
- }
47
-
48
- export interface UpdateProductRequest {
49
- /** Product name */
50
- name?: string;
51
- /** Product description */
52
- description?: string;
53
- /** Product price */
54
- price?: number;
55
- /** Product category */
56
- category?: string;
57
- /** Whether product is in stock */
58
- inStock?: boolean;
59
- /** Product tags */
60
- tags?: string[];
61
- }
62
-
63
-
64
- /**
65
- * List all products
66
- *
67
- * @param {Object} options - Request options
68
- * @param {number} options.limit (optional) - Maximum number of products to return [query]
69
- * @param {string} options.category (optional) - Filter by category [query]
70
- * @param {boolean} options.archived (optional) - Include archived products [query]
71
- *
72
- * @returns {Promise<ProductList>} GET /products response
73
- *
74
- * response fields:
75
- * - products?: Product[]
76
- * - total?: number - Total number of products
77
- * - hasMore?: boolean - Whether there are more products available
78
- */
79
- export function getProducts(this: any, options?: {limit?: number, category?: string, archived?: boolean, headers?: Record<string, string>}) {
80
- options = options || {};
81
-
82
- const url = '/products';
83
-
84
- const fetchOptions: any = {
85
- method: 'GET',
86
- params: {},
87
- headers: options.headers,
88
- };
89
-
90
- // Add query parameters
91
- if (options.limit !== undefined) {
92
- fetchOptions.params.limit = options.limit;
93
- }
94
- if (options.category !== undefined) {
95
- fetchOptions.params.category = options.category;
96
- }
97
- if (options.archived !== undefined) {
98
- fetchOptions.params.archived = options.archived;
99
- }
100
-
101
- return this.api.fetch(url, fetchOptions);
102
- }
103
-
104
- /**
105
- * Create a new product
106
- *
107
- * @param {Object} options - Request options
108
- * @param {string} options.name (required) - Product name [body property]
109
- * @param {string} options.description (required) - Product description [body property]
110
- * @param {number} options.price (required) - Product price [body property]
111
- * @param {string} options.category (required) - Product category [body property]
112
- * @param {string[]} options.tags (required) - Product tags [body property]
113
- *
114
- * @returns {Promise<Product>} POST /products response
115
- *
116
- * response fields:
117
- * - id: string - Unique product identifier
118
- * - name: string - Product name
119
- * - description?: string - Product description
120
- * - price: number - Product price
121
- * - category?: string - Product category
122
- * - inStock?: boolean - Whether product is in stock
123
- * - tags?: string[] - Product tags
124
- * - createdAt?: string - Creation timestamp
125
- * - updatedAt?: string - Last update timestamp
126
- */
127
- export function createProduct(this: any, options: {name: string /** Product name */, description: string /** Product description */, price: number /** Product price */, category: string /** Product category */, tags: string[] /** Product tags */, headers?: Record<string, string>}) {
128
- options = options || {};
129
-
130
- const url = '/products';
131
-
132
- const { headers, ...bodyData } = options;
133
- const requestBody = Object.keys(bodyData).length > 0 ? bodyData : undefined;
134
-
135
- const fetchOptions: any = {
136
- method: 'POST',
137
- body: requestBody,
138
- headers: options.headers,
139
- };
140
-
141
- return this.api.fetch(url, fetchOptions);
142
- }
143
-
144
- /**
145
- * Get a specific product
146
- *
147
- * @param {string} productId The product ID
148
- * @param {Object} options (optional) - Request options
149
- *
150
- * @returns {Promise<Product>} GET /products/{productId} response
151
- *
152
- * response fields:
153
- * - id: string - Unique product identifier
154
- * - name: string - Product name
155
- * - description?: string - Product description
156
- * - price: number - Product price
157
- * - category?: string - Product category
158
- * - inStock?: boolean - Whether product is in stock
159
- * - tags?: string[] - Product tags
160
- * - createdAt?: string - Creation timestamp
161
- * - updatedAt?: string - Last update timestamp
162
- */
163
- export function getProduct(this: any, productId: string, options?: {headers?: Record<string, string>}) {
164
- let url = '/products/{productId}';
165
- if (productId) {
166
- url = url.replace('{productId}', productId);
167
- }
168
-
169
- return this.api.fetch(url, {
170
- method: 'GET',
171
- });
172
- }
173
-
174
- /**
175
- * Update a product
176
- *
177
- * @param {string} productId The product ID
178
- * @param {Object} options - Request options
179
- * @param {string} options.name (required) - Product name [body property]
180
- * @param {string} options.description (required) - Product description [body property]
181
- * @param {number} options.price (required) - Product price [body property]
182
- * @param {string} options.category (required) - Product category [body property]
183
- * @param {boolean} options.inStock (required) - Whether product is in stock [body property]
184
- * @param {string[]} options.tags (required) - Product tags [body property]
185
- *
186
- * @returns {Promise<Product>} PUT /products/{productId} response
187
- *
188
- * response fields:
189
- * - id: string - Unique product identifier
190
- * - name: string - Product name
191
- * - description?: string - Product description
192
- * - price: number - Product price
193
- * - category?: string - Product category
194
- * - inStock?: boolean - Whether product is in stock
195
- * - tags?: string[] - Product tags
196
- * - createdAt?: string - Creation timestamp
197
- * - updatedAt?: string - Last update timestamp
198
- */
199
- export function updateProduct(this: any, productId: string, options: {name: string /** Product name */, description: string /** Product description */, price: number /** Product price */, category: string /** Product category */, inStock: boolean /** Whether product is in stock */, tags: string[] /** Product tags */, headers?: Record<string, string>}) {
200
- options = options || {};
201
-
202
- // Build URL with path parameters
203
- let url = '/products/{productId}';
204
- if (productId) {
205
- url = url.replace('{productId}', productId);
206
- }
207
-
208
- const { headers, ...bodyData } = options;
209
- const requestBody = Object.keys(bodyData).length > 0 ? bodyData : undefined;
210
-
211
- const fetchOptions: any = {
212
- method: 'PUT',
213
- body: requestBody,
214
- headers: options.headers,
215
- };
216
-
217
- return this.api.fetch(url, fetchOptions);
218
- }
219
-
220
- /**
221
- * Delete a product
222
- *
223
- * @param {string} productId The product ID
224
- * @param {Object} options (optional) - Request options
225
- *
226
- * @returns {Promise<any>} DELETE /products/{productId} response
227
- */
228
- export function deleteProduct(this: any, productId: string, options?: {headers?: Record<string, string>}) {
229
- let url = '/products/{productId}';
230
- if (productId) {
231
- url = url.replace('{productId}', productId);
232
- }
233
-
234
- return this.api.fetch(url, {
235
- method: 'DELETE',
236
- });
237
- }