@rawdash/connector-revenuecat 0.21.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/README.md +138 -0
- package/dist/index.d.ts +522 -0
- package/dist/index.js +533 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
|
|
2
|
+
|
|
3
|
+
# @rawdash/connector-revenuecat
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@rawdash/connector-revenuecat)
|
|
6
|
+
[](https://github.com/rawdash/rawdash/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Sync products, entitlements, customers, and subscription events from RevenueCat alongside overview metrics (MRR, active subscribers, trial conversion).
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @rawdash/connector-revenuecat
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
Authenticates with a RevenueCat v2 REST API key scoped to a single project. The key only needs read access to the resources being synced.
|
|
19
|
+
|
|
20
|
+
1. Open the RevenueCat dashboard -> Project Settings -> API Keys.
|
|
21
|
+
2. Create a v2 Secret API key with read access; copy the key value.
|
|
22
|
+
3. Copy the Project ID from Project Settings -> General.
|
|
23
|
+
4. Store the API key as a secret and reference it from the connector config as `apiKey: secret("REVENUECAT_API_KEY")`. Set `projectId` to the project identifier.
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
| ----------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `apiKey` | secret | Yes | RevenueCat v2 REST API key (read-only). Create one in the RevenueCat dashboard under Project Settings -> API Keys -> Public app-specific or Secret API Key (V2). |
|
|
30
|
+
| `projectId` | string | Yes | RevenueCat project identifier. Find it in Project Settings -> General. |
|
|
31
|
+
| `resources` | array | No | Which RevenueCat resources to sync. Omit to sync all. Customer syncs also emit subscription entities embedded in each customer response. |
|
|
32
|
+
|
|
33
|
+
## Resources
|
|
34
|
+
|
|
35
|
+
- **`revenuecat_product`** _(entity)_ - Products configured in RevenueCat, including their store identifier (App Store / Play Store SKU), type, and display name.
|
|
36
|
+
- Endpoint: `GET /v2/projects/{project_id}/products`
|
|
37
|
+
- `storeIdentifier`: Store-specific product SKU.
|
|
38
|
+
- `type`: Product type (subscription, non_consumable, ...).
|
|
39
|
+
- `appId`: RevenueCat app id the product belongs to.
|
|
40
|
+
- `displayName`: Human-readable product name.
|
|
41
|
+
- `createdAt`: Unix seconds when the product was created.
|
|
42
|
+
- **`revenuecat_entitlement`** _(entity)_ - Entitlements (logical features) configured in the project, keyed by lookup_key.
|
|
43
|
+
- Endpoint: `GET /v2/projects/{project_id}/entitlements`
|
|
44
|
+
- `lookupKey`: Stable lookup key used by client SDKs.
|
|
45
|
+
- `displayName`: Human-readable entitlement name.
|
|
46
|
+
- `createdAt`: Unix seconds when the entitlement was created.
|
|
47
|
+
- **`revenuecat_customer`** _(entity)_ - RevenueCat customers (app users) with first-seen / last-seen timestamps and a list of currently active entitlement lookup keys.
|
|
48
|
+
- Endpoint: `GET /v2/projects/{project_id}/customers`
|
|
49
|
+
- Each customer response includes embedded subscription objects; those are written separately as `revenuecat_subscription` entities.
|
|
50
|
+
- `firstSeenAt`: Unix seconds the customer was first seen.
|
|
51
|
+
- `lastSeenAt`: Unix seconds of the most recent activity.
|
|
52
|
+
- `activeEntitlements`: Array of entitlement_id strings currently granting access.
|
|
53
|
+
- **`revenuecat_subscription`** _(entity)_ - Subscriptions, one row per (customer, product, original transaction). Extracted from the embedded `subscriptions.items` array in each customer response.
|
|
54
|
+
- Endpoint: `GET /v2/projects/{project_id}/customers`
|
|
55
|
+
- `customerId`: RevenueCat customer (app user) id.
|
|
56
|
+
- `productId`: Product the subscription is for.
|
|
57
|
+
- `store`: Originating store (app_store, play_store, ...).
|
|
58
|
+
- `status`: Subscription status (active, expired, refunded, ...).
|
|
59
|
+
- `startsAt`: Unix seconds the subscription started.
|
|
60
|
+
- `currentPeriodEndsAt`: Unix seconds the current paid period ends.
|
|
61
|
+
- `givesAccess`: Whether the subscription currently grants access.
|
|
62
|
+
- `autoRenewalStatus`: Auto-renew status reported by the store (will_renew, will_not_renew, ...).
|
|
63
|
+
- **`revenuecat_event`** _(event)_ - Subscription lifecycle events (initial purchase, renewal, cancellation, billing issue, refund, trial start, conversion, ...).
|
|
64
|
+
- Endpoint: `GET /v2/projects/{project_id}/events`
|
|
65
|
+
- `type`: Event type (INITIAL_PURCHASE, RENEWAL, CANCELLATION, ...).
|
|
66
|
+
- `appUserId`: App user id at the time of the event.
|
|
67
|
+
- `productId`: Product involved in the event.
|
|
68
|
+
- `store`: Originating store.
|
|
69
|
+
- `environment`: production or sandbox.
|
|
70
|
+
- `priceInPurchasedCurrency`: Charged amount in the purchase currency, if known.
|
|
71
|
+
- `currency`: ISO currency code, if known.
|
|
72
|
+
- **`revenuecat_metric_snapshot`** _(metric)_ - Point-in-time snapshot of RevenueCat overview metrics (MRR, active subscriptions, active trials, trial conversion rate, etc.). Each metric is emitted as one sample per sync, tagged with the metric id under the `metric` dimension.
|
|
73
|
+
- Endpoint: `GET /v2/projects/{project_id}/metrics/overview`
|
|
74
|
+
- Granularity: minute
|
|
75
|
+
- Dimensions: `metric`, `unit`
|
|
76
|
+
- The unit varies by metric id (currency minor units for revenue metrics, count for subscriber metrics, ratio for conversion metrics) and is recorded in the `unit` dimension.
|
|
77
|
+
|
|
78
|
+
## Example
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import {
|
|
82
|
+
defineConfig,
|
|
83
|
+
defineDashboard,
|
|
84
|
+
defineMetric,
|
|
85
|
+
secret,
|
|
86
|
+
} from '@rawdash/core';
|
|
87
|
+
|
|
88
|
+
const revenuecat = {
|
|
89
|
+
name: 'revenuecat',
|
|
90
|
+
connectorId: 'revenuecat',
|
|
91
|
+
config: {
|
|
92
|
+
apiKey: secret('REVENUECAT_API_KEY'),
|
|
93
|
+
projectId: 'proj1ab2cd3',
|
|
94
|
+
resources: ['products', 'customers', 'events', 'metrics'],
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default defineConfig({
|
|
99
|
+
connectors: [revenuecat],
|
|
100
|
+
dashboards: {
|
|
101
|
+
mobile_revenue: defineDashboard({
|
|
102
|
+
widgets: {
|
|
103
|
+
active_subscriptions: {
|
|
104
|
+
kind: 'stat',
|
|
105
|
+
title: 'Active subscriptions',
|
|
106
|
+
metric: defineMetric({
|
|
107
|
+
connector: revenuecat,
|
|
108
|
+
shape: 'entity',
|
|
109
|
+
entityType: 'revenuecat_subscription',
|
|
110
|
+
fn: 'count',
|
|
111
|
+
filter: [{ field: 'status', op: 'eq', value: 'active' }],
|
|
112
|
+
}),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Rate limits
|
|
121
|
+
|
|
122
|
+
RevenueCat applies per-project rate limits and returns 429 with a Retry-After header on overrun; requests are retried with exponential backoff. List endpoints page via the `starting_after` cursor up to 1000 items per page.
|
|
123
|
+
|
|
124
|
+
## Limitations
|
|
125
|
+
|
|
126
|
+
- Monetary amounts (e.g. MRR) are emitted in the smallest currency unit reported by the upstream API (typically cents).
|
|
127
|
+
- The overview metrics resource emits a point-in-time snapshot per sync rather than a backfilled timeseries; query timeseries widgets group these by `metric` and aggregate over time.
|
|
128
|
+
- Subscription entities are emitted from data embedded in each customer response, not from a separate list endpoint.
|
|
129
|
+
|
|
130
|
+
## Links
|
|
131
|
+
|
|
132
|
+
- [Rawdash docs](https://rawdash.dev/docs/connectors/)
|
|
133
|
+
- [RevenueCat API docs](https://www.revenuecat.com/docs/api-v2)
|
|
134
|
+
- [GitHub](https://github.com/rawdash/rawdash)
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const configFields: z.ZodObject<{
|
|
5
|
+
apiKey: z.ZodObject<{
|
|
6
|
+
$secret: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
projectId: z.ZodString;
|
|
9
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
10
|
+
events: "events";
|
|
11
|
+
metrics: "metrics";
|
|
12
|
+
products: "products";
|
|
13
|
+
entitlements: "entitlements";
|
|
14
|
+
customers: "customers";
|
|
15
|
+
}>>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const doc: ConnectorDoc;
|
|
18
|
+
interface RevenueCatSettings {
|
|
19
|
+
projectId: string;
|
|
20
|
+
resources?: readonly RevenueCatResource[];
|
|
21
|
+
}
|
|
22
|
+
declare const revenuecatCredentials: {
|
|
23
|
+
apiKey: {
|
|
24
|
+
description: string;
|
|
25
|
+
auth: "required";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type RevenueCatCredentials = typeof revenuecatCredentials;
|
|
29
|
+
declare const PHASE_ORDER: readonly ["products", "entitlements", "customers", "events", "metrics"];
|
|
30
|
+
type RevenueCatPhase = (typeof PHASE_ORDER)[number];
|
|
31
|
+
type RevenueCatResource = RevenueCatPhase;
|
|
32
|
+
declare const revenuecatResources: {
|
|
33
|
+
readonly revenuecat_product: {
|
|
34
|
+
readonly shape: "entity";
|
|
35
|
+
readonly description: "Products configured in RevenueCat, including their store identifier (App Store / Play Store SKU), type, and display name.";
|
|
36
|
+
readonly endpoint: "GET /v2/projects/{project_id}/products";
|
|
37
|
+
readonly fields: [{
|
|
38
|
+
readonly name: "storeIdentifier";
|
|
39
|
+
readonly description: "Store-specific product SKU.";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "type";
|
|
42
|
+
readonly description: "Product type (subscription, non_consumable, ...).";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "appId";
|
|
45
|
+
readonly description: "RevenueCat app id the product belongs to.";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "displayName";
|
|
48
|
+
readonly description: "Human-readable product name.";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "createdAt";
|
|
51
|
+
readonly description: "Unix seconds when the product was created.";
|
|
52
|
+
}];
|
|
53
|
+
readonly responses: {
|
|
54
|
+
readonly products: z.ZodArray<z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
store_identifier: z.ZodNullable<z.ZodString>;
|
|
57
|
+
type: z.ZodNullable<z.ZodString>;
|
|
58
|
+
app_id: z.ZodNullable<z.ZodString>;
|
|
59
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
60
|
+
created_at: z.ZodNumber;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly revenuecat_entitlement: {
|
|
65
|
+
readonly shape: "entity";
|
|
66
|
+
readonly description: "Entitlements (logical features) configured in the project, keyed by lookup_key.";
|
|
67
|
+
readonly endpoint: "GET /v2/projects/{project_id}/entitlements";
|
|
68
|
+
readonly fields: [{
|
|
69
|
+
readonly name: "lookupKey";
|
|
70
|
+
readonly description: "Stable lookup key used by client SDKs.";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "displayName";
|
|
73
|
+
readonly description: "Human-readable entitlement name.";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "createdAt";
|
|
76
|
+
readonly description: "Unix seconds when the entitlement was created.";
|
|
77
|
+
}];
|
|
78
|
+
readonly responses: {
|
|
79
|
+
readonly entitlements: z.ZodArray<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
lookup_key: z.ZodString;
|
|
82
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
83
|
+
created_at: z.ZodNumber;
|
|
84
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly revenuecat_customer: {
|
|
89
|
+
readonly shape: "entity";
|
|
90
|
+
readonly description: "RevenueCat customers (app users) with first-seen / last-seen timestamps and a list of currently active entitlement lookup keys.";
|
|
91
|
+
readonly endpoint: "GET /v2/projects/{project_id}/customers";
|
|
92
|
+
readonly notes: "Each customer response includes embedded subscription objects; those are written separately as `revenuecat_subscription` entities.";
|
|
93
|
+
readonly fields: [{
|
|
94
|
+
readonly name: "firstSeenAt";
|
|
95
|
+
readonly description: "Unix seconds the customer was first seen.";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "lastSeenAt";
|
|
98
|
+
readonly description: "Unix seconds of the most recent activity.";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "activeEntitlements";
|
|
101
|
+
readonly description: "Array of entitlement_id strings currently granting access.";
|
|
102
|
+
}];
|
|
103
|
+
readonly responses: {
|
|
104
|
+
readonly customers: z.ZodArray<z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
first_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
107
|
+
last_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
108
|
+
active_entitlements: z.ZodNullable<z.ZodObject<{
|
|
109
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
110
|
+
entitlement_id: z.ZodString;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
subscriptions: z.ZodNullable<z.ZodObject<{
|
|
114
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
117
|
+
store: z.ZodNullable<z.ZodString>;
|
|
118
|
+
status: z.ZodString;
|
|
119
|
+
starts_at: z.ZodNullable<z.ZodNumber>;
|
|
120
|
+
current_period_ends_at: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
gives_access: z.ZodNullable<z.ZodBoolean>;
|
|
122
|
+
auto_renewal_status: z.ZodNullable<z.ZodString>;
|
|
123
|
+
}, z.core.$strip>>>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly revenuecat_subscription: {
|
|
130
|
+
readonly shape: "entity";
|
|
131
|
+
readonly description: "Subscriptions, one row per (customer, product, original transaction). Extracted from the embedded `subscriptions.items` array in each customer response.";
|
|
132
|
+
readonly endpoint: "GET /v2/projects/{project_id}/customers";
|
|
133
|
+
readonly fields: [{
|
|
134
|
+
readonly name: "customerId";
|
|
135
|
+
readonly description: "RevenueCat customer (app user) id.";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "productId";
|
|
138
|
+
readonly description: "Product the subscription is for.";
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "store";
|
|
141
|
+
readonly description: "Originating store (app_store, play_store, ...).";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "status";
|
|
144
|
+
readonly description: "Subscription status (active, expired, refunded, ...).";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "startsAt";
|
|
147
|
+
readonly description: "Unix seconds the subscription started.";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "currentPeriodEndsAt";
|
|
150
|
+
readonly description: "Unix seconds the current paid period ends.";
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "givesAccess";
|
|
153
|
+
readonly description: "Whether the subscription currently grants access.";
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "autoRenewalStatus";
|
|
156
|
+
readonly description: "Auto-renew status reported by the store (will_renew, will_not_renew, ...).";
|
|
157
|
+
}];
|
|
158
|
+
readonly responses: {};
|
|
159
|
+
};
|
|
160
|
+
readonly revenuecat_event: {
|
|
161
|
+
readonly shape: "event";
|
|
162
|
+
readonly description: "Subscription lifecycle events (initial purchase, renewal, cancellation, billing issue, refund, trial start, conversion, ...).";
|
|
163
|
+
readonly endpoint: "GET /v2/projects/{project_id}/events";
|
|
164
|
+
readonly fields: [{
|
|
165
|
+
readonly name: "type";
|
|
166
|
+
readonly description: "Event type (INITIAL_PURCHASE, RENEWAL, CANCELLATION, ...).";
|
|
167
|
+
}, {
|
|
168
|
+
readonly name: "appUserId";
|
|
169
|
+
readonly description: "App user id at the time of the event.";
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "productId";
|
|
172
|
+
readonly description: "Product involved in the event.";
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "store";
|
|
175
|
+
readonly description: "Originating store.";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "environment";
|
|
178
|
+
readonly description: "production or sandbox.";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "priceInPurchasedCurrency";
|
|
181
|
+
readonly description: "Charged amount in the purchase currency, if known.";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "currency";
|
|
184
|
+
readonly description: "ISO currency code, if known.";
|
|
185
|
+
}];
|
|
186
|
+
readonly responses: {
|
|
187
|
+
readonly events: z.ZodArray<z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
type: z.ZodString;
|
|
190
|
+
timestamp_ms: z.ZodNumber;
|
|
191
|
+
app_user_id: z.ZodNullable<z.ZodString>;
|
|
192
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
193
|
+
store: z.ZodNullable<z.ZodString>;
|
|
194
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
195
|
+
price_in_purchased_currency: z.ZodNullable<z.ZodNumber>;
|
|
196
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
readonly revenuecat_metric_snapshot: {
|
|
201
|
+
readonly shape: "metric";
|
|
202
|
+
readonly description: "Point-in-time snapshot of RevenueCat overview metrics (MRR, active subscriptions, active trials, trial conversion rate, etc.). Each metric is emitted as one sample per sync, tagged with the metric id under the `metric` dimension.";
|
|
203
|
+
readonly endpoint: "GET /v2/projects/{project_id}/metrics/overview";
|
|
204
|
+
readonly granularity: "minute";
|
|
205
|
+
readonly notes: "The unit varies by metric id (currency minor units for revenue metrics, count for subscriber metrics, ratio for conversion metrics) and is recorded in the `unit` dimension.";
|
|
206
|
+
readonly dimensions: [{
|
|
207
|
+
readonly name: "metric";
|
|
208
|
+
readonly description: "Overview metric identifier returned by RevenueCat (e.g. mrr, active_subscriptions, active_trials, trial_conversion_rate).";
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "unit";
|
|
211
|
+
readonly description: "Upstream-declared unit for the metric value, if present.";
|
|
212
|
+
}];
|
|
213
|
+
readonly responses: {
|
|
214
|
+
readonly metrics: z.ZodObject<{
|
|
215
|
+
object: z.ZodOptional<z.ZodLiteral<"list">>;
|
|
216
|
+
metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
+
id: z.ZodString;
|
|
218
|
+
name: z.ZodOptional<z.ZodString>;
|
|
219
|
+
value: z.ZodNumber;
|
|
220
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
}, z.core.$strip>>>;
|
|
222
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
223
|
+
id: z.ZodString;
|
|
224
|
+
name: z.ZodOptional<z.ZodString>;
|
|
225
|
+
value: z.ZodNumber;
|
|
226
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
|
+
}, z.core.$strip>>>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
declare const id = "revenuecat";
|
|
233
|
+
declare class RevenueCatConnector extends BaseConnector<RevenueCatSettings, RevenueCatCredentials> {
|
|
234
|
+
static readonly id = "revenuecat";
|
|
235
|
+
static readonly resources: {
|
|
236
|
+
readonly revenuecat_product: {
|
|
237
|
+
readonly shape: "entity";
|
|
238
|
+
readonly description: "Products configured in RevenueCat, including their store identifier (App Store / Play Store SKU), type, and display name.";
|
|
239
|
+
readonly endpoint: "GET /v2/projects/{project_id}/products";
|
|
240
|
+
readonly fields: [{
|
|
241
|
+
readonly name: "storeIdentifier";
|
|
242
|
+
readonly description: "Store-specific product SKU.";
|
|
243
|
+
}, {
|
|
244
|
+
readonly name: "type";
|
|
245
|
+
readonly description: "Product type (subscription, non_consumable, ...).";
|
|
246
|
+
}, {
|
|
247
|
+
readonly name: "appId";
|
|
248
|
+
readonly description: "RevenueCat app id the product belongs to.";
|
|
249
|
+
}, {
|
|
250
|
+
readonly name: "displayName";
|
|
251
|
+
readonly description: "Human-readable product name.";
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "createdAt";
|
|
254
|
+
readonly description: "Unix seconds when the product was created.";
|
|
255
|
+
}];
|
|
256
|
+
readonly responses: {
|
|
257
|
+
readonly products: z.ZodArray<z.ZodObject<{
|
|
258
|
+
id: z.ZodString;
|
|
259
|
+
store_identifier: z.ZodNullable<z.ZodString>;
|
|
260
|
+
type: z.ZodNullable<z.ZodString>;
|
|
261
|
+
app_id: z.ZodNullable<z.ZodString>;
|
|
262
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
263
|
+
created_at: z.ZodNumber;
|
|
264
|
+
}, z.core.$strip>>;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly revenuecat_entitlement: {
|
|
268
|
+
readonly shape: "entity";
|
|
269
|
+
readonly description: "Entitlements (logical features) configured in the project, keyed by lookup_key.";
|
|
270
|
+
readonly endpoint: "GET /v2/projects/{project_id}/entitlements";
|
|
271
|
+
readonly fields: [{
|
|
272
|
+
readonly name: "lookupKey";
|
|
273
|
+
readonly description: "Stable lookup key used by client SDKs.";
|
|
274
|
+
}, {
|
|
275
|
+
readonly name: "displayName";
|
|
276
|
+
readonly description: "Human-readable entitlement name.";
|
|
277
|
+
}, {
|
|
278
|
+
readonly name: "createdAt";
|
|
279
|
+
readonly description: "Unix seconds when the entitlement was created.";
|
|
280
|
+
}];
|
|
281
|
+
readonly responses: {
|
|
282
|
+
readonly entitlements: z.ZodArray<z.ZodObject<{
|
|
283
|
+
id: z.ZodString;
|
|
284
|
+
lookup_key: z.ZodString;
|
|
285
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
286
|
+
created_at: z.ZodNumber;
|
|
287
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
readonly revenuecat_customer: {
|
|
292
|
+
readonly shape: "entity";
|
|
293
|
+
readonly description: "RevenueCat customers (app users) with first-seen / last-seen timestamps and a list of currently active entitlement lookup keys.";
|
|
294
|
+
readonly endpoint: "GET /v2/projects/{project_id}/customers";
|
|
295
|
+
readonly notes: "Each customer response includes embedded subscription objects; those are written separately as `revenuecat_subscription` entities.";
|
|
296
|
+
readonly fields: [{
|
|
297
|
+
readonly name: "firstSeenAt";
|
|
298
|
+
readonly description: "Unix seconds the customer was first seen.";
|
|
299
|
+
}, {
|
|
300
|
+
readonly name: "lastSeenAt";
|
|
301
|
+
readonly description: "Unix seconds of the most recent activity.";
|
|
302
|
+
}, {
|
|
303
|
+
readonly name: "activeEntitlements";
|
|
304
|
+
readonly description: "Array of entitlement_id strings currently granting access.";
|
|
305
|
+
}];
|
|
306
|
+
readonly responses: {
|
|
307
|
+
readonly customers: z.ZodArray<z.ZodObject<{
|
|
308
|
+
id: z.ZodString;
|
|
309
|
+
first_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
310
|
+
last_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
311
|
+
active_entitlements: z.ZodNullable<z.ZodObject<{
|
|
312
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
|
+
entitlement_id: z.ZodString;
|
|
314
|
+
}, z.core.$strip>>>;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
subscriptions: z.ZodNullable<z.ZodObject<{
|
|
317
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
320
|
+
store: z.ZodNullable<z.ZodString>;
|
|
321
|
+
status: z.ZodString;
|
|
322
|
+
starts_at: z.ZodNullable<z.ZodNumber>;
|
|
323
|
+
current_period_ends_at: z.ZodNullable<z.ZodNumber>;
|
|
324
|
+
gives_access: z.ZodNullable<z.ZodBoolean>;
|
|
325
|
+
auto_renewal_status: z.ZodNullable<z.ZodString>;
|
|
326
|
+
}, z.core.$strip>>>;
|
|
327
|
+
}, z.core.$strip>>;
|
|
328
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
329
|
+
}, z.core.$strip>>;
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
readonly revenuecat_subscription: {
|
|
333
|
+
readonly shape: "entity";
|
|
334
|
+
readonly description: "Subscriptions, one row per (customer, product, original transaction). Extracted from the embedded `subscriptions.items` array in each customer response.";
|
|
335
|
+
readonly endpoint: "GET /v2/projects/{project_id}/customers";
|
|
336
|
+
readonly fields: [{
|
|
337
|
+
readonly name: "customerId";
|
|
338
|
+
readonly description: "RevenueCat customer (app user) id.";
|
|
339
|
+
}, {
|
|
340
|
+
readonly name: "productId";
|
|
341
|
+
readonly description: "Product the subscription is for.";
|
|
342
|
+
}, {
|
|
343
|
+
readonly name: "store";
|
|
344
|
+
readonly description: "Originating store (app_store, play_store, ...).";
|
|
345
|
+
}, {
|
|
346
|
+
readonly name: "status";
|
|
347
|
+
readonly description: "Subscription status (active, expired, refunded, ...).";
|
|
348
|
+
}, {
|
|
349
|
+
readonly name: "startsAt";
|
|
350
|
+
readonly description: "Unix seconds the subscription started.";
|
|
351
|
+
}, {
|
|
352
|
+
readonly name: "currentPeriodEndsAt";
|
|
353
|
+
readonly description: "Unix seconds the current paid period ends.";
|
|
354
|
+
}, {
|
|
355
|
+
readonly name: "givesAccess";
|
|
356
|
+
readonly description: "Whether the subscription currently grants access.";
|
|
357
|
+
}, {
|
|
358
|
+
readonly name: "autoRenewalStatus";
|
|
359
|
+
readonly description: "Auto-renew status reported by the store (will_renew, will_not_renew, ...).";
|
|
360
|
+
}];
|
|
361
|
+
readonly responses: {};
|
|
362
|
+
};
|
|
363
|
+
readonly revenuecat_event: {
|
|
364
|
+
readonly shape: "event";
|
|
365
|
+
readonly description: "Subscription lifecycle events (initial purchase, renewal, cancellation, billing issue, refund, trial start, conversion, ...).";
|
|
366
|
+
readonly endpoint: "GET /v2/projects/{project_id}/events";
|
|
367
|
+
readonly fields: [{
|
|
368
|
+
readonly name: "type";
|
|
369
|
+
readonly description: "Event type (INITIAL_PURCHASE, RENEWAL, CANCELLATION, ...).";
|
|
370
|
+
}, {
|
|
371
|
+
readonly name: "appUserId";
|
|
372
|
+
readonly description: "App user id at the time of the event.";
|
|
373
|
+
}, {
|
|
374
|
+
readonly name: "productId";
|
|
375
|
+
readonly description: "Product involved in the event.";
|
|
376
|
+
}, {
|
|
377
|
+
readonly name: "store";
|
|
378
|
+
readonly description: "Originating store.";
|
|
379
|
+
}, {
|
|
380
|
+
readonly name: "environment";
|
|
381
|
+
readonly description: "production or sandbox.";
|
|
382
|
+
}, {
|
|
383
|
+
readonly name: "priceInPurchasedCurrency";
|
|
384
|
+
readonly description: "Charged amount in the purchase currency, if known.";
|
|
385
|
+
}, {
|
|
386
|
+
readonly name: "currency";
|
|
387
|
+
readonly description: "ISO currency code, if known.";
|
|
388
|
+
}];
|
|
389
|
+
readonly responses: {
|
|
390
|
+
readonly events: z.ZodArray<z.ZodObject<{
|
|
391
|
+
id: z.ZodString;
|
|
392
|
+
type: z.ZodString;
|
|
393
|
+
timestamp_ms: z.ZodNumber;
|
|
394
|
+
app_user_id: z.ZodNullable<z.ZodString>;
|
|
395
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
396
|
+
store: z.ZodNullable<z.ZodString>;
|
|
397
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
398
|
+
price_in_purchased_currency: z.ZodNullable<z.ZodNumber>;
|
|
399
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
400
|
+
}, z.core.$strip>>;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
readonly revenuecat_metric_snapshot: {
|
|
404
|
+
readonly shape: "metric";
|
|
405
|
+
readonly description: "Point-in-time snapshot of RevenueCat overview metrics (MRR, active subscriptions, active trials, trial conversion rate, etc.). Each metric is emitted as one sample per sync, tagged with the metric id under the `metric` dimension.";
|
|
406
|
+
readonly endpoint: "GET /v2/projects/{project_id}/metrics/overview";
|
|
407
|
+
readonly granularity: "minute";
|
|
408
|
+
readonly notes: "The unit varies by metric id (currency minor units for revenue metrics, count for subscriber metrics, ratio for conversion metrics) and is recorded in the `unit` dimension.";
|
|
409
|
+
readonly dimensions: [{
|
|
410
|
+
readonly name: "metric";
|
|
411
|
+
readonly description: "Overview metric identifier returned by RevenueCat (e.g. mrr, active_subscriptions, active_trials, trial_conversion_rate).";
|
|
412
|
+
}, {
|
|
413
|
+
readonly name: "unit";
|
|
414
|
+
readonly description: "Upstream-declared unit for the metric value, if present.";
|
|
415
|
+
}];
|
|
416
|
+
readonly responses: {
|
|
417
|
+
readonly metrics: z.ZodObject<{
|
|
418
|
+
object: z.ZodOptional<z.ZodLiteral<"list">>;
|
|
419
|
+
metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
420
|
+
id: z.ZodString;
|
|
421
|
+
name: z.ZodOptional<z.ZodString>;
|
|
422
|
+
value: z.ZodNumber;
|
|
423
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
424
|
+
}, z.core.$strip>>>;
|
|
425
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
426
|
+
id: z.ZodString;
|
|
427
|
+
name: z.ZodOptional<z.ZodString>;
|
|
428
|
+
value: z.ZodNumber;
|
|
429
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
430
|
+
}, z.core.$strip>>>;
|
|
431
|
+
}, z.core.$strip>;
|
|
432
|
+
};
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
static readonly schemas: {
|
|
436
|
+
readonly products: z.ZodArray<z.ZodObject<{
|
|
437
|
+
id: z.ZodString;
|
|
438
|
+
store_identifier: z.ZodNullable<z.ZodString>;
|
|
439
|
+
type: z.ZodNullable<z.ZodString>;
|
|
440
|
+
app_id: z.ZodNullable<z.ZodString>;
|
|
441
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
442
|
+
created_at: z.ZodNumber;
|
|
443
|
+
}, z.core.$strip>>;
|
|
444
|
+
} & {
|
|
445
|
+
readonly entitlements: z.ZodArray<z.ZodObject<{
|
|
446
|
+
id: z.ZodString;
|
|
447
|
+
lookup_key: z.ZodString;
|
|
448
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
449
|
+
created_at: z.ZodNumber;
|
|
450
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
451
|
+
}, z.core.$strip>>;
|
|
452
|
+
} & {
|
|
453
|
+
readonly customers: z.ZodArray<z.ZodObject<{
|
|
454
|
+
id: z.ZodString;
|
|
455
|
+
first_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
456
|
+
last_seen_at: z.ZodNullable<z.ZodNumber>;
|
|
457
|
+
active_entitlements: z.ZodNullable<z.ZodObject<{
|
|
458
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
459
|
+
entitlement_id: z.ZodString;
|
|
460
|
+
}, z.core.$strip>>>;
|
|
461
|
+
}, z.core.$strip>>;
|
|
462
|
+
subscriptions: z.ZodNullable<z.ZodObject<{
|
|
463
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
464
|
+
id: z.ZodString;
|
|
465
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
466
|
+
store: z.ZodNullable<z.ZodString>;
|
|
467
|
+
status: z.ZodString;
|
|
468
|
+
starts_at: z.ZodNullable<z.ZodNumber>;
|
|
469
|
+
current_period_ends_at: z.ZodNullable<z.ZodNumber>;
|
|
470
|
+
gives_access: z.ZodNullable<z.ZodBoolean>;
|
|
471
|
+
auto_renewal_status: z.ZodNullable<z.ZodString>;
|
|
472
|
+
}, z.core.$strip>>>;
|
|
473
|
+
}, z.core.$strip>>;
|
|
474
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
475
|
+
}, z.core.$strip>>;
|
|
476
|
+
} & {
|
|
477
|
+
readonly events: z.ZodArray<z.ZodObject<{
|
|
478
|
+
id: z.ZodString;
|
|
479
|
+
type: z.ZodString;
|
|
480
|
+
timestamp_ms: z.ZodNumber;
|
|
481
|
+
app_user_id: z.ZodNullable<z.ZodString>;
|
|
482
|
+
product_id: z.ZodNullable<z.ZodString>;
|
|
483
|
+
store: z.ZodNullable<z.ZodString>;
|
|
484
|
+
environment: z.ZodNullable<z.ZodString>;
|
|
485
|
+
price_in_purchased_currency: z.ZodNullable<z.ZodNumber>;
|
|
486
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
487
|
+
}, z.core.$strip>>;
|
|
488
|
+
} & {
|
|
489
|
+
readonly metrics: z.ZodObject<{
|
|
490
|
+
object: z.ZodOptional<z.ZodLiteral<"list">>;
|
|
491
|
+
metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
492
|
+
id: z.ZodString;
|
|
493
|
+
name: z.ZodOptional<z.ZodString>;
|
|
494
|
+
value: z.ZodNumber;
|
|
495
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
496
|
+
}, z.core.$strip>>>;
|
|
497
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
498
|
+
id: z.ZodString;
|
|
499
|
+
name: z.ZodOptional<z.ZodString>;
|
|
500
|
+
value: z.ZodNumber;
|
|
501
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
502
|
+
}, z.core.$strip>>>;
|
|
503
|
+
}, z.core.$strip>;
|
|
504
|
+
} & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
505
|
+
static create(input: unknown, ctx?: ConnectorContext): RevenueCatConnector;
|
|
506
|
+
readonly id = "revenuecat";
|
|
507
|
+
readonly credentials: {
|
|
508
|
+
apiKey: {
|
|
509
|
+
description: string;
|
|
510
|
+
auth: "required";
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
private buildHeaders;
|
|
514
|
+
private fetchUrl;
|
|
515
|
+
private buildListUrl;
|
|
516
|
+
private buildPhaseUrl;
|
|
517
|
+
private clearScopeOnFirstPage;
|
|
518
|
+
private writePhase;
|
|
519
|
+
sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export { RevenueCatConnector, type RevenueCatResource, type RevenueCatSettings, configFields, RevenueCatConnector as default, doc, id, revenuecatResources as resources };
|