@cloudnux/cloud-sdk 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@cloudnux/cloud-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "CloudNux SDK for interacting with cloud providers and services",
5
5
  "license": "MIT",
6
+ "type": "module",
6
7
  "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js"
12
+ "import": "./dist/index.js"
14
13
  }
15
14
  },
16
15
  "files": [
@@ -27,14 +26,13 @@
27
26
  "yalc:publish": "yalc publish --private",
28
27
  "yalc:push": "yalc push --private",
29
28
  "build": "tsup",
30
- "dev": "tsup --watch",
31
29
  "lint": "eslint . --max-warnings 0",
32
30
  "lint:fix": "eslint . --fix",
33
31
  "type-check": "tsc --noEmit",
34
32
  "clean": "rm -rf dist"
35
33
  },
36
34
  "dependencies": {
37
- "@cloudnux/core-cloud-provider": "0.1.0"
35
+ "@cloudnux/core-cloud-provider": "0.2.0"
38
36
  },
39
37
  "publishConfig": {
40
38
  "access": "public",
package/dist/index.d.mts DELETED
@@ -1,111 +0,0 @@
1
- import { EventBrokerService, StorageService, LocationService, EventFunctionContext, HttpFunctionContext, ScheduleFunctionContext, CloudProvider } from '@cloudnux/core-cloud-provider';
2
- export { CloudProvider, EventBrokerService, EventFunctionContext, EventMessage, EventRequest, EventResponse, HTTPAuth, HTTPRequest, HTTPResponse, HttpFunctionContext, LocationService, PlaceDetails, PlaceSearchOptions, PlaceSearchResult, ScheduleFunctionContext, ScheduleRequest, StorageService, StorageWriteOptions } from '@cloudnux/core-cloud-provider';
3
-
4
- declare const cloudEventBroker: () => EventBrokerService;
5
-
6
- declare const cloudStorage: () => StorageService;
7
-
8
- declare const cloudLocations: () => LocationService;
9
-
10
- type Handler$1 = (context: EventFunctionContext) => Promise<void>;
11
- declare function eventBrokerHandler(handler: Handler$1, ...args: any[]): Promise<any>;
12
-
13
- type HttpHandler = (context: HttpFunctionContext) => Promise<void>;
14
- declare function httpHandler(handler: HttpHandler, ...args: any[]): Promise<any>;
15
-
16
- type Handler = (context: ScheduleFunctionContext) => Promise<void>;
17
- declare function scheduleHandler(handler: Handler, ...args: any[]): Promise<any>;
18
-
19
- /**
20
- * Retrieves the current cloud provider instance.
21
- * @returns The current cloud provider instance.
22
- * @throws Will throw an error if the cloud provider is not set
23
- **/
24
- declare function getCloudProvider(): CloudProvider;
25
- /**
26
- * Sets the cloud provider to be used by the SDK.
27
- * @param cloudProvider - The cloud provider instance to set.
28
- * @throws Will throw an error if the cloud provider is not provided
29
- **/
30
- declare function useCloudProvider(cloudProvider: CloudProvider): void;
31
-
32
- type ApiResponse<T = any> = {
33
- success: boolean;
34
- data?: T;
35
- error?: ApiError;
36
- meta?: ApiResponseMeta;
37
- };
38
- type ApiError = {
39
- code: string;
40
- message: string;
41
- details?: Record<string, any>;
42
- stack?: string;
43
- };
44
- type ApiResponseMeta = {
45
- page?: number;
46
- pageSize?: number;
47
- totalItems?: number;
48
- totalPages?: number;
49
- timestamp?: string;
50
- requestId?: string;
51
- };
52
- interface ApiContentResponse<T> extends ApiResponse<T> {
53
- data: T;
54
- }
55
- interface ApiListResponse<T> extends ApiResponse<T[]> {
56
- data: T[];
57
- meta: {
58
- page: number;
59
- pageSize: number;
60
- totalItems: number;
61
- totalPages: number;
62
- timestamp: string;
63
- };
64
- }
65
- interface ApiDeleteResponse extends ApiResponse<{
66
- deleted: boolean;
67
- }> {
68
- data: {
69
- deleted: boolean;
70
- id?: string | number;
71
- };
72
- }
73
- interface ErrorResponse extends ApiResponse {
74
- success: false;
75
- error: ApiError;
76
- }
77
- /**
78
- * HTTP status codes mapped to descriptive names
79
- */
80
- declare enum HttpStatus {
81
- OK = 200,
82
- CREATED = 201,
83
- NO_CONTENT = 204,
84
- BAD_REQUEST = 400,
85
- UNAUTHORIZED = 401,
86
- FORBIDDEN = 403,
87
- NOT_FOUND = 404,
88
- CONFLICT = 409,
89
- UNPROCESSABLE_ENTITY = 422,
90
- INTERNAL_SERVER_ERROR = 500
91
- }
92
- /**
93
- * Error codes for API error responses
94
- */
95
- declare enum ErrorCode {
96
- VALIDATION_ERROR = "VALIDATION_ERROR",
97
- INVALID_INPUT = "INVALID_INPUT",
98
- UNAUTHORIZED = "UNAUTHORIZED",
99
- ACCESS_DENIED = "ACCESS_DENIED",
100
- RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
101
- RESOURCE_ALREADY_EXISTS = "RESOURCE_ALREADY_EXISTS",
102
- RESOURCE_CONFLICT = "RESOURCE_CONFLICT",
103
- INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
104
- SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
105
- DATABASE_ERROR = "DATABASE_ERROR",
106
- BUSINESS_RULE_VIOLATION = "BUSINESS_RULE_VIOLATION",
107
- EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
108
- UNKNOWN_ERROR = "UNKNOWN_ERROR"
109
- }
110
-
111
- export { type ApiContentResponse, type ApiDeleteResponse, type ApiError, type ApiListResponse, type ApiResponse, type ApiResponseMeta, ErrorCode, type ErrorResponse, HttpStatus, cloudEventBroker, cloudLocations, cloudStorage, eventBrokerHandler, getCloudProvider, httpHandler, scheduleHandler, useCloudProvider };