@flightloop/sdk-frontend 0.0.0-stage → 1.0.0-qa.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 (134) hide show
  1. package/README.md +145 -2
  2. package/dist/cjs/core/airspace/index.js +14 -0
  3. package/dist/cjs/core/airspace/index.js.map +1 -0
  4. package/dist/cjs/core/airspace/validation-client.js +112 -0
  5. package/dist/cjs/core/airspace/validation-client.js.map +1 -0
  6. package/dist/cjs/core/formatters/index.js +41 -0
  7. package/dist/cjs/core/formatters/index.js.map +1 -0
  8. package/dist/cjs/core/geometry/circle.js +137 -0
  9. package/dist/cjs/core/geometry/circle.js.map +1 -0
  10. package/dist/cjs/core/geometry/index.js +26 -0
  11. package/dist/cjs/core/geometry/index.js.map +1 -0
  12. package/dist/cjs/core/geometry/operations.js +169 -0
  13. package/dist/cjs/core/geometry/operations.js.map +1 -0
  14. package/dist/cjs/core/geometry/polygon.js +183 -0
  15. package/dist/cjs/core/geometry/polygon.js.map +1 -0
  16. package/dist/cjs/core/index.js +29 -0
  17. package/dist/cjs/core/index.js.map +1 -0
  18. package/dist/cjs/core/transformers/index.js +33 -0
  19. package/dist/cjs/core/transformers/index.js.map +1 -0
  20. package/dist/cjs/core/utils/constants.js +124 -0
  21. package/dist/cjs/core/utils/constants.js.map +1 -0
  22. package/dist/cjs/core/utils/helpers.js +98 -0
  23. package/dist/cjs/core/utils/helpers.js.map +1 -0
  24. package/dist/cjs/core/utils/index.js +35 -0
  25. package/dist/cjs/core/utils/index.js.map +1 -0
  26. package/dist/cjs/core/utils/timezone.js +52 -0
  27. package/dist/cjs/core/utils/timezone.js.map +1 -0
  28. package/dist/cjs/core/validation/index.js +26 -0
  29. package/dist/cjs/core/validation/index.js.map +1 -0
  30. package/dist/cjs/core/validation/operator.validator.js +156 -0
  31. package/dist/cjs/core/validation/operator.validator.js.map +1 -0
  32. package/dist/cjs/index.js +32 -0
  33. package/dist/cjs/index.js.map +1 -0
  34. package/dist/cjs/react/hooks/index.js +41 -0
  35. package/dist/cjs/react/hooks/index.js.map +1 -0
  36. package/dist/cjs/react/index.js +20 -0
  37. package/dist/cjs/react/index.js.map +1 -0
  38. package/dist/cjs/types/airspace.types.js +22 -0
  39. package/dist/cjs/types/airspace.types.js.map +1 -0
  40. package/dist/cjs/types/authorization.types.js +3 -0
  41. package/dist/cjs/types/authorization.types.js.map +1 -0
  42. package/dist/cjs/types/geometry.types.js +4 -0
  43. package/dist/cjs/types/geometry.types.js.map +1 -0
  44. package/dist/cjs/types/index.js +7 -0
  45. package/dist/cjs/types/index.js.map +1 -0
  46. package/dist/esm/core/airspace/index.js +9 -0
  47. package/dist/esm/core/airspace/index.js.map +1 -0
  48. package/dist/esm/core/airspace/validation-client.js +107 -0
  49. package/dist/esm/core/airspace/validation-client.js.map +1 -0
  50. package/dist/esm/core/formatters/index.js +35 -0
  51. package/dist/esm/core/formatters/index.js.map +1 -0
  52. package/dist/esm/core/geometry/circle.js +98 -0
  53. package/dist/esm/core/geometry/circle.js.map +1 -0
  54. package/dist/esm/core/geometry/index.js +7 -0
  55. package/dist/esm/core/geometry/index.js.map +1 -0
  56. package/dist/esm/core/geometry/operations.js +125 -0
  57. package/dist/esm/core/geometry/operations.js.map +1 -0
  58. package/dist/esm/core/geometry/polygon.js +145 -0
  59. package/dist/esm/core/geometry/polygon.js.map +1 -0
  60. package/dist/esm/core/index.js +13 -0
  61. package/dist/esm/core/index.js.map +1 -0
  62. package/dist/esm/core/transformers/index.js +28 -0
  63. package/dist/esm/core/transformers/index.js.map +1 -0
  64. package/dist/esm/core/utils/constants.js +121 -0
  65. package/dist/esm/core/utils/constants.js.map +1 -0
  66. package/dist/esm/core/utils/helpers.js +83 -0
  67. package/dist/esm/core/utils/helpers.js.map +1 -0
  68. package/dist/esm/core/utils/index.js +7 -0
  69. package/dist/esm/core/utils/index.js.map +1 -0
  70. package/dist/esm/core/utils/timezone.js +47 -0
  71. package/dist/esm/core/utils/timezone.js.map +1 -0
  72. package/dist/esm/core/validation/index.js +10 -0
  73. package/dist/esm/core/validation/index.js.map +1 -0
  74. package/dist/esm/core/validation/operator.validator.js +150 -0
  75. package/dist/esm/core/validation/operator.validator.js.map +1 -0
  76. package/dist/esm/index.js +15 -0
  77. package/dist/esm/index.js.map +1 -0
  78. package/dist/esm/react/hooks/index.js +35 -0
  79. package/dist/esm/react/hooks/index.js.map +1 -0
  80. package/dist/esm/react/index.js +4 -0
  81. package/dist/esm/react/index.js.map +1 -0
  82. package/dist/esm/types/airspace.types.js +19 -0
  83. package/dist/esm/types/airspace.types.js.map +1 -0
  84. package/dist/esm/types/authorization.types.js +2 -0
  85. package/dist/esm/types/authorization.types.js.map +1 -0
  86. package/dist/esm/types/geometry.types.js +3 -0
  87. package/dist/esm/types/geometry.types.js.map +1 -0
  88. package/dist/esm/types/index.js +3 -0
  89. package/dist/esm/types/index.js.map +1 -0
  90. package/dist/types/core/airspace/index.d.ts +8 -0
  91. package/dist/types/core/airspace/index.d.ts.map +1 -0
  92. package/dist/types/core/airspace/validation-client.d.ts +86 -0
  93. package/dist/types/core/airspace/validation-client.d.ts.map +1 -0
  94. package/dist/types/core/formatters/index.d.ts +28 -0
  95. package/dist/types/core/formatters/index.d.ts.map +1 -0
  96. package/dist/types/core/geometry/circle.d.ts +33 -0
  97. package/dist/types/core/geometry/circle.d.ts.map +1 -0
  98. package/dist/types/core/geometry/index.d.ts +4 -0
  99. package/dist/types/core/geometry/index.d.ts.map +1 -0
  100. package/dist/types/core/geometry/operations.d.ts +72 -0
  101. package/dist/types/core/geometry/operations.d.ts.map +1 -0
  102. package/dist/types/core/geometry/polygon.d.ts +25 -0
  103. package/dist/types/core/geometry/polygon.d.ts.map +1 -0
  104. package/dist/types/core/index.d.ts +7 -0
  105. package/dist/types/core/index.d.ts.map +1 -0
  106. package/dist/types/core/transformers/index.d.ts +26 -0
  107. package/dist/types/core/transformers/index.d.ts.map +1 -0
  108. package/dist/types/core/utils/constants.d.ts +116 -0
  109. package/dist/types/core/utils/constants.d.ts.map +1 -0
  110. package/dist/types/core/utils/helpers.d.ts +53 -0
  111. package/dist/types/core/utils/helpers.d.ts.map +1 -0
  112. package/dist/types/core/utils/index.d.ts +4 -0
  113. package/dist/types/core/utils/index.d.ts.map +1 -0
  114. package/dist/types/core/utils/timezone.d.ts +23 -0
  115. package/dist/types/core/utils/timezone.d.ts.map +1 -0
  116. package/dist/types/core/validation/index.d.ts +9 -0
  117. package/dist/types/core/validation/index.d.ts.map +1 -0
  118. package/dist/types/core/validation/operator.validator.d.ts +35 -0
  119. package/dist/types/core/validation/operator.validator.d.ts.map +1 -0
  120. package/dist/types/index.d.ts +12 -0
  121. package/dist/types/index.d.ts.map +1 -0
  122. package/dist/types/react/hooks/index.d.ts +27 -0
  123. package/dist/types/react/hooks/index.d.ts.map +1 -0
  124. package/dist/types/react/index.d.ts +2 -0
  125. package/dist/types/react/index.d.ts.map +1 -0
  126. package/dist/types/types/airspace.types.d.ts +109 -0
  127. package/dist/types/types/airspace.types.d.ts.map +1 -0
  128. package/dist/types/types/authorization.types.d.ts +124 -0
  129. package/dist/types/types/authorization.types.d.ts.map +1 -0
  130. package/dist/types/types/geometry.types.d.ts +77 -0
  131. package/dist/types/types/geometry.types.d.ts.map +1 -0
  132. package/dist/types/types/index.d.ts +5 -0
  133. package/dist/types/types/index.d.ts.map +1 -0
  134. package/package.json +84 -4
package/README.md CHANGED
@@ -1,3 +1,146 @@
1
- # Temporary Holding Version
1
+ # @flyzone/sdk-frontend
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Frontend SDK for LAANC authorization - provides UI components and business logic for drone flight authorization.
4
+
5
+ ## Overview
6
+
7
+ This SDK provides framework-agnostic core functionality for processing LAANC (Low Altitude Authorization and Notification Capability) authorizations in frontend applications. It includes optional React hooks for easier integration with React applications.
8
+
9
+ ## Features
10
+
11
+ - **Framework-Agnostic Core**: Pure TypeScript business logic that works with any frontend framework
12
+ - **Geometry Management**: Create and validate circles and polygons for operation areas
13
+ - **Authorization Processing**: Process airspace features and determine authorization requirements
14
+ - **Validation Utilities**: Comprehensive validation for altitude, date/time, geometry, and operator data
15
+ - **React Hooks** (Optional): Pre-built hooks for React applications
16
+ - **TypeScript Support**: Full TypeScript definitions included
17
+ - **Tree-Shakeable**: ESM and CJS builds with proper tree-shaking support
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @flyzone/sdk-frontend @flyzone/sdk-core
23
+ ```
24
+
25
+ ### Peer Dependencies
26
+
27
+ ```bash
28
+ # Required
29
+ npm install @flyzone/sdk-core
30
+
31
+ # Optional (only if using React hooks)
32
+ npm install react@^18.0.0
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### Core SDK (Framework-Agnostic)
38
+
39
+ ```typescript
40
+ import { createCircle, validateAltitude, detectTimezone } from '@flyzone/sdk-frontend';
41
+
42
+ // Create a circular operation area
43
+ const operationArea = createCircle(
44
+ { lat: 37.7749, lng: -122.4194 },
45
+ 1000 // radius in feet
46
+ );
47
+
48
+ // Validate altitude
49
+ const altitudeValidation = validateAltitude(200, 'Part 107');
50
+
51
+ // Auto-detect timezone
52
+ const timezone = detectTimezone(37.7749, -122.4194);
53
+ ```
54
+
55
+ ### React Hooks (Coming Soon)
56
+
57
+ ```typescript
58
+ import { useGeometry, useAuthorization } from '@flyzone/sdk-frontend/react';
59
+
60
+ function MyComponent() {
61
+ const geometry = useGeometry('circle');
62
+ const { processAuthorization } = useAuthorization();
63
+
64
+ // Use the hooks...
65
+ }
66
+ ```
67
+
68
+ ## Architecture
69
+
70
+ ```
71
+ @flyzone/sdk-frontend/
72
+ ├── core/ # Framework-agnostic core logic
73
+ │ ├── geometry/ # Geometry creation & validation
74
+ │ ├── airspace/ # Airspace processing (coming soon)
75
+ │ ├── validation/ # Input validation & business rules
76
+ │ ├── formatters/ # Data transformation (coming soon)
77
+ │ ├── transformers/ # Map provider adapters (coming soon)
78
+ │ └── utils/ # Shared utilities
79
+ ├── react/ # React-specific hooks (coming soon)
80
+ └── types/ # TypeScript definitions
81
+ ```
82
+
83
+ ## Development Status
84
+
85
+ **Current Version:** 1.0.0 - **Phase 1 Complete**
86
+
87
+ ### ✅ Phase 1: Automatic Authorization (COMPLETED)
88
+ - ✅ Project structure and TypeScript configuration
89
+ - ✅ Geometry module (circle, polygon, operations)
90
+ - ✅ Validation module (altitude, date/time, operator)
91
+ - ✅ Type definitions for all modules
92
+ - ✅ Utility functions and constants
93
+ - ✅ **Feature categorization** - Organize airspace features by type
94
+ - ✅ **UASFM processing** - Extract ceiling data for auto-approval
95
+ - ✅ **Restriction detection** - TFR, Class B/C/D/E, DC FRZ, NSUFR, Special Use
96
+ - ✅ **Advisory generation** - Create, deduplicate, prioritize advisories
97
+ - ✅ **Summary determination** - Generate authorization summary (OK/ALERT/CAUTION/DNF/NOK)
98
+ - ✅ **Main processor** - `processAuthorization()` function complete
99
+ - ✅ Usage examples and documentation
100
+
101
+ ### 📋 Phase 2: Further Coordination (PLANNED)
102
+ - 📋 FC overlay generation for altitudes exceeding ceiling
103
+ - 📋 FC lead time validation (72 hours to 90 days)
104
+ - 📋 Scheduled airspace temporal validation
105
+ - 📋 FC-specific advisory generation
106
+ - 📋 Authorization requirement tracking
107
+
108
+ ### 📋 Future Enhancements
109
+ - 📋 Feature transformers for different map providers
110
+ - 📋 React hooks (useGeometry, useAuthorization, etc.)
111
+ - 📋 Complete test coverage (Jest ESM config for @turf)
112
+ - 📋 UI component library (optional)
113
+
114
+ ## Building
115
+
116
+ ```bash
117
+ # Install dependencies
118
+ npm install
119
+
120
+ # Build all formats (CJS, ESM, types)
121
+ npm run build
122
+
123
+ # Run tests
124
+ npm test
125
+
126
+ # Run linting
127
+ npm run lint
128
+ ```
129
+
130
+ ## User Responsibilities
131
+
132
+ When using this SDK, users are responsible for:
133
+
134
+ 1. **Map rendering and interaction** - The SDK does not render maps
135
+ 2. **Querying airspace layers** - Users query their map and pass features to the SDK
136
+ 3. **Fetching external data** - TFRs, SEAMS, etc. must be fetched by the user
137
+ 4. **UI components** - The SDK provides logic; users build or use their own UI
138
+ 5. **Backend API calls** - Use `@flyzone/sdk-backend` for API integration
139
+
140
+ ## License
141
+
142
+ MIT
143
+
144
+ ## Support
145
+
146
+ For issues and questions, please visit the [GitHub repository](https://github.com/flyzone/sdk-frontend).
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Airspace validation client
4
+ *
5
+ * This module provides an HTTP client for validating flight operations
6
+ * against LAANC airspace restrictions by calling your backend service.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createValidationClient = exports.ValidationClient = void 0;
10
+ // ─── Validation Client (HTTP client for your backend) ───────────────────────
11
+ var validation_client_1 = require("./validation-client");
12
+ Object.defineProperty(exports, "ValidationClient", { enumerable: true, get: function () { return validation_client_1.ValidationClient; } });
13
+ Object.defineProperty(exports, "createValidationClient", { enumerable: true, get: function () { return validation_client_1.createValidationClient; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/airspace/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+EAA+E;AAC/E,yDAI6B;AAH3B,qHAAA,gBAAgB,OAAA;AAChB,2HAAA,sBAAsB,OAAA"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Validation Client - HTTP client for calling your backend validation service
4
+ *
5
+ * This module provides an HTTP client for validating flight operations against
6
+ * LAANC airspace restrictions by calling your backend service, which in turn
7
+ * uses the flyzone-backend SDK to call the Flyzone API.
8
+ *
9
+ * Flow: Frontend App → Your Backend Service → Flyzone API
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ValidationClient = void 0;
13
+ exports.createValidationClient = createValidationClient;
14
+ /**
15
+ * HTTP client for airspace validation
16
+ *
17
+ * This client calls YOUR backend service, which should use the flyzone-backend
18
+ * SDK to communicate with the Flyzone API.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { createValidationClient } from '@flyzone/sdk-frontend';
23
+ *
24
+ * const validationClient = createValidationClient({
25
+ * backendBaseURL: 'https://your-backend.com',
26
+ * headers: {
27
+ * 'Authorization': 'Bearer your-user-token'
28
+ * }
29
+ * });
30
+ *
31
+ * const result = await validationClient.validate({
32
+ * geometry: {
33
+ * type: 'Polygon',
34
+ * coordinates: [[[lon, lat], ...]]
35
+ * },
36
+ * startTime: '2024-03-15T14:00:00Z',
37
+ * endTime: '2024-03-15T16:00:00Z',
38
+ * timezone: 'America/Los_Angeles',
39
+ * maxAltitude: 100,
40
+ * });
41
+ * ```
42
+ */
43
+ class ValidationClient {
44
+ constructor(config) {
45
+ this.config = {
46
+ backendBaseURL: config.backendBaseURL.replace(/\/$/, ''), // Remove trailing slash
47
+ validationPath: config.validationPath ?? '/api/airspace/validate',
48
+ headers: config.headers ?? {},
49
+ timeout: config.timeout ?? 30000,
50
+ };
51
+ }
52
+ /**
53
+ * Validates a flight operation against LAANC airspace restrictions
54
+ *
55
+ * @param params - Validation request parameters
56
+ * @returns Promise resolving to validation response
57
+ * @throws Error if the request fails or times out
58
+ */
59
+ async validate(params) {
60
+ const url = `${this.config.backendBaseURL}${this.config.validationPath}`;
61
+ const controller = new AbortController();
62
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
63
+ try {
64
+ const response = await fetch(url, {
65
+ method: 'POST',
66
+ headers: {
67
+ 'Content-Type': 'application/json',
68
+ ...this.config.headers,
69
+ },
70
+ body: JSON.stringify(params),
71
+ signal: controller.signal,
72
+ });
73
+ if (!response.ok) {
74
+ const errorData = await response.json().catch(() => ({}));
75
+ throw new Error(`Validation request failed: ${response.status} ${response.statusText}. ${errorData.message || ''}`);
76
+ }
77
+ const data = await response.json();
78
+ return data;
79
+ }
80
+ catch (error) {
81
+ if (error instanceof Error) {
82
+ if (error.name === 'AbortError') {
83
+ throw new Error(`Validation request timed out after ${this.config.timeout}ms`);
84
+ }
85
+ throw error;
86
+ }
87
+ throw new Error('Unknown error during validation request');
88
+ }
89
+ finally {
90
+ clearTimeout(timeoutId);
91
+ }
92
+ }
93
+ /**
94
+ * Updates the authentication token or other headers
95
+ *
96
+ * @param headers - New headers to merge with existing headers
97
+ */
98
+ updateHeaders(headers) {
99
+ Object.assign(this.config.headers, headers);
100
+ }
101
+ }
102
+ exports.ValidationClient = ValidationClient;
103
+ /**
104
+ * Factory function to create a validation client
105
+ *
106
+ * @param config - Client configuration
107
+ * @returns ValidationClient instance
108
+ */
109
+ function createValidationClient(config) {
110
+ return new ValidationClient(config);
111
+ }
112
+ //# sourceMappingURL=validation-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-client.js","sourceRoot":"","sources":["../../../../src/core/airspace/validation-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA6IH,wDAIC;AAjHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,gBAAgB;IAG3B,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG;YACZ,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,wBAAwB;YAClF,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,wBAAwB;YACjE,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;SACjC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CACZ,MAAiC;QAEjC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAEzE,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE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AC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF;AAxED,4CAwEC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,MAA8B;IAE9B,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Data formatting utilities
4
+ *
5
+ * This module provides utilities to format data for API submission
6
+ * and UI display.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.formatOperationPayload = formatOperationPayload;
10
+ exports.formatDateTime = formatDateTime;
11
+ exports.formatAdvisories = formatAdvisories;
12
+ exports.formatAirspaceClass = formatAirspaceClass;
13
+ /**
14
+ * Format operation data for backend API submission
15
+ * TODO: Implement operation payload formatting
16
+ */
17
+ function formatOperationPayload(_operationData) {
18
+ throw new Error('Not implemented yet');
19
+ }
20
+ /**
21
+ * Format date/time with timezone to ISO string
22
+ * TODO: Implement datetime formatting
23
+ */
24
+ function formatDateTime(_date, _timezone) {
25
+ throw new Error('Not implemented yet');
26
+ }
27
+ /**
28
+ * Format advisories for UI display
29
+ * TODO: Implement advisory formatting
30
+ */
31
+ function formatAdvisories(_advisories) {
32
+ throw new Error('Not implemented yet');
33
+ }
34
+ /**
35
+ * Format airspace class name
36
+ * TODO: Implement class name formatting
37
+ */
38
+ function formatAirspaceClass(_classCode) {
39
+ throw new Error('Not implemented yet');
40
+ }
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/formatters/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAQH,wDAEC;AAMD,wCAEC;AAMD,4CAEC;AAMD,kDAEC;AA9BD;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,cAAmB;IACxD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAW,EAAE,SAAiB;IAC3D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,WAAkB;IACjD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAAkB;IACpD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createCircle = createCircle;
37
+ exports.validateCircle = validateCircle;
38
+ exports.getCircleCenter = getCircleCenter;
39
+ exports.getCircleRadius = getCircleRadius;
40
+ const turf = __importStar(require("@turf/turf"));
41
+ const constants_1 = require("../utils/constants");
42
+ const helpers_1 = require("../utils/helpers");
43
+ /**
44
+ * Create a circular polygon from a center point and radius
45
+ *
46
+ * @param center - Center point of the circle
47
+ * @param radiusFeet - Radius in feet
48
+ * @param options - Circle creation options
49
+ * @returns GeoJSON Feature with Polygon geometry
50
+ */
51
+ function createCircle(center, radiusFeet, options = {}) {
52
+ const { steps = constants_1.CIRCLE_CONSTRAINTS.DEFAULT_STEPS } = options;
53
+ // Validate inputs
54
+ const validation = validateCircle(radiusFeet);
55
+ if (!validation.valid) {
56
+ throw new Error(`Invalid circle parameters: ${validation.errors.map(e => e.message).join(', ')}`);
57
+ }
58
+ // Convert radius to kilometers for Turf.js
59
+ const radiusMeters = (0, helpers_1.feetToMeters)(radiusFeet);
60
+ const radiusKm = radiusMeters / 1000;
61
+ // Create circle using Turf.js
62
+ const point = turf.point([center.lng, center.lat]);
63
+ const circle = turf.circle(point, radiusKm, { steps, units: 'kilometers' });
64
+ // Add metadata to properties
65
+ circle.properties = {
66
+ ...circle.properties,
67
+ geometryType: 'circle',
68
+ center: [center.lng, center.lat],
69
+ radiusFeet,
70
+ radiusMeters,
71
+ };
72
+ return circle;
73
+ }
74
+ /**
75
+ * Validate circle parameters
76
+ *
77
+ * @param radiusFeet - Radius in feet
78
+ * @returns Validation result
79
+ */
80
+ function validateCircle(radiusFeet) {
81
+ const errors = [];
82
+ if (typeof radiusFeet !== 'number' || !isFinite(radiusFeet)) {
83
+ errors.push({
84
+ field: 'radiusFeet',
85
+ message: 'Radius must be a valid number',
86
+ code: constants_1.ERROR_CODES.INVALID_COORDINATES,
87
+ });
88
+ }
89
+ else {
90
+ if (radiusFeet < constants_1.CIRCLE_CONSTRAINTS.MIN_RADIUS) {
91
+ errors.push({
92
+ field: 'radiusFeet',
93
+ message: `Radius must be at least ${constants_1.CIRCLE_CONSTRAINTS.MIN_RADIUS} feet`,
94
+ code: constants_1.ERROR_CODES.CIRCLE_RADIUS_TOO_SMALL,
95
+ });
96
+ }
97
+ if (radiusFeet > constants_1.CIRCLE_CONSTRAINTS.MAX_RADIUS) {
98
+ errors.push({
99
+ field: 'radiusFeet',
100
+ message: `Radius must not exceed ${constants_1.CIRCLE_CONSTRAINTS.MAX_RADIUS} feet`,
101
+ code: constants_1.ERROR_CODES.CIRCLE_RADIUS_TOO_LARGE,
102
+ });
103
+ }
104
+ }
105
+ return {
106
+ valid: errors.length === 0,
107
+ errors,
108
+ };
109
+ }
110
+ /**
111
+ * Get the center point of a circle geometry
112
+ *
113
+ * @param circle - Circle feature
114
+ * @returns Center point as LatLng
115
+ */
116
+ function getCircleCenter(circle) {
117
+ const center = circle.properties?.center;
118
+ if (center && Array.isArray(center) && center.length === 2) {
119
+ return { lng: center[0], lat: center[1] };
120
+ }
121
+ // Fallback: calculate centroid
122
+ const centroid = turf.centroid(circle);
123
+ return {
124
+ lng: centroid.geometry.coordinates[0],
125
+ lat: centroid.geometry.coordinates[1],
126
+ };
127
+ }
128
+ /**
129
+ * Get the radius of a circle geometry
130
+ *
131
+ * @param circle - Circle feature
132
+ * @returns Radius in feet, or null if not a circle
133
+ */
134
+ function getCircleRadius(circle) {
135
+ return circle.properties?.radiusFeet ?? null;
136
+ }
137
+ //# sourceMappingURL=circle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../../src/core/geometry/circle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,oCA+BC;AAQD,wCA+BC;AAQD,0CAYC;AAQD,0CAEC;AAjHD,iDAAmC;AAEnC,kDAAqE;AACrE,8CAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,MAAc,EACd,UAAkB,EAClB,UAAyB,EAAE;IAE3B,MAAM,EAAE,K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C;KACtC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,MAAwB;IACtD,OAAO,MAAM,CAAC,UAAU,EAAE,UAAU,IAAI,IAAI,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBuffer = exports.calculateBearing = exports.calculateDistance = exports.checkContains = exports.checkIntersection = exports.calculateIntersection = exports.calculateCentroid = exports.calculatePerimeter = exports.calculateArea = exports.getPolygonPoints = exports.validatePolygon = exports.createPolygon = exports.getCircleRadius = exports.getCircleCenter = exports.validateCircle = exports.createCircle = void 0;
4
+ // ─── Circle ──────────────────────────────────────────────────────────────────
5
+ var circle_1 = require("./circle");
6
+ Object.defineProperty(exports, "createCircle", { enumerable: true, get: function () { return circle_1.createCircle; } });
7
+ Object.defineProperty(exports, "validateCircle", { enumerable: true, get: function () { return circle_1.validateCircle; } });
8
+ Object.defineProperty(exports, "getCircleCenter", { enumerable: true, get: function () { return circle_1.getCircleCenter; } });
9
+ Object.defineProperty(exports, "getCircleRadius", { enumerable: true, get: function () { return circle_1.getCircleRadius; } });
10
+ // ─── Polygon ─────────────────────────────────────────────────────────────────
11
+ var polygon_1 = require("./polygon");
12
+ Object.defineProperty(exports, "createPolygon", { enumerable: true, get: function () { return polygon_1.createPolygon; } });
13
+ Object.defineProperty(exports, "validatePolygon", { enumerable: true, get: function () { return polygon_1.validatePolygon; } });
14
+ Object.defineProperty(exports, "getPolygonPoints", { enumerable: true, get: function () { return polygon_1.getPolygonPoints; } });
15
+ // ─── Operations ──────────────────────────────────────────────────────────────
16
+ var operations_1 = require("./operations");
17
+ Object.defineProperty(exports, "calculateArea", { enumerable: true, get: function () { return operations_1.calculateArea; } });
18
+ Object.defineProperty(exports, "calculatePerimeter", { enumerable: true, get: function () { return operations_1.calculatePerimeter; } });
19
+ Object.defineProperty(exports, "calculateCentroid", { enumerable: true, get: function () { return operations_1.calculateCentroid; } });
20
+ Object.defineProperty(exports, "calculateIntersection", { enumerable: true, get: function () { return operations_1.calculateIntersection; } });
21
+ Object.defineProperty(exports, "checkIntersection", { enumerable: true, get: function () { return operations_1.checkIntersection; } });
22
+ Object.defineProperty(exports, "checkContains", { enumerable: true, get: function () { return operations_1.checkContains; } });
23
+ Object.defineProperty(exports, "calculateDistance", { enumerable: true, get: function () { return operations_1.calculateDistance; } });
24
+ Object.defineProperty(exports, "calculateBearing", { enumerable: true, get: function () { return operations_1.calculateBearing; } });
25
+ Object.defineProperty(exports, "createBuffer", { enumerable: true, get: function () { return operations_1.createBuffer; } });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/geometry/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,mCAKkB;AAJhB,sGAAA,YAAY,OAAA;AACZ,wGAAA,cAAc,OAAA;AACd,yGAAA,eAAe,OAAA;AACf,yGAAA,eAAe,OAAA;AAGjB,gFAAgF;AAChF,qCAImB;AAHjB,wGAAA,aAAa,OAAA;AACb,0GAAA,eAAe,OAAA;AACf,2GAAA,gBAAgB,OAAA;AAGlB,gFAAgF;AAChF,2CAUsB;AATpB,2GAAA,aAAa,OAAA;AACb,gHAAA,kBAAkB,OAAA;AAClB,+GAAA,iBAAiB,OAAA;AACjB,mHAAA,qBAAqB,OAAA;AACrB,+GAAA,iBAAiB,OAAA;AACjB,2GAAA,aAAa,OAAA;AACb,+GAAA,iBAAiB,OAAA;AACjB,8GAAA,gBAAgB,OAAA;AAChB,0GAAA,YAAY,OAAA"}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.calculateArea = calculateArea;
37
+ exports.calculatePerimeter = calculatePerimeter;
38
+ exports.calculateCentroid = calculateCentroid;
39
+ exports.calculateIntersection = calculateIntersection;
40
+ exports.checkIntersection = checkIntersection;
41
+ exports.checkContains = checkContains;
42
+ exports.calculateDistance = calculateDistance;
43
+ exports.calculateBearing = calculateBearing;
44
+ exports.createBuffer = createBuffer;
45
+ const turf = __importStar(require("@turf/turf"));
46
+ const helpers_1 = require("../utils/helpers");
47
+ /**
48
+ * Calculate the area of a geometry in square feet
49
+ *
50
+ * @param geometry - GeoJSON geometry
51
+ * @returns Area in square feet
52
+ */
53
+ function calculateArea(geometry) {
54
+ const areaSquareMeters = turf.area(geometry);
55
+ return areaSquareMeters * 10.7639; // Convert to square feet
56
+ }
57
+ /**
58
+ * Calculate the perimeter/length of a geometry in feet
59
+ *
60
+ * @param geometry - GeoJSON geometry
61
+ * @returns Perimeter/length in feet
62
+ */
63
+ function calculatePerimeter(geometry) {
64
+ const lengthMeters = turf.length(geometry, { units: 'meters' });
65
+ return (0, helpers_1.metersToFeet)(lengthMeters);
66
+ }
67
+ /**
68
+ * Calculate the centroid of a geometry
69
+ *
70
+ * @param geometry - GeoJSON geometry
71
+ * @returns Centroid as LatLng
72
+ */
73
+ function calculateCentroid(geometry) {
74
+ const centroid = turf.centroid(geometry);
75
+ return {
76
+ lng: centroid.geometry.coordinates[0],
77
+ lat: centroid.geometry.coordinates[1],
78
+ };
79
+ }
80
+ /**
81
+ * Calculate the intersection of two geometries
82
+ *
83
+ * @param geometry1 - First geometry
84
+ * @param geometry2 - Second geometry
85
+ * @returns Intersection geometry, or null if no intersection
86
+ */
87
+ function calculateIntersection(geometry1, geometry2) {
88
+ try {
89
+ const intersection = turf.intersect(geometry1, geometry2);
90
+ return intersection ? intersection.geometry : null;
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ }
96
+ /**
97
+ * Check if two geometries intersect
98
+ *
99
+ * @param geometry1 - First geometry
100
+ * @param geometry2 - Second geometry
101
+ * @returns True if geometries intersect
102
+ */
103
+ function checkIntersection(geometry1, geometry2) {
104
+ try {
105
+ // Check if geometries intersect by attempting to find intersection
106
+ const intersection = calculateIntersection(geometry1, geometry2);
107
+ return intersection !== null;
108
+ }
109
+ catch {
110
+ return false;
111
+ }
112
+ }
113
+ /**
114
+ * Check if one geometry contains another
115
+ *
116
+ * @param container - Container geometry
117
+ * @param contained - Potentially contained geometry
118
+ * @returns True if container contains the other geometry
119
+ */
120
+ function checkContains(container, contained) {
121
+ try {
122
+ const feature1 = container.type === 'Feature' ? container : turf.feature(container);
123
+ const feature2 = contained.type === 'Feature' ? contained : turf.feature(contained);
124
+ return turf.booleanContains(feature1, feature2);
125
+ }
126
+ catch {
127
+ return false;
128
+ }
129
+ }
130
+ /**
131
+ * Calculate distance between two points in feet
132
+ *
133
+ * @param point1 - First point
134
+ * @param point2 - Second point
135
+ * @returns Distance in feet
136
+ */
137
+ function calculateDistance(point1, point2) {
138
+ const from = turf.point([point1.lng, point1.lat]);
139
+ const to = turf.point([point2.lng, point2.lat]);
140
+ const distanceMeters = turf.distance(from, to, { units: 'meters' });
141
+ return (0, helpers_1.metersToFeet)(distanceMeters);
142
+ }
143
+ /**
144
+ * Calculate bearing between two points in degrees
145
+ *
146
+ * @param point1 - Starting point
147
+ * @param point2 - Ending point
148
+ * @returns Bearing in degrees (0-360)
149
+ */
150
+ function calculateBearing(point1, point2) {
151
+ const from = turf.point([point1.lng, point1.lat]);
152
+ const to = turf.point([point2.lng, point2.lat]);
153
+ const bearing = turf.bearing(from, to);
154
+ // Convert to 0-360 range
155
+ return (bearing + 360) % 360;
156
+ }
157
+ /**
158
+ * Create a buffer around a geometry
159
+ *
160
+ * @param geometry - Input geometry
161
+ * @param radiusFeet - Buffer radius in feet
162
+ * @returns Buffered geometry
163
+ */
164
+ function createBuffer(geometry, radiusFeet) {
165
+ const radiusMeters = radiusFeet * 0.3048;
166
+ const radiusKm = radiusMeters / 1000;
167
+ return turf.buffer(geometry, radiusKm, { units: 'kilometers' });
168
+ }
169
+ //# sourceMappingURL=operations.js.map