@cloudnux/cloud-sdk 0.20.0 → 0.21.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { EventBrokerService, InvokeService, StorageService, LocationService, EventFunctionContext, EventBatchItemResult, HttpFunctionContext, InvokeFunctionContext, ScheduleFunctionContext, WebSocketFunctionContext, FunctionsService, WebSocketService, LoggerService, ServiceKind, IService, CloudProvider } from '@cloudnux/core-cloud-provider';
2
- export { CloudProvider, ErrorCode, EventBrokerService, EventFunctionContext, EventMessage, EventRequest, EventResponse, HTTPAuth, HTTPRequest, HTTPResponse, HttpFunctionContext, InvokeFunctionContext, InvokeRequest, InvokeResponse, InvokeService, LocationAddress, LocationService, LocationSuggestion, LoggerService, ReverseGeocodeParams, ScheduleFunctionContext, ScheduleRequest, StorageService, StorageWriteOptions, SuggestionParams, WebSocketConnectionGoneError, WebSocketFunctionContext, WebSocketRequest, WebSocketResponse, WebSocketService } from '@cloudnux/core-cloud-provider';
1
+ import { EventBrokerService, InvokeService, StorageService, LocationService, EventFunctionContext, EventBatchItemResult, HttpFunctionContext, InvokeFunctionContext, ScheduleFunctionContext, WebSocketFunctionContext, FunctionsService, WebSocketService, LoggerService, EmailService, ServiceKind, IService, CloudProvider } from '@cloudnux/core-cloud-provider';
2
+ export { CloudProvider, CookieOptions, EmailAttachment, EmailMessage, EmailSendResult, EmailService, ErrorCode, EventBrokerService, EventFunctionContext, EventMessage, EventRequest, EventResponse, HTTPRequest, HTTPResponse, HttpFunctionContext, InvokeFunctionContext, InvokeRequest, InvokeResponse, InvokeService, LocationAddress, LocationService, LocationSuggestion, LoggerService, ReverseGeocodeParams, SameSite, ScheduleFunctionContext, ScheduleRequest, StorageService, StorageWriteOptions, SuggestionParams, WebSocketConnectionGoneError, WebSocketFunctionContext, WebSocketRequest, WebSocketResponse, WebSocketService } from '@cloudnux/core-cloud-provider';
3
3
 
4
4
  declare const cloudEventBroker: () => EventBrokerService;
5
5
  declare const resetCloudEventBroker: () => void;
@@ -37,6 +37,9 @@ declare const resetCloudWebSocket: () => void;
37
37
  declare const cloudLogger: () => LoggerService;
38
38
  declare const resetCloudLogger: () => void;
39
39
 
40
+ declare const cloudEmail: () => EmailService;
41
+ declare const resetCloudEmail: () => void;
42
+
40
43
  type CloudProviderOptions = {
41
44
  serviceFactories?: Partial<Record<ServiceKind, () => IService>>;
42
45
  };
@@ -127,4 +130,12 @@ declare enum HttpStatus {
127
130
  INTERNAL_SERVER_ERROR = 500
128
131
  }
129
132
 
130
- export { type ApiContentResponse, type ApiCursorListResponse, type ApiDeleteResponse, type ApiError, type ApiListResponse, type ApiResponse, type ApiResponseMeta, type CloudProviderOptions, type ErrorResponse, HttpStatus, cloudEventBroker, cloudFunctions, cloudInvoke, cloudLocations, cloudLogger, cloudStorage, cloudWebSocket, eventBrokerHandler, getCloudProvider, httpHandler, invokeHandler, resetCloudEventBroker, resetCloudFunctions, resetCloudInvoke, resetCloudLocations, resetCloudLogger, resetCloudStorage, resetCloudWebSocket, scheduleHandler, useCloudProvider, websocketHandler };
133
+ /**
134
+ * Thrown by a compose enhancer to stop the handler chain after it has
135
+ * already written a response onto the context (e.g. `ctx.unauthorized()`).
136
+ * `httpHandler` catches this and builds the response instead of rethrowing.
137
+ */
138
+ declare class HttpHalt extends Error {
139
+ }
140
+
141
+ export { type ApiContentResponse, type ApiCursorListResponse, type ApiDeleteResponse, type ApiError, type ApiListResponse, type ApiResponse, type ApiResponseMeta, type CloudProviderOptions, type ErrorResponse, HttpHalt, HttpStatus, cloudEmail, cloudEventBroker, cloudFunctions, cloudInvoke, cloudLocations, cloudLogger, cloudStorage, cloudWebSocket, eventBrokerHandler, getCloudProvider, httpHandler, invokeHandler, resetCloudEmail, resetCloudEventBroker, resetCloudFunctions, resetCloudInvoke, resetCloudLocations, resetCloudLogger, resetCloudStorage, resetCloudWebSocket, scheduleHandler, useCloudProvider, websocketHandler };
package/dist/index.js CHANGED
@@ -79,6 +79,19 @@ var resetCloudInvoke = () => {
79
79
  _cloudInvoke = null;
80
80
  };
81
81
 
82
+ // src/services/email.ts
83
+ var _cloudEmail = null;
84
+ var cloudEmail = () => {
85
+ if (_cloudEmail) {
86
+ return _cloudEmail;
87
+ }
88
+ _cloudEmail = getCloudProvider().createEmailService();
89
+ return _cloudEmail;
90
+ };
91
+ var resetCloudEmail = () => {
92
+ _cloudEmail = null;
93
+ };
94
+
82
95
  // src/provider.ts
83
96
  var provider = null;
84
97
  function getCloudProvider() {
@@ -98,7 +111,8 @@ function useCloudProvider(cloudProvider, options) {
98
111
  "location": cloudLocations,
99
112
  "functions": cloudFunctions,
100
113
  "websocket": cloudWebSocket,
101
- "invoke": cloudInvoke
114
+ "invoke": cloudInvoke,
115
+ "email": cloudEmail
102
116
  };
103
117
  registerServices(services);
104
118
  provider = {
@@ -109,7 +123,8 @@ function useCloudProvider(cloudProvider, options) {
109
123
  createLocationService: options?.serviceFactories?.location || cloudProvider.createLocationService,
110
124
  createFunctionsService: options?.serviceFactories?.functions || cloudProvider.createFunctionsService,
111
125
  createWebSocketService: options?.serviceFactories?.websocket || cloudProvider.createWebSocketService,
112
- createInvokeService: options?.serviceFactories?.invoke || cloudProvider.createInvokeService
126
+ createInvokeService: options?.serviceFactories?.invoke || cloudProvider.createInvokeService,
127
+ createEmailService: options?.serviceFactories?.email || cloudProvider.createEmailService
113
128
  };
114
129
  resetCloudLogger();
115
130
  resetCloudEventBroker();
@@ -118,6 +133,7 @@ function useCloudProvider(cloudProvider, options) {
118
133
  resetCloudFunctions();
119
134
  resetCloudWebSocket();
120
135
  resetCloudInvoke();
136
+ resetCloudEmail();
121
137
  }
122
138
 
123
139
  // src/services/event-broker.ts
@@ -199,7 +215,10 @@ async function eventBrokerHandler(handler, ...args) {
199
215
 
200
216
  // src/services/functions/http/create-http-context.ts
201
217
  import querystring from "querystring";
202
- function createHttpContext(request, auth, logger) {
218
+ import {
219
+ serializeCookie
220
+ } from "@cloudnux/core-cloud-provider";
221
+ function createHttpContext(request, logger) {
203
222
  const response = {
204
223
  body: void 0,
205
224
  headers: {},
@@ -235,7 +254,6 @@ function createHttpContext(request, auth, logger) {
235
254
  return {
236
255
  type: "Http",
237
256
  request,
238
- auth,
239
257
  response,
240
258
  logger,
241
259
  model() {
@@ -365,23 +383,41 @@ function createHttpContext(request, auth, logger) {
365
383
  },
366
384
  forbidden(message = "You do not have permission to perform this action") {
367
385
  return error(403 /* FORBIDDEN */, "ACCESS_DENIED" /* ACCESS_DENIED */, message);
386
+ },
387
+ setCookie(name, value, options) {
388
+ response.cookies = [...response.cookies ?? [], serializeCookie(name, value, options)];
389
+ },
390
+ deleteCookie(name, options) {
391
+ response.cookies = [...response.cookies ?? [], serializeCookie(name, "", {
392
+ ...options,
393
+ maxAge: 0,
394
+ expires: /* @__PURE__ */ new Date(0)
395
+ })];
368
396
  }
369
397
  };
370
398
  }
371
399
 
400
+ // src/services/functions/http/halt.ts
401
+ var HttpHalt = class extends Error {
402
+ };
403
+
372
404
  // src/services/functions/http/handler.ts
373
405
  async function httpHandler(handler, ...args) {
374
406
  const log = cloudLogger();
407
+ const [httpRequest] = cloudFunctions().createHttRequest(...args);
408
+ log.setBindings({ reqId: httpRequest.requestId ?? "", module: httpRequest.moduleName ?? "" });
409
+ log.debug({ httpRequest }, "Created HTTP request");
410
+ const context = createHttpContext(httpRequest, log);
375
411
  try {
376
412
  log.debug({ args }, "Executing HTTP handler with args");
377
- const [httpRequest, httpAuth] = cloudFunctions().createHttRequest(...args);
378
- log.setBindings({ reqId: httpRequest.requestId ?? "", module: httpRequest.moduleName ?? "" });
379
- log.debug({ httpRequest, httpAuth }, "Created HTTP request and auth");
380
- const context = createHttpContext(httpRequest, httpAuth, log);
381
413
  await handler(context);
382
414
  log.debug({ response: context.response }, "Handler executed successfully, building HTTP response");
383
415
  return cloudFunctions().buildHttpResponse(context, ...args);
384
416
  } catch (error) {
417
+ if (error instanceof HttpHalt) {
418
+ log.debug({ response: context.response }, "Handler chain halted, building HTTP response");
419
+ return cloudFunctions().buildHttpResponse(context, ...args);
420
+ }
385
421
  log.error({ error }, "Error in HTTP handler");
386
422
  throw error;
387
423
  }
@@ -572,7 +608,9 @@ async function websocketHandler(handler, ...args) {
572
608
  import { ErrorCode as ErrorCode4, WebSocketConnectionGoneError } from "@cloudnux/core-cloud-provider";
573
609
  export {
574
610
  ErrorCode4 as ErrorCode,
611
+ HttpHalt,
575
612
  WebSocketConnectionGoneError,
613
+ cloudEmail,
576
614
  cloudEventBroker,
577
615
  cloudFunctions,
578
616
  cloudInvoke,
@@ -584,6 +622,7 @@ export {
584
622
  getCloudProvider,
585
623
  httpHandler,
586
624
  invokeHandler,
625
+ resetCloudEmail,
587
626
  resetCloudEventBroker,
588
627
  resetCloudFunctions,
589
628
  resetCloudInvoke,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider.ts","../src/services/logger.ts","../src/services/storage.ts","../src/services/locations.ts","../src/services/functions/cloud-functions.ts","../src/services/websocket.ts","../src/services/invoke.ts","../src/services/event-broker.ts","../src/services/functions/event-broker/create-event-context.ts","../src/services/functions/event-broker/handler.ts","../src/services/functions/http/create-http-context.ts","../src/services/functions/http/handler.ts","../src/services/functions/invoke/create-invoke-context.ts","../src/services/functions/invoke/handler.ts","../src/services/functions/schedule/create-schedule-context.ts","../src/services/functions/schedule/handler.ts","../src/services/functions/websocket/create-websocket-context.ts","../src/services/functions/websocket/handler.ts","../src/index.ts"],"sourcesContent":["import { CloudProvider, ServiceKind, IService, registerServices, LoggerService, EventBrokerService, StorageService, LocationService, FunctionsService, WebSocketService, InvokeService } from \"@cloudnux/core-cloud-provider\";\nimport { cloudLogger, resetCloudLogger } from \"./services/logger\";\nimport { cloudEventBroker, resetCloudEventBroker } from \"./services/event-broker\";\nimport { cloudStorage, resetCloudStorage } from \"./services/storage\";\nimport { cloudLocations, resetCloudLocations } from \"./services/locations\";\nimport { cloudFunctions, resetCloudFunctions } from \"./services/functions/cloud-functions\";\nimport { cloudWebSocket, resetCloudWebSocket } from \"./services/websocket\";\nimport { cloudInvoke, resetCloudInvoke } from \"./services/invoke\";\n\nexport type CloudProviderOptions = {\n serviceFactories?: Partial<Record<ServiceKind, () => IService>>;\n}\n\nlet provider: CloudProvider | null = null;\n\n/**\n * Retrieves the current cloud provider instance.\n * @returns The current cloud provider instance.\n * @throws Will throw an error if the cloud provider is not set\n **/\nexport function getCloudProvider() {\n if (!provider) {\n throw new Error(\"Cloud provider is not defined. Please set a valid cloud provider using useProvider.\");\n }\n return provider;\n}\n\n/**\n * Sets the cloud provider to be used by the SDK.\n * @param cloudProvider - The cloud provider instance to set.\n * @throws Will throw an error if the cloud provider is not provided\n **/\nexport function useCloudProvider(cloudProvider: CloudProvider, options?: CloudProviderOptions) {\n if (!cloudProvider) {\n throw new Error(\"Cloud provider is not defined. Please set a valid cloud provider using useProvider.\");\n }\n const services = {\n \"logger\": cloudLogger,\n \"event-broker\": cloudEventBroker,\n \"storage\": cloudStorage,\n \"location\": cloudLocations,\n \"functions\": cloudFunctions,\n \"websocket\": cloudWebSocket,\n \"invoke\": cloudInvoke\n }\n registerServices(services);\n\n //==================================\n provider = {\n ...cloudProvider,\n createLoggerService: (options?.serviceFactories?.logger || cloudProvider.createLoggerService) as () => LoggerService,\n createEventBrokerService: (options?.serviceFactories?.[\"event-broker\"] || cloudProvider.createEventBrokerService) as () => EventBrokerService,\n createStorageService: (options?.serviceFactories?.storage || cloudProvider.createStorageService) as () => StorageService,\n createLocationService: (options?.serviceFactories?.location || cloudProvider.createLocationService) as () => LocationService,\n createFunctionsService: (options?.serviceFactories?.functions || cloudProvider.createFunctionsService) as () => FunctionsService,\n createWebSocketService: (options?.serviceFactories?.websocket || cloudProvider.createWebSocketService) as () => WebSocketService,\n createInvokeService: (options?.serviceFactories?.invoke || cloudProvider.createInvokeService) as () => InvokeService,\n };\n\n resetCloudLogger();\n resetCloudEventBroker();\n resetCloudStorage();\n resetCloudLocations();\n resetCloudFunctions();\n resetCloudWebSocket();\n resetCloudInvoke();\n}","import { LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _loggingService: LoggerService | null = null;\n\nexport const cloudLogger = () => {\n if (_loggingService) {\n return _loggingService;\n }\n _loggingService = getCloudProvider().createLoggerService();\n return _loggingService;\n}\n\nexport const resetCloudLogger = () => {\n _loggingService = null;\n}","import { StorageService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudStorageService: StorageService | null = null;\n\nexport const cloudStorage = () => {\n if (_cloudStorageService) {\n return _cloudStorageService;\n }\n _cloudStorageService = getCloudProvider().createStorageService();\n return _cloudStorageService;\n}\n\nexport const resetCloudStorage = () => {\n _cloudStorageService = null;\n}","import { LocationService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudLocationService: LocationService | null = null;\n\nexport const cloudLocations = () => {\n if (_cloudLocationService) {\n return _cloudLocationService;\n }\n _cloudLocationService = getCloudProvider().createLocationService();\n return _cloudLocationService;\n}\n\nexport const resetCloudLocations = () => {\n _cloudLocationService = null;\n}","import { FunctionsService } from \"@cloudnux/core-cloud-provider\"\n\nimport { getCloudProvider } from \"../../provider\";\n\nlet _cloudFunctionsService: FunctionsService | null = null;\n\nexport const cloudFunctions = () => {\n if (_cloudFunctionsService) {\n return _cloudFunctionsService;\n }\n _cloudFunctionsService = getCloudProvider().createFunctionsService();\n return _cloudFunctionsService;\n}\n\nexport const resetCloudFunctions = () => {\n _cloudFunctionsService = null;\n}","import { WebSocketService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudWebSocket: WebSocketService | null = null;\n\nexport const cloudWebSocket = () => {\n if (_cloudWebSocket) {\n return _cloudWebSocket;\n }\n _cloudWebSocket = getCloudProvider().createWebSocketService();\n return _cloudWebSocket;\n}\n\nexport const resetCloudWebSocket = () => {\n _cloudWebSocket = null;\n}","import { InvokeService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudInvoke: InvokeService | null = null;\n\nexport const cloudInvoke = () => {\n if (_cloudInvoke) {\n return _cloudInvoke;\n }\n _cloudInvoke = getCloudProvider().createInvokeService();\n return _cloudInvoke;\n}\n\nexport const resetCloudInvoke = () => {\n _cloudInvoke = null;\n}\n","import { EventBrokerService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudEventBroker: EventBrokerService | null = null;\n\nexport const cloudEventBroker = () => {\n if (_cloudEventBroker) {\n return _cloudEventBroker;\n }\n _cloudEventBroker = getCloudProvider().createEventBrokerService();\n return _cloudEventBroker;\n}\n\nexport const resetCloudEventBroker = () => {\n _cloudEventBroker = null;\n}","import { EventResponse, EventFunctionContext, EventRequest, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createEventContext(request: EventRequest, logger: LoggerService): EventFunctionContext {\n const response: EventResponse = {\n status: \"success\" as \"success\" | \"error\",\n body: {} as Record<string, any>\n };\n return {\n timestamp: request.timestamp || new Date(),\n attempts: request.attempts || 0,\n type: \"Event\" as const,\n response,\n request,\n logger,\n message<T = Record<string, any>>() {\n if (typeof request.body === \"string\")\n return JSON.parse(request.body || \"{}\") as T\n return request.body as T\n },\n attributes<T = Record<string, any>>() {\n return request.attributes as T\n },\n\n retryWithDelay(seconds: number) {\n response.status = \"error\";\n response.retryDelay = seconds;\n },\n error(error?: any) {\n response.body = error;\n response.status = \"error\";\n },\n success(body?: any) {\n response.body = body;\n response.status = \"success\";\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n },\n notFound(body?: any) {\n response.body = body || {};\n response.status = \"error\"; // Not found is treated as an error in this context\n }\n }\n}","import { EventFunctionContext, EventBatchItemResult } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createEventContext } from \"./create-event-context\";\n\ntype Handler = (context: EventFunctionContext) => Promise<void>;\n\nexport async function eventBrokerHandler(handler: Handler, ...args: any[]): Promise<EventBatchItemResult> {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Event Broker handler with args\");\n const [eventRequest] = cloudFunctions().createEventRequest(...args);\n log.setBindings({ reqId: eventRequest.requestId ?? \"\", module: eventRequest.moduleName ?? \"\" });\n log.debug({\n request: eventRequest,\n }, \"Created Event Broker request \");\n const context = createEventContext(eventRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Event Broker Handler executed successfully, building response\");\n return await cloudFunctions().buildEventResponse(context);\n }\n catch (error) {\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in Event Broker handler\");\n throw error;\n }\n}","import querystring from \"node:querystring\";\nimport {\n HttpFunctionContext,\n HTTPAuth,\n HTTPRequest,\n HTTPResponse,\n LoggerService,\n} from \"@cloudnux/core-cloud-provider\";\n\nimport {\n HttpStatus,\n ApiContentResponse,\n ApiCursorListResponse,\n ApiDeleteResponse,\n ApiError,\n ApiListResponse,\n ErrorCode,\n} from \"./types\";\n\nexport function createHttpContext(\n request: HTTPRequest,\n auth: HTTPAuth | undefined,\n logger: LoggerService\n): HttpFunctionContext {\n const response: HTTPResponse = {\n body: undefined,\n headers: {},\n status: HttpStatus.OK\n };\n const output = (status: number, body?: string, headers?: any) => {\n response.status = status;\n response.headers = {\n ...response.headers,\n ...headers\n };\n response.body = body;\n };\n const error = (\n statusCode = HttpStatus.INTERNAL_SERVER_ERROR,\n code: ErrorCode = ErrorCode.INTERNAL_SERVER_ERROR,\n message: string = 'An unexpected error occurred',\n details?: Record<string, any>,\n stack?: string\n ) => {\n const error: ApiError = {\n code,\n message,\n details\n };\n\n // Only include stack trace in development\n if (process.env.NODE_ENV !== 'production' && stack) {\n error.stack = stack;\n }\n\n return output(statusCode, JSON.stringify({\n success: false,\n error,\n meta: {\n timestamp: new Date().toISOString()\n }\n }), {\n \"content-type\": \"application/json\"\n });\n }\n\n return {\n type: \"Http\" as const,\n request: request,\n auth: auth,\n response: response,\n logger,\n model<T = Record<string, any>>() {\n return JSON.parse(request.body || \"{}\") as T\n },\n params<T = Record<string, string>>() {\n return {\n ...request.params || {},\n ...querystring.parse(request.rawQueryString || \"\"),\n } as T;\n },\n\n output(status: number, body?: string | object, headers?: Record<string, string | string[]>) {\n const bodyStr = typeof body === \"string\" ? body : JSON.stringify(body);\n output(status, bodyStr, headers);\n },\n\n error(message: string, code?: ErrorCode, details?: Record<string, any>, stack?: string) {\n error(\n HttpStatus.INTERNAL_SERVER_ERROR,\n code || ErrorCode.INTERNAL_SERVER_ERROR,\n message,\n details,\n stack);\n },\n success<T>(data: T) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data,\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiContentResponse<T>), {\n \"content-type\": \"application/json\"\n })\n },\n list<T>(\n items: T[],\n page: number,\n pageSize: number,\n totalItems: number\n ) {\n const totalPages = Math.ceil(totalItems / pageSize);\n\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: items,\n meta: {\n page,\n pageSize,\n totalItems,\n totalPages,\n timestamp: new Date().toISOString()\n }\n } as ApiListResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n cursorList<T>(\n items: T[],\n nextCursor: string | null,\n pageSize: number,\n prevCursor?: string | null\n ) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: items,\n meta: {\n nextCursor,\n prevCursor,\n pageSize,\n hasMore: nextCursor !== null,\n timestamp: new Date().toISOString()\n }\n } as ApiCursorListResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n created<T>(data: T) {\n return output(HttpStatus.CREATED, JSON.stringify({\n success: true,\n data,\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiContentResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n deleted(id?: string | number) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: {\n deleted: true,\n id\n },\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiDeleteResponse), {\n \"content-type\": \"application/json\"\n });\n },\n notFound(resource: string, id?: string | number) {\n const message = id\n ? `${resource} with ID ${id} was not found`\n : `${resource} not found`;\n\n return error(\n HttpStatus.NOT_FOUND,\n ErrorCode.RESOURCE_NOT_FOUND,\n message\n );\n },\n validationError(details: Record<string, any>) {\n return error(\n HttpStatus.BAD_REQUEST,\n ErrorCode.VALIDATION_ERROR,\n 'Validation failed',\n details\n );\n },\n serverError(err: Error) {\n return error(\n HttpStatus.INTERNAL_SERVER_ERROR,\n ErrorCode.INTERNAL_SERVER_ERROR,\n 'An unexpected error occurred',\n {},\n err.stack\n );\n },\n businessError(message: string, details?: Record<string, any>) {\n return error(\n HttpStatus.UNPROCESSABLE_ENTITY,\n ErrorCode.BUSINESS_RULE_VIOLATION,\n message,\n details\n );\n },\n unauthorized(message = \"Authentication required\") {\n // 401 — caller is not authenticated (no/invalid token)\n return error(HttpStatus.UNAUTHORIZED, ErrorCode.UNAUTHORIZED, message);\n },\n forbidden(message = \"You do not have permission to perform this action\") {\n // 403 — caller IS authenticated but lacks permission\n return error(HttpStatus.FORBIDDEN, ErrorCode.ACCESS_DENIED, message);\n }\n };\n}\n","import { HttpFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createHttpContext } from \"./create-http-context\";\n\ntype HttpHandler = (context: HttpFunctionContext) => Promise<void> | void;\n\nexport async function httpHandler(handler: HttpHandler, ...args: any[]) {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing HTTP handler with args\");\n const [httpRequest, httpAuth] = cloudFunctions().createHttRequest(...args);\n log.setBindings({ reqId: httpRequest.requestId ?? \"\", module: httpRequest.moduleName ?? \"\" });\n log.debug({ httpRequest, httpAuth }, \"Created HTTP request and auth\");\n const context = createHttpContext(httpRequest, httpAuth, log);\n await handler(context);\n log.debug({ response: context.response }, \"Handler executed successfully, building HTTP response\");\n return cloudFunctions().buildHttpResponse(context, ...args);\n }\n catch (error) {\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in HTTP handler\");\n throw error;\n }\n}","import { InvokeRequest, InvokeResponse, InvokeFunctionContext, ErrorCode, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createInvokeContext(request: InvokeRequest, logger: LoggerService): InvokeFunctionContext {\n const response: InvokeResponse = {\n status: \"success\",\n };\n return {\n type: \"Invoke\" as const,\n request,\n response,\n logger,\n payload<T = Record<string, any>>() {\n return request.payload as T;\n },\n success(data: any) {\n response.status = \"success\";\n response.body = data;\n },\n error(message: string, code?: ErrorCode) {\n response.status = \"error\";\n response.body = message;\n response.code = code;\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n response.code = ErrorCode.UNKNOWN_ERROR;\n },\n notFound(resource: string, id?: string | number) {\n response.status = \"error\";\n response.code = ErrorCode.RESOURCE_NOT_FOUND;\n response.body = id ? `${resource} ${id} not found` : `${resource} not found`;\n }\n }\n}\n","import { InvokeFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createInvokeContext } from \"./create-invoke-context\";\n\ntype InvokeHandler = (context: InvokeFunctionContext) => Promise<void> | void;\n\nexport async function invokeHandler(handler: InvokeHandler, ...args: any[]): Promise<any> {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Invoke handler with args\");\n const [invokeRequest] = cloudFunctions().createInvokeRequest(...args);\n log.setBindings({ reqId: invokeRequest.requestId ?? \"\", module: invokeRequest.calledModule ?? \"\" });\n log.debug({ request: invokeRequest }, \"Created Invoke request\");\n const context = createInvokeContext(invokeRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Invoke Handler executed successfully, building response\");\n return cloudFunctions().buildInvokeResponse(context, ...args);\n }\n catch (error) {\n log.error({ error }, \"Error in Invoke handler\");\n throw error;\n }\n}\n","import { ScheduleFunctionContext, ScheduleRequest, ScheduleResponse, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createScheduleContext(request: ScheduleRequest, logger: LoggerService): ScheduleFunctionContext {\n const response: ScheduleResponse = {\n status: \"error\",\n body: null as any\n };\n\n return {\n type: \"Schedule\",\n request,\n response,\n logger,\n success: (body?: any) => {\n response.status = \"success\";\n response.body = body;\n },\n\n error: (body?: any) => {\n response.status = \"error\";\n response.body = body;\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n },\n notFound: (body?: any) => {\n response.status = \"error\";\n response.body = body;\n }\n }\n}","import { ScheduleFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createScheduleContext } from \"./create-schedule-context\";\n\ntype Handler = (context: ScheduleFunctionContext) => Promise<void> | void;\n\nexport async function scheduleHandler(handler: Handler, ...args: any[]) {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Schedule handler with args\");\n const [scheduleRequest] = cloudFunctions().createScheduleRequest(...args);\n log.setBindings({ reqId: scheduleRequest.requestId ?? \"\", module: scheduleRequest.moduleName ?? \"\" });\n log.debug({\n request: scheduleRequest,\n }, \"Created Schedule request \");\n const context = createScheduleContext(scheduleRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Schedule Handler executed successfully, building response\");\n return cloudFunctions().buildScheduleResponse(context);\n }\n catch (error) {\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in Schedule handler\");\n throw error;\n }\n}","import { ErrorCode, WebSocketFunctionContext, WebSocketRequest, WebSocketResponse, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createWebSocketContext(request: WebSocketRequest, logger: LoggerService): WebSocketFunctionContext {\n const response: WebSocketResponse = {\n status: \"success\",\n body: {} as any,\n statusCode: 101,\n };\n\n const reject = (statusCode: number, body?: any) => {\n response.status = \"error\";\n response.statusCode = statusCode;\n response.body = body;\n };\n\n return {\n type: \"WebSocket\" as const,\n connectionId: request.connectionId,\n event: request.event,\n request,\n response,\n logger,\n message<T = Record<string, any>>() {\n if (typeof request.body === \"string\")\n return JSON.parse(request.body || \"{}\") as T;\n return (request.body ?? {}) as T;\n },\n params<T = Record<string, string>>() {\n return {\n ...request.params || {},\n ...request.queryString || {},\n } as T;\n },\n success(body?: any) {\n response.status = \"success\";\n response.body = body;\n },\n error(message: string, code?: ErrorCode, details?: Record<string, any>) {\n reject(500, { message, code, details });\n },\n serverError(err: Error) {\n reject(500, { message: err.message, code: ErrorCode.UNKNOWN_ERROR });\n },\n notFound(resource: string, id?: string | number) {\n const message = id\n ? `${resource} with ID ${id} was not found`\n : `${resource} not found`;\n reject(404, { message });\n },\n unauthorized(body?: any) {\n reject(401, body);\n },\n forbidden(body?: any) {\n reject(403, body);\n },\n validationError(details: Record<string, any>) {\n reject(400, { message: 'Validation failed', details });\n },\n };\n}\n","import { WebSocketFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createWebSocketContext } from \"./create-websocket-context\";\n\ntype Handler = (context: WebSocketFunctionContext) => Promise<void> | void;\n\nexport async function websocketHandler(handler: Handler, ...args: any[]) {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing WebSocket handler with args\");\n const [wsRequest] = cloudFunctions().createWebSocketRequest(...args);\n log.setBindings({ reqId: wsRequest.requestId ?? \"\", module: wsRequest.moduleName ?? \"\" });\n log.debug({\n request: wsRequest,\n }, \"Created WebSocket request\");\n const context = createWebSocketContext(wsRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"WebSocket Handler executed successfully, building response\");\n return cloudFunctions().buildWebSocketResponse(context, ...args);\n }\n catch (error) {\n log.error(error as any);\n throw error;\n }\n}\n","export * from \"./services/event-broker\";\nexport * from \"./services/invoke\";\nexport * from \"./services/storage\";\nexport * from \"./services/locations\";\nexport * from \"./services/functions\";\nexport * from \"./services/functions/cloud-functions\";\nexport * from \"./services/websocket\";\nexport * from \"./services/logger\";\nexport * from \"./provider\";\n\n//export http api types and interfaces\nexport type * from \"./services/functions/http/types\";\n// Exporting types and interfaces from the core-cloud-provider package\nexport type {\n CloudProvider,\n EventBrokerService,\n EventMessage,\n StorageWriteOptions,\n StorageService,\n LocationService,\n LocationAddress,\n LocationSuggestion,\n SuggestionParams,\n ReverseGeocodeParams,\n HttpFunctionContext,\n HTTPRequest,\n HTTPAuth,\n HTTPResponse,\n ScheduleFunctionContext,\n ScheduleRequest,\n EventFunctionContext,\n EventRequest,\n EventResponse,\n WebSocketService,\n WebSocketFunctionContext,\n WebSocketRequest,\n WebSocketResponse,\n InvokeService,\n InvokeFunctionContext,\n InvokeRequest,\n InvokeResponse,\n LoggerService,\n} from \"@cloudnux/core-cloud-provider\";\n\nexport { ErrorCode, WebSocketConnectionGoneError } from \"@cloudnux/core-cloud-provider\";"],"mappings":";AAAA,SAA+C,wBAA+I;;;ACI9L,IAAI,kBAAwC;AAErC,IAAM,cAAc,MAAM;AAC7B,MAAI,iBAAiB;AACjB,WAAO;AAAA,EACX;AACA,oBAAkB,iBAAiB,EAAE,oBAAoB;AACzD,SAAO;AACX;AAEO,IAAM,mBAAmB,MAAM;AAClC,oBAAkB;AACtB;;;ACZA,IAAI,uBAA8C;AAE3C,IAAM,eAAe,MAAM;AAC9B,MAAI,sBAAsB;AACtB,WAAO;AAAA,EACX;AACA,yBAAuB,iBAAiB,EAAE,qBAAqB;AAC/D,SAAO;AACX;AAEO,IAAM,oBAAoB,MAAM;AACnC,yBAAuB;AAC3B;;;ACZA,IAAI,wBAAgD;AAE7C,IAAM,iBAAiB,MAAM;AAChC,MAAI,uBAAuB;AACvB,WAAO;AAAA,EACX;AACA,0BAAwB,iBAAiB,EAAE,sBAAsB;AACjE,SAAO;AACX;AAEO,IAAM,sBAAsB,MAAM;AACrC,0BAAwB;AAC5B;;;ACZA,I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,OAAO;AACV,QAAI,MAAM,KAAY;AACtB,UAAM;AAAA,EACV;AACJ;;;ACkBA,SAAS,aAAAC,YAAW,oCAAoC;","names":["error","ErrorCode","ErrorCode","ErrorCode"]}
1
+ {"version":3,"sources":["../src/provider.ts","../src/services/logger.ts","../src/services/storage.ts","../src/services/locations.ts","../src/services/functions/cloud-functions.ts","../src/services/websocket.ts","../src/services/invoke.ts","../src/services/email.ts","../src/services/event-broker.ts","../src/services/functions/event-broker/create-event-context.ts","../src/services/functions/event-broker/handler.ts","../src/services/functions/http/create-http-context.ts","../src/services/functions/http/halt.ts","../src/services/functions/http/handler.ts","../src/services/functions/invoke/create-invoke-context.ts","../src/services/functions/invoke/handler.ts","../src/services/functions/schedule/create-schedule-context.ts","../src/services/functions/schedule/handler.ts","../src/services/functions/websocket/create-websocket-context.ts","../src/services/functions/websocket/handler.ts","../src/index.ts"],"sourcesContent":["import { CloudProvider, ServiceKind, IService, registerServices, LoggerService, EventBrokerService, StorageService, LocationService, FunctionsService, WebSocketService, InvokeService, EmailService } from \"@cloudnux/core-cloud-provider\";\nimport { cloudLogger, resetCloudLogger } from \"./services/logger\";\nimport { cloudEventBroker, resetCloudEventBroker } from \"./services/event-broker\";\nimport { cloudStorage, resetCloudStorage } from \"./services/storage\";\nimport { cloudLocations, resetCloudLocations } from \"./services/locations\";\nimport { cloudFunctions, resetCloudFunctions } from \"./services/functions/cloud-functions\";\nimport { cloudWebSocket, resetCloudWebSocket } from \"./services/websocket\";\nimport { cloudInvoke, resetCloudInvoke } from \"./services/invoke\";\nimport { cloudEmail, resetCloudEmail } from \"./services/email\";\n\nexport type CloudProviderOptions = {\n serviceFactories?: Partial<Record<ServiceKind, () => IService>>;\n}\n\nlet provider: CloudProvider | null = null;\n\n/**\n * Retrieves the current cloud provider instance.\n * @returns The current cloud provider instance.\n * @throws Will throw an error if the cloud provider is not set\n **/\nexport function getCloudProvider() {\n if (!provider) {\n throw new Error(\"Cloud provider is not defined. Please set a valid cloud provider using useProvider.\");\n }\n return provider;\n}\n\n/**\n * Sets the cloud provider to be used by the SDK.\n * @param cloudProvider - The cloud provider instance to set.\n * @throws Will throw an error if the cloud provider is not provided\n **/\nexport function useCloudProvider(cloudProvider: CloudProvider, options?: CloudProviderOptions) {\n if (!cloudProvider) {\n throw new Error(\"Cloud provider is not defined. Please set a valid cloud provider using useProvider.\");\n }\n const services = {\n \"logger\": cloudLogger,\n \"event-broker\": cloudEventBroker,\n \"storage\": cloudStorage,\n \"location\": cloudLocations,\n \"functions\": cloudFunctions,\n \"websocket\": cloudWebSocket,\n \"invoke\": cloudInvoke,\n \"email\": cloudEmail\n }\n registerServices(services);\n\n //==================================\n provider = {\n ...cloudProvider,\n createLoggerService: (options?.serviceFactories?.logger || cloudProvider.createLoggerService) as () => LoggerService,\n createEventBrokerService: (options?.serviceFactories?.[\"event-broker\"] || cloudProvider.createEventBrokerService) as () => EventBrokerService,\n createStorageService: (options?.serviceFactories?.storage || cloudProvider.createStorageService) as () => StorageService,\n createLocationService: (options?.serviceFactories?.location || cloudProvider.createLocationService) as () => LocationService,\n createFunctionsService: (options?.serviceFactories?.functions || cloudProvider.createFunctionsService) as () => FunctionsService,\n createWebSocketService: (options?.serviceFactories?.websocket || cloudProvider.createWebSocketService) as () => WebSocketService,\n createInvokeService: (options?.serviceFactories?.invoke || cloudProvider.createInvokeService) as () => InvokeService,\n createEmailService: (options?.serviceFactories?.email || cloudProvider.createEmailService) as () => EmailService,\n };\n\n resetCloudLogger();\n resetCloudEventBroker();\n resetCloudStorage();\n resetCloudLocations();\n resetCloudFunctions();\n resetCloudWebSocket();\n resetCloudInvoke();\n resetCloudEmail();\n}","import { LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _loggingService: LoggerService | null = null;\n\nexport const cloudLogger = () => {\n if (_loggingService) {\n return _loggingService;\n }\n _loggingService = getCloudProvider().createLoggerService();\n return _loggingService;\n}\n\nexport const resetCloudLogger = () => {\n _loggingService = null;\n}","import { StorageService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudStorageService: StorageService | null = null;\n\nexport const cloudStorage = () => {\n if (_cloudStorageService) {\n return _cloudStorageService;\n }\n _cloudStorageService = getCloudProvider().createStorageService();\n return _cloudStorageService;\n}\n\nexport const resetCloudStorage = () => {\n _cloudStorageService = null;\n}","import { LocationService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudLocationService: LocationService | null = null;\n\nexport const cloudLocations = () => {\n if (_cloudLocationService) {\n return _cloudLocationService;\n }\n _cloudLocationService = getCloudProvider().createLocationService();\n return _cloudLocationService;\n}\n\nexport const resetCloudLocations = () => {\n _cloudLocationService = null;\n}","import { FunctionsService } from \"@cloudnux/core-cloud-provider\"\n\nimport { getCloudProvider } from \"../../provider\";\n\nlet _cloudFunctionsService: FunctionsService | null = null;\n\nexport const cloudFunctions = () => {\n if (_cloudFunctionsService) {\n return _cloudFunctionsService;\n }\n _cloudFunctionsService = getCloudProvider().createFunctionsService();\n return _cloudFunctionsService;\n}\n\nexport const resetCloudFunctions = () => {\n _cloudFunctionsService = null;\n}","import { WebSocketService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudWebSocket: WebSocketService | null = null;\n\nexport const cloudWebSocket = () => {\n if (_cloudWebSocket) {\n return _cloudWebSocket;\n }\n _cloudWebSocket = getCloudProvider().createWebSocketService();\n return _cloudWebSocket;\n}\n\nexport const resetCloudWebSocket = () => {\n _cloudWebSocket = null;\n}","import { InvokeService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudInvoke: InvokeService | null = null;\n\nexport const cloudInvoke = () => {\n if (_cloudInvoke) {\n return _cloudInvoke;\n }\n _cloudInvoke = getCloudProvider().createInvokeService();\n return _cloudInvoke;\n}\n\nexport const resetCloudInvoke = () => {\n _cloudInvoke = null;\n}\n","import { EmailService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudEmail: EmailService | null = null;\n\nexport const cloudEmail = () => {\n if (_cloudEmail) {\n return _cloudEmail;\n }\n _cloudEmail = getCloudProvider().createEmailService();\n return _cloudEmail;\n}\n\nexport const resetCloudEmail = () => {\n _cloudEmail = null;\n}","import { EventBrokerService } from \"@cloudnux/core-cloud-provider\";\n\nimport { getCloudProvider } from \"../provider\";\n\nlet _cloudEventBroker: EventBrokerService | null = null;\n\nexport const cloudEventBroker = () => {\n if (_cloudEventBroker) {\n return _cloudEventBroker;\n }\n _cloudEventBroker = getCloudProvider().createEventBrokerService();\n return _cloudEventBroker;\n}\n\nexport const resetCloudEventBroker = () => {\n _cloudEventBroker = null;\n}","import { EventResponse, EventFunctionContext, EventRequest, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createEventContext(request: EventRequest, logger: LoggerService): EventFunctionContext {\n const response: EventResponse = {\n status: \"success\" as \"success\" | \"error\",\n body: {} as Record<string, any>\n };\n return {\n timestamp: request.timestamp || new Date(),\n attempts: request.attempts || 0,\n type: \"Event\" as const,\n response,\n request,\n logger,\n message<T = Record<string, any>>() {\n if (typeof request.body === \"string\")\n return JSON.parse(request.body || \"{}\") as T\n return request.body as T\n },\n attributes<T = Record<string, any>>() {\n return request.attributes as T\n },\n\n retryWithDelay(seconds: number) {\n response.status = \"error\";\n response.retryDelay = seconds;\n },\n error(error?: any) {\n response.body = error;\n response.status = \"error\";\n },\n success(body?: any) {\n response.body = body;\n response.status = \"success\";\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n },\n notFound(body?: any) {\n response.body = body || {};\n response.status = \"error\"; // Not found is treated as an error in this context\n }\n }\n}","import { EventFunctionContext, EventBatchItemResult } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createEventContext } from \"./create-event-context\";\n\ntype Handler = (context: EventFunctionContext) => Promise<void>;\n\nexport async function eventBrokerHandler(handler: Handler, ...args: any[]): Promise<EventBatchItemResult> {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Event Broker handler with args\");\n const [eventRequest] = cloudFunctions().createEventRequest(...args);\n log.setBindings({ reqId: eventRequest.requestId ?? \"\", module: eventRequest.moduleName ?? \"\" });\n log.debug({\n request: eventRequest,\n }, \"Created Event Broker request \");\n const context = createEventContext(eventRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Event Broker Handler executed successfully, building response\");\n return await cloudFunctions().buildEventResponse(context);\n }\n catch (error) {\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in Event Broker handler\");\n throw error;\n }\n}","import querystring from \"node:querystring\";\nimport {\n HttpFunctionContext,\n HTTPRequest,\n HTTPResponse,\n LoggerService,\n CookieOptions,\n serializeCookie,\n} from \"@cloudnux/core-cloud-provider\";\n\nimport {\n HttpStatus,\n ApiContentResponse,\n ApiCursorListResponse,\n ApiDeleteResponse,\n ApiError,\n ApiListResponse,\n ErrorCode,\n} from \"./types\";\n\nexport function createHttpContext(\n request: HTTPRequest,\n logger: LoggerService\n): HttpFunctionContext {\n const response: HTTPResponse = {\n body: undefined,\n headers: {},\n status: HttpStatus.OK\n };\n const output = (status: number, body?: string, headers?: any) => {\n response.status = status;\n response.headers = {\n ...response.headers,\n ...headers\n };\n response.body = body;\n };\n const error = (\n statusCode = HttpStatus.INTERNAL_SERVER_ERROR,\n code: ErrorCode = ErrorCode.INTERNAL_SERVER_ERROR,\n message: string = 'An unexpected error occurred',\n details?: Record<string, any>,\n stack?: string\n ) => {\n const error: ApiError = {\n code,\n message,\n details\n };\n\n // Only include stack trace in development\n if (process.env.NODE_ENV !== 'production' && stack) {\n error.stack = stack;\n }\n\n return output(statusCode, JSON.stringify({\n success: false,\n error,\n meta: {\n timestamp: new Date().toISOString()\n }\n }), {\n \"content-type\": \"application/json\"\n });\n }\n\n return {\n type: \"Http\" as const,\n request: request,\n response: response,\n logger,\n model<T = Record<string, any>>() {\n return JSON.parse(request.body || \"{}\") as T\n },\n params<T = Record<string, string>>() {\n return {\n ...request.params || {},\n ...querystring.parse(request.rawQueryString || \"\"),\n } as T;\n },\n\n output(status: number, body?: string | object, headers?: Record<string, string | string[]>) {\n const bodyStr = typeof body === \"string\" ? body : JSON.stringify(body);\n output(status, bodyStr, headers);\n },\n\n error(message: string, code?: ErrorCode, details?: Record<string, any>, stack?: string) {\n error(\n HttpStatus.INTERNAL_SERVER_ERROR,\n code || ErrorCode.INTERNAL_SERVER_ERROR,\n message,\n details,\n stack);\n },\n success<T>(data: T) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data,\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiContentResponse<T>), {\n \"content-type\": \"application/json\"\n })\n },\n list<T>(\n items: T[],\n page: number,\n pageSize: number,\n totalItems: number\n ) {\n const totalPages = Math.ceil(totalItems / pageSize);\n\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: items,\n meta: {\n page,\n pageSize,\n totalItems,\n totalPages,\n timestamp: new Date().toISOString()\n }\n } as ApiListResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n cursorList<T>(\n items: T[],\n nextCursor: string | null,\n pageSize: number,\n prevCursor?: string | null\n ) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: items,\n meta: {\n nextCursor,\n prevCursor,\n pageSize,\n hasMore: nextCursor !== null,\n timestamp: new Date().toISOString()\n }\n } as ApiCursorListResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n created<T>(data: T) {\n return output(HttpStatus.CREATED, JSON.stringify({\n success: true,\n data,\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiContentResponse<T>), {\n \"content-type\": \"application/json\"\n });\n },\n deleted(id?: string | number) {\n return output(HttpStatus.OK, JSON.stringify({\n success: true,\n data: {\n deleted: true,\n id\n },\n meta: {\n timestamp: new Date().toISOString()\n }\n } as ApiDeleteResponse), {\n \"content-type\": \"application/json\"\n });\n },\n notFound(resource: string, id?: string | number) {\n const message = id\n ? `${resource} with ID ${id} was not found`\n : `${resource} not found`;\n\n return error(\n HttpStatus.NOT_FOUND,\n ErrorCode.RESOURCE_NOT_FOUND,\n message\n );\n },\n validationError(details: Record<string, any>) {\n return error(\n HttpStatus.BAD_REQUEST,\n ErrorCode.VALIDATION_ERROR,\n 'Validation failed',\n details\n );\n },\n serverError(err: Error) {\n return error(\n HttpStatus.INTERNAL_SERVER_ERROR,\n ErrorCode.INTERNAL_SERVER_ERROR,\n 'An unexpected error occurred',\n {},\n err.stack\n );\n },\n businessError(message: string, details?: Record<string, any>) {\n return error(\n HttpStatus.UNPROCESSABLE_ENTITY,\n ErrorCode.BUSINESS_RULE_VIOLATION,\n message,\n details\n );\n },\n unauthorized(message = \"Authentication required\") {\n // 401 — caller is not authenticated (no/invalid token)\n return error(HttpStatus.UNAUTHORIZED, ErrorCode.UNAUTHORIZED, message);\n },\n forbidden(message = \"You do not have permission to perform this action\") {\n // 403 — caller IS authenticated but lacks permission\n return error(HttpStatus.FORBIDDEN, ErrorCode.ACCESS_DENIED, message);\n },\n setCookie(name: string, value: string, options?: CookieOptions) {\n response.cookies = [...(response.cookies ?? []), serializeCookie(name, value, options)];\n },\n deleteCookie(name: string, options?: Pick<CookieOptions, \"path\" | \"domain\">) {\n response.cookies = [...(response.cookies ?? []), serializeCookie(name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0),\n })];\n }\n };\n}\n","/**\n * Thrown by a compose enhancer to stop the handler chain after it has\n * already written a response onto the context (e.g. `ctx.unauthorized()`).\n * `httpHandler` catches this and builds the response instead of rethrowing.\n */\nexport class HttpHalt extends Error {}\n","import { HttpFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createHttpContext } from \"./create-http-context\";\nimport { HttpHalt } from \"./halt\";\n\ntype HttpHandler = (context: HttpFunctionContext) => Promise<void> | void;\n\nexport async function httpHandler(handler: HttpHandler, ...args: any[]) {\n const log = cloudLogger();\n const [httpRequest] = cloudFunctions().createHttRequest(...args);\n log.setBindings({ reqId: httpRequest.requestId ?? \"\", module: httpRequest.moduleName ?? \"\" });\n log.debug({ httpRequest }, \"Created HTTP request\");\n const context = createHttpContext(httpRequest, log);\n try {\n log.debug({ args }, \"Executing HTTP handler with args\");\n await handler(context);\n log.debug({ response: context.response }, \"Handler executed successfully, building HTTP response\");\n return cloudFunctions().buildHttpResponse(context, ...args);\n }\n catch (error) {\n if (error instanceof HttpHalt) {\n log.debug({ response: context.response }, \"Handler chain halted, building HTTP response\");\n return cloudFunctions().buildHttpResponse(context, ...args);\n }\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in HTTP handler\");\n throw error;\n }\n}","import { InvokeRequest, InvokeResponse, InvokeFunctionContext, ErrorCode, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createInvokeContext(request: InvokeRequest, logger: LoggerService): InvokeFunctionContext {\n const response: InvokeResponse = {\n status: \"success\",\n };\n return {\n type: \"Invoke\" as const,\n request,\n response,\n logger,\n payload<T = Record<string, any>>() {\n return request.payload as T;\n },\n success(data: any) {\n response.status = \"success\";\n response.body = data;\n },\n error(message: string, code?: ErrorCode) {\n response.status = \"error\";\n response.body = message;\n response.code = code;\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n response.code = ErrorCode.UNKNOWN_ERROR;\n },\n notFound(resource: string, id?: string | number) {\n response.status = \"error\";\n response.code = ErrorCode.RESOURCE_NOT_FOUND;\n response.body = id ? `${resource} ${id} not found` : `${resource} not found`;\n }\n }\n}\n","import { InvokeFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createInvokeContext } from \"./create-invoke-context\";\n\ntype InvokeHandler = (context: InvokeFunctionContext) => Promise<void> | void;\n\nexport async function invokeHandler(handler: InvokeHandler, ...args: any[]): Promise<any> {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Invoke handler with args\");\n const [invokeRequest] = cloudFunctions().createInvokeRequest(...args);\n log.setBindings({ reqId: invokeRequest.requestId ?? \"\", module: invokeRequest.calledModule ?? \"\" });\n log.debug({ request: invokeRequest }, \"Created Invoke request\");\n const context = createInvokeContext(invokeRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Invoke Handler executed successfully, building response\");\n return cloudFunctions().buildInvokeResponse(context, ...args);\n }\n catch (error) {\n log.error({ error }, \"Error in Invoke handler\");\n throw error;\n }\n}\n","import { ScheduleFunctionContext, ScheduleRequest, ScheduleResponse, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createScheduleContext(request: ScheduleRequest, logger: LoggerService): ScheduleFunctionContext {\n const response: ScheduleResponse = {\n status: \"error\",\n body: null as any\n };\n\n return {\n type: \"Schedule\",\n request,\n response,\n logger,\n success: (body?: any) => {\n response.status = \"success\";\n response.body = body;\n },\n\n error: (body?: any) => {\n response.status = \"error\";\n response.body = body;\n },\n serverError(err: Error) {\n response.status = \"error\";\n response.body = err;\n },\n notFound: (body?: any) => {\n response.status = \"error\";\n response.body = body;\n }\n }\n}","import { ScheduleFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createScheduleContext } from \"./create-schedule-context\";\n\ntype Handler = (context: ScheduleFunctionContext) => Promise<void> | void;\n\nexport async function scheduleHandler(handler: Handler, ...args: any[]) {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing Schedule handler with args\");\n const [scheduleRequest] = cloudFunctions().createScheduleRequest(...args);\n log.setBindings({ reqId: scheduleRequest.requestId ?? \"\", module: scheduleRequest.moduleName ?? \"\" });\n log.debug({\n request: scheduleRequest,\n }, \"Created Schedule request \");\n const context = createScheduleContext(scheduleRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"Schedule Handler executed successfully, building response\");\n return cloudFunctions().buildScheduleResponse(context);\n }\n catch (error) {\n // Log the error and re-throw it for further handling\n log.error({ error }, \"Error in Schedule handler\");\n throw error;\n }\n}","import { ErrorCode, WebSocketFunctionContext, WebSocketRequest, WebSocketResponse, LoggerService } from \"@cloudnux/core-cloud-provider\";\n\nexport function createWebSocketContext(request: WebSocketRequest, logger: LoggerService): WebSocketFunctionContext {\n const response: WebSocketResponse = {\n status: \"success\",\n body: {} as any,\n statusCode: 101,\n };\n\n const reject = (statusCode: number, body?: any) => {\n response.status = \"error\";\n response.statusCode = statusCode;\n response.body = body;\n };\n\n return {\n type: \"WebSocket\" as const,\n connectionId: request.connectionId,\n event: request.event,\n request,\n response,\n logger,\n message<T = Record<string, any>>() {\n if (typeof request.body === \"string\")\n return JSON.parse(request.body || \"{}\") as T;\n return (request.body ?? {}) as T;\n },\n params<T = Record<string, string>>() {\n return {\n ...request.params || {},\n ...request.queryString || {},\n } as T;\n },\n success(body?: any) {\n response.status = \"success\";\n response.body = body;\n },\n error(message: string, code?: ErrorCode, details?: Record<string, any>) {\n reject(500, { message, code, details });\n },\n serverError(err: Error) {\n reject(500, { message: err.message, code: ErrorCode.UNKNOWN_ERROR });\n },\n notFound(resource: string, id?: string | number) {\n const message = id\n ? `${resource} with ID ${id} was not found`\n : `${resource} not found`;\n reject(404, { message });\n },\n unauthorized(body?: any) {\n reject(401, body);\n },\n forbidden(body?: any) {\n reject(403, body);\n },\n validationError(details: Record<string, any>) {\n reject(400, { message: 'Validation failed', details });\n },\n };\n}\n","import { WebSocketFunctionContext } from \"@cloudnux/core-cloud-provider\";\n\nimport { cloudFunctions } from \"../cloud-functions\";\nimport { cloudLogger } from \"../../logger\";\nimport { createWebSocketContext } from \"./create-websocket-context\";\n\ntype Handler = (context: WebSocketFunctionContext) => Promise<void> | void;\n\nexport async function websocketHandler(handler: Handler, ...args: any[]) {\n const log = cloudLogger();\n try {\n log.debug({ args }, \"Executing WebSocket handler with args\");\n const [wsRequest] = cloudFunctions().createWebSocketRequest(...args);\n log.setBindings({ reqId: wsRequest.requestId ?? \"\", module: wsRequest.moduleName ?? \"\" });\n log.debug({\n request: wsRequest,\n }, \"Created WebSocket request\");\n const context = createWebSocketContext(wsRequest, log);\n await handler(context);\n log.debug({ response: context.response }, \"WebSocket Handler executed successfully, building response\");\n return cloudFunctions().buildWebSocketResponse(context, ...args);\n }\n catch (error) {\n log.error(error as any);\n throw error;\n }\n}\n","export * from \"./services/event-broker\";\nexport * from \"./services/invoke\";\nexport * from \"./services/storage\";\nexport * from \"./services/locations\";\nexport * from \"./services/functions\";\nexport * from \"./services/functions/cloud-functions\";\nexport * from \"./services/websocket\";\nexport * from \"./services/logger\";\nexport * from \"./services/email\";\nexport * from \"./provider\";\n\n//export http api types and interfaces\nexport type * from \"./services/functions/http/types\";\n// Exporting types and interfaces from the core-cloud-provider package\nexport type {\n CloudProvider,\n EventBrokerService,\n EventMessage,\n StorageWriteOptions,\n StorageService,\n LocationService,\n LocationAddress,\n LocationSuggestion,\n SuggestionParams,\n ReverseGeocodeParams,\n HttpFunctionContext,\n HTTPRequest,\n HTTPResponse,\n CookieOptions,\n SameSite,\n ScheduleFunctionContext,\n ScheduleRequest,\n EventFunctionContext,\n EventRequest,\n EventResponse,\n WebSocketService,\n WebSocketFunctionContext,\n WebSocketRequest,\n WebSocketResponse,\n InvokeService,\n InvokeFunctionContext,\n InvokeRequest,\n InvokeResponse,\n LoggerService,\n EmailService,\n EmailMessage,\n EmailAttachment,\n EmailSendResult,\n} from \"@cloudnux/core-cloud-provider\";\n\nexport { ErrorCode, WebSocketConnectionGoneError } from \"@cloudnux/core-cloud-provider\";\n\nexport { HttpHalt } from \"./services/functions/http/halt\";"],"mappings":";AAAA,SAA+C,wBAA6J;;;ACI5M,IAAI,kBAAwC;AAErC,IAAM,cAAc,MAAM;AAC7B,MAAI,iBAAiB;AACjB,WAAO;AAAA,EACX;AACA,oBAAkB,iBAAiB,EAAE,oB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S,GAAG,IAAI;AAAA,EACnE,SACO,OAAO;AACV,QAAI,MAAM,KAAY;AACtB,UAAM;AAAA,EACV;AACJ;;;ACwBA,SAAS,aAAAC,YAAW,oCAAoC;","names":["error","ErrorCode","ErrorCode","ErrorCode"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudnux/cloud-sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "CloudNux SDK for interacting with cloud providers and services",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "clean": "rm -rf dist"
33
33
  },
34
34
  "dependencies": {
35
- "@cloudnux/core-cloud-provider": "0.20.0"
35
+ "@cloudnux/core-cloud-provider": "0.21.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^24.10.1"