@omnibase/core-js 0.5.0 → 0.5.1

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.cts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * Base API Response structure for API
3
- */
4
- type ApiResponse<T> = {
5
- data?: T;
6
- status: number;
7
- error?: string;
8
- };
9
-
10
- export type { ApiResponse };
1
+ export { i as OmnibaseClient, O as OmnibaseClientConfig } from './payments/index.cjs';
2
+ import './permissions/index.cjs';
3
+ import '@ory/client';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./auth/index";
2
- export * from "./database/index";
3
- export * from "./tenants/index";
1
+ export { i as OmnibaseClient, O as OmnibaseClientConfig } from './payments/index.js';
2
+ import './permissions/index.js';
3
+ import '@ory/client';
package/dist/index.js CHANGED
@@ -0,0 +1,51 @@
1
+ import {
2
+ PermissionsClient
3
+ } from "./chunk-DDFBRGMG.js";
4
+ import {
5
+ TenantHandler
6
+ } from "./chunk-LIS5WD3H.js";
7
+ import {
8
+ PaymentHandler
9
+ } from "./chunk-767PUXYD.js";
10
+
11
+ // src/client.ts
12
+ var OmnibaseClient = class {
13
+ constructor(config) {
14
+ this.config = config;
15
+ this.permissions = new PermissionsClient(this.config.api_url);
16
+ }
17
+ /**
18
+ * Main payment handler for all payment-related operations
19
+ *
20
+ * This class serves as the central coordinator for all payment functionality,
21
+ * providing access to checkout sessions, billing configuration, customer portals,
22
+ * and usage tracking. It handles the low-level HTTP communication with the
23
+ * payment API and delegates specific operations to specialized managers.
24
+ *
25
+ * The handler automatically manages authentication, request formatting, and
26
+ * provides a consistent interface across all payment operations.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // Create a checkout session
31
+ * const checkout = await omnibase.payments.checkout.createSession({
32
+ * price_id: 'price_123',
33
+ * mode: 'subscription',
34
+ * success_url: 'https://app.com/success',
35
+ * cancel_url: 'https://app.com/cancel'
36
+ * });
37
+ *
38
+ * // Get available products
39
+ * const products = await omnibase.payments.config.getAvailableProducts();
40
+ * ```
41
+ */
42
+ payments = new PaymentHandler(this);
43
+ tenants = new TenantHandler(this);
44
+ permissions;
45
+ async fetch(endpoint, options = {}) {
46
+ return await fetch(this.config.api_url + endpoint, options);
47
+ }
48
+ };
49
+ export {
50
+ OmnibaseClient
51
+ };