@dvina/sdk 3.3.124
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/LICENSE +21 -0
- package/README.md +449 -0
- package/dist/_generated_documents-DF34ZUJ3.js +4 -0
- package/dist/_generated_documents-DF34ZUJ3.js.map +1 -0
- package/dist/_generated_documents-W4RHWJ4B.cjs +2041 -0
- package/dist/_generated_documents-W4RHWJ4B.cjs.map +1 -0
- package/dist/adapters/angular/index.cjs +163 -0
- package/dist/adapters/angular/index.cjs.map +1 -0
- package/dist/adapters/angular/index.d.cts +254 -0
- package/dist/adapters/angular/index.d.ts +254 -0
- package/dist/adapters/angular/index.js +159 -0
- package/dist/adapters/angular/index.js.map +1 -0
- package/dist/adapters/react/index.cjs +51 -0
- package/dist/adapters/react/index.cjs.map +1 -0
- package/dist/adapters/react/index.d.cts +62 -0
- package/dist/adapters/react/index.d.ts +62 -0
- package/dist/adapters/react/index.js +49 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/billing/index.cjs +26 -0
- package/dist/billing/index.cjs.map +1 -0
- package/dist/billing/index.d.cts +338 -0
- package/dist/billing/index.d.ts +338 -0
- package/dist/billing/index.js +5 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/chunk-4QKWHQT2.cjs +104 -0
- package/dist/chunk-4QKWHQT2.cjs.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +29 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-7JUBGIQ2.js +1008 -0
- package/dist/chunk-7JUBGIQ2.js.map +1 -0
- package/dist/chunk-7XBJ77RJ.js +103 -0
- package/dist/chunk-7XBJ77RJ.js.map +1 -0
- package/dist/chunk-DHUFVGJR.cjs +20389 -0
- package/dist/chunk-DHUFVGJR.cjs.map +1 -0
- package/dist/chunk-DZUJEN5N.cjs +32 -0
- package/dist/chunk-DZUJEN5N.cjs.map +1 -0
- package/dist/chunk-GDK2HJTF.cjs +1346 -0
- package/dist/chunk-GDK2HJTF.cjs.map +1 -0
- package/dist/chunk-KG3GNTYI.js +1339 -0
- package/dist/chunk-KG3GNTYI.js.map +1 -0
- package/dist/chunk-KV5SP7RP.cjs +114 -0
- package/dist/chunk-KV5SP7RP.cjs.map +1 -0
- package/dist/chunk-NPIKZKLU.cjs +27 -0
- package/dist/chunk-NPIKZKLU.cjs.map +1 -0
- package/dist/chunk-OAAZZUYL.cjs +1517 -0
- package/dist/chunk-OAAZZUYL.cjs.map +1 -0
- package/dist/chunk-P4BYTXZ7.js +98 -0
- package/dist/chunk-P4BYTXZ7.js.map +1 -0
- package/dist/chunk-PDM2KR7T.js +392 -0
- package/dist/chunk-PDM2KR7T.js.map +1 -0
- package/dist/chunk-QOZI2HY5.js +24 -0
- package/dist/chunk-QOZI2HY5.js.map +1 -0
- package/dist/chunk-RFBLNKW6.js +20035 -0
- package/dist/chunk-RFBLNKW6.js.map +1 -0
- package/dist/chunk-UELAE75E.cjs +408 -0
- package/dist/chunk-UELAE75E.cjs.map +1 -0
- package/dist/client-9Rwj21T9.d.cts +77 -0
- package/dist/client-Bskq7sc_.d.ts +77 -0
- package/dist/client-CLhQragb.d.cts +446 -0
- package/dist/client-CLhQragb.d.ts +446 -0
- package/dist/error-CsVoUTY8.d.cts +95 -0
- package/dist/error-CsVoUTY8.d.ts +95 -0
- package/dist/index-BrGSfyXq.d.cts +79 -0
- package/dist/index-zPcVLagO.d.ts +79 -0
- package/dist/index.cjs +1675 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9943 -0
- package/dist/index.d.ts +9943 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/inference/index.cjs +70 -0
- package/dist/inference/index.cjs.map +1 -0
- package/dist/inference/index.d.cts +80 -0
- package/dist/inference/index.d.ts +80 -0
- package/dist/inference/index.js +5 -0
- package/dist/inference/index.js.map +1 -0
- package/dist/pagination/index.cjs +34 -0
- package/dist/pagination/index.cjs.map +1 -0
- package/dist/pagination/index.d.cts +6 -0
- package/dist/pagination/index.d.ts +6 -0
- package/dist/pagination/index.js +5 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/sync-engine-DVKQO-1-.d.cts +423 -0
- package/dist/sync-engine-cLwTqdjv.d.ts +423 -0
- package/dist/types-2RotD0Ab.d.cts +102 -0
- package/dist/types-2RotD0Ab.d.ts +102 -0
- package/package.json +143 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { D as DvinaError } from '../error-CsVoUTY8.js';
|
|
2
|
+
|
|
3
|
+
type Maybe<T> = T | null;
|
|
4
|
+
type Exact<T extends {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}> = {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
};
|
|
9
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
10
|
+
type Scalars = {
|
|
11
|
+
ID: string;
|
|
12
|
+
String: string;
|
|
13
|
+
Boolean: boolean;
|
|
14
|
+
Int: number;
|
|
15
|
+
Float: number;
|
|
16
|
+
/** A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format. */
|
|
17
|
+
DateTime: any;
|
|
18
|
+
/** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
|
|
19
|
+
JSONObject: any;
|
|
20
|
+
};
|
|
21
|
+
type EntitlementDetail = {
|
|
22
|
+
canAddReport: Scalars['Boolean'];
|
|
23
|
+
canAddUser: Scalars['Boolean'];
|
|
24
|
+
canUseApi: Scalars['Boolean'];
|
|
25
|
+
capacity?: Maybe<Scalars['Int']>;
|
|
26
|
+
deepAnalysisCharacterLimit?: Maybe<Scalars['Float']>;
|
|
27
|
+
deepAnalysisTokenLimit?: Maybe<Scalars['Float']>;
|
|
28
|
+
hardTokenUsageLimit?: Maybe<Scalars['Float']>;
|
|
29
|
+
maxStructuredSize?: Maybe<Scalars['Int']>;
|
|
30
|
+
maxUnstructuredSize?: Maybe<Scalars['Int']>;
|
|
31
|
+
minUsers?: Maybe<Scalars['Int']>;
|
|
32
|
+
softTokenUsageLimit?: Maybe<Scalars['Float']>;
|
|
33
|
+
sourceTypes?: Maybe<Array<Scalars['String']>>;
|
|
34
|
+
team: Scalars['Boolean'];
|
|
35
|
+
};
|
|
36
|
+
declare enum EntitlementTier {
|
|
37
|
+
Enterprise = "enterprise",
|
|
38
|
+
Free = "free",
|
|
39
|
+
Max = "max",
|
|
40
|
+
Plus = "plus",
|
|
41
|
+
Pro = "pro"
|
|
42
|
+
}
|
|
43
|
+
type Plan = {
|
|
44
|
+
entitlements: EntitlementDetail;
|
|
45
|
+
features?: Maybe<Array<Scalars['JSONObject']>>;
|
|
46
|
+
id: Scalars['String'];
|
|
47
|
+
name: Scalars['String'];
|
|
48
|
+
prices: Array<Price>;
|
|
49
|
+
tier?: Maybe<EntitlementTier>;
|
|
50
|
+
};
|
|
51
|
+
type Price = {
|
|
52
|
+
amount?: Maybe<Scalars['Float']>;
|
|
53
|
+
currency: Scalars['String'];
|
|
54
|
+
id: Scalars['String'];
|
|
55
|
+
interval?: Maybe<SubscriptionCycle>;
|
|
56
|
+
};
|
|
57
|
+
type ScheduledChange = {
|
|
58
|
+
effectiveDate?: Maybe<Scalars['DateTime']>;
|
|
59
|
+
newCycle?: Maybe<SubscriptionCycle>;
|
|
60
|
+
newSeats?: Maybe<Scalars['Int']>;
|
|
61
|
+
newTier?: Maybe<EntitlementTier>;
|
|
62
|
+
};
|
|
63
|
+
declare enum SubscriptionCycle {
|
|
64
|
+
Daily = "DAILY",
|
|
65
|
+
Monthly = "MONTHLY",
|
|
66
|
+
Weekly = "WEEKLY",
|
|
67
|
+
Yearly = "YEARLY"
|
|
68
|
+
}
|
|
69
|
+
declare enum SubscriptionProvider {
|
|
70
|
+
Revcat = "REVCAT",
|
|
71
|
+
Stripe = "STRIPE"
|
|
72
|
+
}
|
|
73
|
+
type WorkspaceSubscription = {
|
|
74
|
+
cancelAtPeriodEnd?: Maybe<Scalars['Boolean']>;
|
|
75
|
+
currentPeriodEnd?: Maybe<Scalars['DateTime']>;
|
|
76
|
+
currentPeriodStart?: Maybe<Scalars['DateTime']>;
|
|
77
|
+
cycle?: Maybe<SubscriptionCycle>;
|
|
78
|
+
provider?: Maybe<SubscriptionProvider>;
|
|
79
|
+
scheduledChange?: Maybe<ScheduledChange>;
|
|
80
|
+
seats: Scalars['Int'];
|
|
81
|
+
tier: EntitlementTier;
|
|
82
|
+
};
|
|
83
|
+
type PlanQueryVariables = Exact<{
|
|
84
|
+
id: Scalars['String'];
|
|
85
|
+
}>;
|
|
86
|
+
type PlanFragmentFragment = {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
tier?: EntitlementTier | null;
|
|
90
|
+
features?: Array<any> | null;
|
|
91
|
+
prices: Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
currency: string;
|
|
94
|
+
amount?: number | null;
|
|
95
|
+
interval?: SubscriptionCycle | null;
|
|
96
|
+
}>;
|
|
97
|
+
entitlements: {
|
|
98
|
+
canAddUser: boolean;
|
|
99
|
+
minUsers?: number | null;
|
|
100
|
+
team: boolean;
|
|
101
|
+
capacity?: number | null;
|
|
102
|
+
sourceTypes?: Array<string> | null;
|
|
103
|
+
softTokenUsageLimit?: number | null;
|
|
104
|
+
hardTokenUsageLimit?: number | null;
|
|
105
|
+
canAddReport: boolean;
|
|
106
|
+
canUseApi: boolean;
|
|
107
|
+
maxStructuredSize?: number | null;
|
|
108
|
+
maxUnstructuredSize?: number | null;
|
|
109
|
+
deepAnalysisTokenLimit?: number | null;
|
|
110
|
+
deepAnalysisCharacterLimit?: number | null;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
type SubscriptionForManagerQueryVariables = Exact<{
|
|
114
|
+
workspaceId: Scalars['String'];
|
|
115
|
+
}>;
|
|
116
|
+
type SubscriptionEntitlementsForManagerQueryVariables = Exact<{
|
|
117
|
+
workspaceId: Scalars['String'];
|
|
118
|
+
}>;
|
|
119
|
+
type UpgradePlanMutationVariables = Exact<{
|
|
120
|
+
targetPriceId: Scalars['String'];
|
|
121
|
+
}>;
|
|
122
|
+
type DowngradePlanMutationVariables = Exact<{
|
|
123
|
+
targetPriceId: Scalars['String'];
|
|
124
|
+
}>;
|
|
125
|
+
type AddSeatsMutationVariables = Exact<{
|
|
126
|
+
additionalSeats: Scalars['Int'];
|
|
127
|
+
}>;
|
|
128
|
+
type ChangeBillingCycleMutationVariables = Exact<{
|
|
129
|
+
targetPriceId: Scalars['String'];
|
|
130
|
+
}>;
|
|
131
|
+
type RemoveSeatsMutationVariables = Exact<{
|
|
132
|
+
seatsToRemove: Scalars['Int'];
|
|
133
|
+
}>;
|
|
134
|
+
type CancelSubscriptionForManagerMutationVariables = Exact<{
|
|
135
|
+
workspaceId: Scalars['String'];
|
|
136
|
+
}>;
|
|
137
|
+
type ReactivateSubscriptionForManagerMutationVariables = Exact<{
|
|
138
|
+
workspaceId: Scalars['String'];
|
|
139
|
+
}>;
|
|
140
|
+
type CreateCustomerMutationVariables = Exact<{
|
|
141
|
+
name: Scalars['String'];
|
|
142
|
+
email: Scalars['String'];
|
|
143
|
+
workspaceId: Scalars['String'];
|
|
144
|
+
userId: Scalars['String'];
|
|
145
|
+
}>;
|
|
146
|
+
type CreateCheckoutSessionMutationVariables = Exact<{
|
|
147
|
+
priceId: Scalars['String'];
|
|
148
|
+
successUrl: Scalars['String'];
|
|
149
|
+
cancelUrl: Scalars['String'];
|
|
150
|
+
}>;
|
|
151
|
+
type CreateCustomerPortalSessionMutationVariables = Exact<{
|
|
152
|
+
returnUrl: Scalars['String'];
|
|
153
|
+
}>;
|
|
154
|
+
|
|
155
|
+
interface BillingClientOptions {
|
|
156
|
+
/** Full billing GraphQL HTTP URL (e.g. 'https://billing.dvina.ai/graphql') */
|
|
157
|
+
billingHttpUrl: string;
|
|
158
|
+
/** Full billing SSE URL (e.g. 'https://billing.dvina.ai/subscriptions/stream') */
|
|
159
|
+
billingSseUrl: string;
|
|
160
|
+
/** Token callback — shared with the main SDK */
|
|
161
|
+
getToken: (options?: {
|
|
162
|
+
forceRefresh?: boolean;
|
|
163
|
+
}) => Promise<string>;
|
|
164
|
+
/** Global error callback — threaded from DvinaSdkOptions */
|
|
165
|
+
onError?: (error: DvinaError) => void;
|
|
166
|
+
}
|
|
167
|
+
declare class BillingClient {
|
|
168
|
+
private readonly http;
|
|
169
|
+
private readonly options;
|
|
170
|
+
private readonly activeAbortControllers;
|
|
171
|
+
constructor(options: BillingClientOptions);
|
|
172
|
+
/**
|
|
173
|
+
* Terminate all active SSE streams.
|
|
174
|
+
* Call this on logout or SDK teardown to prevent lingering connections.
|
|
175
|
+
*/
|
|
176
|
+
destroy(): void;
|
|
177
|
+
get plans(): {
|
|
178
|
+
list: () => Promise<{
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
tier?: EntitlementTier | null;
|
|
182
|
+
features?: Array<any> | null;
|
|
183
|
+
prices: Array<{
|
|
184
|
+
id: string;
|
|
185
|
+
currency: string;
|
|
186
|
+
amount?: number | null;
|
|
187
|
+
interval?: SubscriptionCycle | null;
|
|
188
|
+
}>;
|
|
189
|
+
entitlements: {
|
|
190
|
+
canAddUser: boolean;
|
|
191
|
+
minUsers?: number | null;
|
|
192
|
+
team: boolean;
|
|
193
|
+
capacity?: number | null;
|
|
194
|
+
sourceTypes?: Array<string> | null;
|
|
195
|
+
softTokenUsageLimit?: number | null;
|
|
196
|
+
hardTokenUsageLimit?: number | null;
|
|
197
|
+
canAddReport: boolean;
|
|
198
|
+
canUseApi: boolean;
|
|
199
|
+
maxStructuredSize?: number | null;
|
|
200
|
+
maxUnstructuredSize?: number | null;
|
|
201
|
+
deepAnalysisTokenLimit?: number | null;
|
|
202
|
+
deepAnalysisCharacterLimit?: number | null;
|
|
203
|
+
};
|
|
204
|
+
}[]>;
|
|
205
|
+
get: (variables: PlanQueryVariables) => Promise<{
|
|
206
|
+
id: string;
|
|
207
|
+
name: string;
|
|
208
|
+
tier?: EntitlementTier | null;
|
|
209
|
+
features?: Array<any> | null;
|
|
210
|
+
prices: Array<{
|
|
211
|
+
id: string;
|
|
212
|
+
currency: string;
|
|
213
|
+
amount?: number | null;
|
|
214
|
+
interval?: SubscriptionCycle | null;
|
|
215
|
+
}>;
|
|
216
|
+
entitlements: {
|
|
217
|
+
canAddUser: boolean;
|
|
218
|
+
minUsers?: number | null;
|
|
219
|
+
team: boolean;
|
|
220
|
+
capacity?: number | null;
|
|
221
|
+
sourceTypes?: Array<string> | null;
|
|
222
|
+
softTokenUsageLimit?: number | null;
|
|
223
|
+
hardTokenUsageLimit?: number | null;
|
|
224
|
+
canAddReport: boolean;
|
|
225
|
+
canUseApi: boolean;
|
|
226
|
+
maxStructuredSize?: number | null;
|
|
227
|
+
maxUnstructuredSize?: number | null;
|
|
228
|
+
deepAnalysisTokenLimit?: number | null;
|
|
229
|
+
deepAnalysisCharacterLimit?: number | null;
|
|
230
|
+
};
|
|
231
|
+
} | null | undefined>;
|
|
232
|
+
entitlements: () => Promise<Record<EntitlementTier, EntitlementDetail>>;
|
|
233
|
+
tierOrders: () => Promise<any>;
|
|
234
|
+
};
|
|
235
|
+
get subscription(): {
|
|
236
|
+
get: () => Promise<{
|
|
237
|
+
tier: EntitlementTier;
|
|
238
|
+
provider?: SubscriptionProvider | null;
|
|
239
|
+
cycle?: SubscriptionCycle | null;
|
|
240
|
+
seats: number;
|
|
241
|
+
cancelAtPeriodEnd?: boolean | null;
|
|
242
|
+
currentPeriodStart?: any | null;
|
|
243
|
+
currentPeriodEnd?: any | null;
|
|
244
|
+
scheduledChange?: {
|
|
245
|
+
effectiveDate?: any | null;
|
|
246
|
+
newTier?: EntitlementTier | null;
|
|
247
|
+
newSeats?: number | null;
|
|
248
|
+
newCycle?: SubscriptionCycle | null;
|
|
249
|
+
} | null;
|
|
250
|
+
}>;
|
|
251
|
+
entitlements: () => Promise<{
|
|
252
|
+
canAddUser: boolean;
|
|
253
|
+
minUsers?: number | null;
|
|
254
|
+
team: boolean;
|
|
255
|
+
capacity?: number | null;
|
|
256
|
+
sourceTypes?: Array<string> | null;
|
|
257
|
+
softTokenUsageLimit?: number | null;
|
|
258
|
+
hardTokenUsageLimit?: number | null;
|
|
259
|
+
canAddReport: boolean;
|
|
260
|
+
canUseApi: boolean;
|
|
261
|
+
maxStructuredSize?: number | null;
|
|
262
|
+
maxUnstructuredSize?: number | null;
|
|
263
|
+
deepAnalysisTokenLimit?: number | null;
|
|
264
|
+
deepAnalysisCharacterLimit?: number | null;
|
|
265
|
+
}>;
|
|
266
|
+
upgrade: (variables: UpgradePlanMutationVariables) => Promise<boolean>;
|
|
267
|
+
prorationAmount: (variables: {
|
|
268
|
+
targetPriceId: string;
|
|
269
|
+
}) => Promise<number>;
|
|
270
|
+
downgrade: (variables: DowngradePlanMutationVariables) => Promise<boolean>;
|
|
271
|
+
changeBillingCycle: (variables: ChangeBillingCycleMutationVariables) => Promise<boolean>;
|
|
272
|
+
cancel: () => Promise<boolean>;
|
|
273
|
+
reactivate: () => Promise<boolean>;
|
|
274
|
+
releaseSchedule: () => Promise<boolean>;
|
|
275
|
+
/**
|
|
276
|
+
* Subscribe to real-time subscription updates via SSE.
|
|
277
|
+
* Returns an AsyncIterable that yields WorkspaceSubscription snapshots.
|
|
278
|
+
* Automatically reconnects with exponential backoff and token refresh on auth errors.
|
|
279
|
+
*/
|
|
280
|
+
updates: () => AsyncIterable<WorkspaceSubscription>;
|
|
281
|
+
};
|
|
282
|
+
get seats(): {
|
|
283
|
+
add: (variables: AddSeatsMutationVariables) => Promise<boolean>;
|
|
284
|
+
remove: (variables: RemoveSeatsMutationVariables) => Promise<boolean>;
|
|
285
|
+
};
|
|
286
|
+
get session(): {
|
|
287
|
+
createSession: (variables: CreateCheckoutSessionMutationVariables) => Promise<{
|
|
288
|
+
url: string;
|
|
289
|
+
}>;
|
|
290
|
+
createCustomerPortalSession: (variables: CreateCustomerPortalSessionMutationVariables) => Promise<{
|
|
291
|
+
url: string;
|
|
292
|
+
}>;
|
|
293
|
+
};
|
|
294
|
+
get management(): {
|
|
295
|
+
subscription: (variables: SubscriptionForManagerQueryVariables) => Promise<{
|
|
296
|
+
tier: EntitlementTier;
|
|
297
|
+
provider?: SubscriptionProvider | null;
|
|
298
|
+
cycle?: SubscriptionCycle | null;
|
|
299
|
+
seats: number;
|
|
300
|
+
cancelAtPeriodEnd?: boolean | null;
|
|
301
|
+
currentPeriodStart?: any | null;
|
|
302
|
+
currentPeriodEnd?: any | null;
|
|
303
|
+
scheduledChange?: {
|
|
304
|
+
effectiveDate?: any | null;
|
|
305
|
+
newTier?: EntitlementTier | null;
|
|
306
|
+
newSeats?: number | null;
|
|
307
|
+
newCycle?: SubscriptionCycle | null;
|
|
308
|
+
} | null;
|
|
309
|
+
}>;
|
|
310
|
+
entitlements: (variables: SubscriptionEntitlementsForManagerQueryVariables) => Promise<{
|
|
311
|
+
canAddUser: boolean;
|
|
312
|
+
minUsers?: number | null;
|
|
313
|
+
team: boolean;
|
|
314
|
+
capacity?: number | null;
|
|
315
|
+
sourceTypes?: Array<string> | null;
|
|
316
|
+
softTokenUsageLimit?: number | null;
|
|
317
|
+
hardTokenUsageLimit?: number | null;
|
|
318
|
+
canAddReport: boolean;
|
|
319
|
+
canUseApi: boolean;
|
|
320
|
+
maxStructuredSize?: number | null;
|
|
321
|
+
maxUnstructuredSize?: number | null;
|
|
322
|
+
deepAnalysisTokenLimit?: number | null;
|
|
323
|
+
deepAnalysisCharacterLimit?: number | null;
|
|
324
|
+
}>;
|
|
325
|
+
cancel: (variables: CancelSubscriptionForManagerMutationVariables) => Promise<boolean>;
|
|
326
|
+
reactivate: (variables: ReactivateSubscriptionForManagerMutationVariables) => Promise<boolean>;
|
|
327
|
+
createCustomer: (variables: CreateCustomerMutationVariables) => Promise<string>;
|
|
328
|
+
};
|
|
329
|
+
private request;
|
|
330
|
+
/**
|
|
331
|
+
* Create an SSE stream that connects to the billing SSE endpoint.
|
|
332
|
+
* Reconnects automatically with exponential backoff.
|
|
333
|
+
* On 401/403, refreshes the token and retries with a short delay.
|
|
334
|
+
*/
|
|
335
|
+
private createSseStream;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export { BillingClient, type BillingClientOptions, type EntitlementDetail, EntitlementTier, type Plan, type PlanFragmentFragment as PlanFragment, type Price, type ScheduledChange, SubscriptionCycle, SubscriptionProvider, type WorkspaceSubscription };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/runtime/request.ts
|
|
4
|
+
var Request = class {
|
|
5
|
+
_request;
|
|
6
|
+
_syncEngine;
|
|
7
|
+
_subscribe;
|
|
8
|
+
_baseUrl;
|
|
9
|
+
constructor(request, syncEngine, subscribe, baseUrl) {
|
|
10
|
+
this._request = request;
|
|
11
|
+
this._syncEngine = syncEngine;
|
|
12
|
+
this._subscribe = subscribe;
|
|
13
|
+
this._baseUrl = baseUrl;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/pagination/connection.ts
|
|
18
|
+
var DEFAULT_PAGE_SIZE = 50;
|
|
19
|
+
function defaultConnection(variables) {
|
|
20
|
+
return {
|
|
21
|
+
...variables,
|
|
22
|
+
first: variables.first ?? (variables.after ? DEFAULT_PAGE_SIZE : void 0),
|
|
23
|
+
last: variables.last ?? (variables.before ? DEFAULT_PAGE_SIZE : void 0)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var PageInfo = class {
|
|
27
|
+
hasNextPage;
|
|
28
|
+
hasPreviousPage;
|
|
29
|
+
startCursor;
|
|
30
|
+
endCursor;
|
|
31
|
+
constructor(data) {
|
|
32
|
+
this.hasNextPage = data.hasNextPage;
|
|
33
|
+
this.hasPreviousPage = data.hasPreviousPage;
|
|
34
|
+
this.startCursor = data.startCursor;
|
|
35
|
+
this.endCursor = data.endCursor;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var AbstractConnection = class extends Request {
|
|
39
|
+
pageInfo;
|
|
40
|
+
nodes;
|
|
41
|
+
totalCount;
|
|
42
|
+
constructor(request) {
|
|
43
|
+
super(request);
|
|
44
|
+
this.pageInfo = new PageInfo({
|
|
45
|
+
hasNextPage: false,
|
|
46
|
+
hasPreviousPage: false
|
|
47
|
+
});
|
|
48
|
+
this.nodes = [];
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var Connection = class extends AbstractConnection {
|
|
52
|
+
_fetch;
|
|
53
|
+
constructor(request, fetch, nodes, pageInfo, totalCount) {
|
|
54
|
+
super(request);
|
|
55
|
+
this._fetch = fetch;
|
|
56
|
+
this.nodes = nodes;
|
|
57
|
+
this.pageInfo = pageInfo;
|
|
58
|
+
this.totalCount = totalCount;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Fetch the next page and append nodes.
|
|
62
|
+
* Mutates this connection instance in place (nodes are appended, pageInfo updated).
|
|
63
|
+
*/
|
|
64
|
+
async fetchNext(options) {
|
|
65
|
+
if (this.pageInfo.hasNextPage) {
|
|
66
|
+
const response = await this._fetch(
|
|
67
|
+
{ after: this.pageInfo.endCursor },
|
|
68
|
+
options
|
|
69
|
+
);
|
|
70
|
+
if (response) {
|
|
71
|
+
this.nodes = [...this.nodes, ...response.nodes];
|
|
72
|
+
this.pageInfo.endCursor = response.pageInfo.endCursor ?? this.pageInfo.endCursor;
|
|
73
|
+
this.pageInfo.hasNextPage = response.pageInfo.hasNextPage;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fetch the previous page and prepend nodes.
|
|
80
|
+
* Mutates this connection instance in place (nodes are prepended, pageInfo updated).
|
|
81
|
+
*/
|
|
82
|
+
async fetchPrevious(options) {
|
|
83
|
+
if (this.pageInfo.hasPreviousPage) {
|
|
84
|
+
const response = await this._fetch(
|
|
85
|
+
{ before: this.pageInfo.startCursor },
|
|
86
|
+
options
|
|
87
|
+
);
|
|
88
|
+
if (response) {
|
|
89
|
+
this.nodes = [...response.nodes, ...this.nodes];
|
|
90
|
+
this.pageInfo.startCursor = response.pageInfo.startCursor ?? this.pageInfo.startCursor;
|
|
91
|
+
this.pageInfo.hasPreviousPage = response.pageInfo.hasPreviousPage;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.AbstractConnection = AbstractConnection;
|
|
99
|
+
exports.Connection = Connection;
|
|
100
|
+
exports.PageInfo = PageInfo;
|
|
101
|
+
exports.Request = Request;
|
|
102
|
+
exports.defaultConnection = defaultConnection;
|
|
103
|
+
//# sourceMappingURL=chunk-4QKWHQT2.cjs.map
|
|
104
|
+
//# sourceMappingURL=chunk-4QKWHQT2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/request.ts","../src/pagination/connection.ts"],"names":[],"mappings":"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","file":"chunk-4QKWHQT2.cjs","sourcesContent":["import type { DvinaRequest, DvinaSubscribe } from '../types.js';\nimport type { SyncEngine } from '../store/sync-engine.js';\n\n/**\n * Base class that holds the transport functions.\n * Every generated model, connection, query, and the root SDK class extend this.\n *\n * Operation classes use `_syncEngine` for queries/mutations/watch.\n * Subscription classes use `_subscribe` for WebSocket streaming.\n * Model classes use `_request` for compatibility (lazy fetch).\n */\nexport class Request {\n\tprotected _request: DvinaRequest;\n\tprotected _syncEngine?: SyncEngine;\n\tprotected _subscribe?: DvinaSubscribe;\n\tprotected _baseUrl?: string;\n\n\tpublic constructor(request: DvinaRequest, syncEngine?: SyncEngine, subscribe?: DvinaSubscribe, baseUrl?: string) {\n\t\tthis._request = request;\n\t\tthis._syncEngine = syncEngine;\n\t\tthis._subscribe = subscribe;\n\t\tthis._baseUrl = baseUrl;\n\t}\n}\n","import { Request } from '../runtime/request.js';\nimport type { DvinaRequest, ConnectionVariables, FetchOptions, PageInfoData } from '../types.js';\n\n/** Default page size when cursor-paginating without an explicit first/last */\nconst DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Default connection variables when paginating.\n * Ensures `first` or `last` is set when a cursor is provided.\n */\nexport function defaultConnection<V extends ConnectionVariables>(variables: V): V {\n\treturn {\n\t\t...variables,\n\t\tfirst: variables.first ?? (variables.after ? DEFAULT_PAGE_SIZE : undefined),\n\t\tlast: variables.last ?? (variables.before ? DEFAULT_PAGE_SIZE : undefined),\n\t};\n}\n\n/**\n * PageInfo model following the Relay spec.\n */\nexport class PageInfo {\n\tpublic hasNextPage: boolean;\n\tpublic hasPreviousPage: boolean;\n\tpublic startCursor?: string | null;\n\tpublic endCursor?: string | null;\n\n\tconstructor(data: PageInfoData) {\n\t\tthis.hasNextPage = data.hasNextPage;\n\t\tthis.hasPreviousPage = data.hasPreviousPage;\n\t\tthis.startCursor = data.startCursor;\n\t\tthis.endCursor = data.endCursor;\n\t}\n}\n\n/**\n * Abstract base class for connection types.\n * Holds nodes and page info, used for type checking.\n */\nexport abstract class AbstractConnection<Node> extends Request {\n\tpublic pageInfo: PageInfo;\n\tpublic nodes: Node[];\n\tpublic totalCount?: number;\n\n\tpublic constructor(request: DvinaRequest) {\n\t\tsuper(request);\n\t\tthis.pageInfo = new PageInfo({\n\t\t\thasNextPage: false,\n\t\t\thasPreviousPage: false,\n\t\t});\n\t\tthis.nodes = [];\n\t}\n}\n\n/**\n * Concrete connection class with pagination helpers.\n * Generated connection subclasses extend this.\n *\n * The `_fetch` closure is created by the query class and allows re-fetching\n * with different pagination variables.\n */\nexport class Connection<Node> extends AbstractConnection<Node> {\n\tprivate _fetch: (\n\t\tvariables?: ConnectionVariables,\n\t\toptions?: FetchOptions,\n\t) => Promise<Connection<Node> | undefined>;\n\n\tpublic constructor(\n\t\trequest: DvinaRequest,\n\t\tfetch: (\n\t\t\tvariables?: ConnectionVariables,\n\t\t\toptions?: FetchOptions,\n\t\t) => Promise<Connection<Node> | undefined>,\n\t\tnodes: Node[],\n\t\tpageInfo: PageInfo,\n\t\ttotalCount?: number,\n\t) {\n\t\tsuper(request);\n\t\tthis._fetch = fetch;\n\t\tthis.nodes = nodes;\n\t\tthis.pageInfo = pageInfo;\n\t\tthis.totalCount = totalCount;\n\t}\n\n\t/**\n\t * Fetch the next page and append nodes.\n\t * Mutates this connection instance in place (nodes are appended, pageInfo updated).\n\t */\n\tpublic async fetchNext(options?: FetchOptions): Promise<this> {\n\t\tif (this.pageInfo.hasNextPage) {\n\t\t\tconst response = await this._fetch(\n\t\t\t\t{ after: this.pageInfo.endCursor },\n\t\t\t\toptions,\n\t\t\t);\n\t\t\tif (response) {\n\t\t\t\tthis.nodes = [...this.nodes, ...response.nodes];\n\t\t\t\tthis.pageInfo.endCursor = response.pageInfo.endCursor ?? this.pageInfo.endCursor;\n\t\t\t\tthis.pageInfo.hasNextPage = response.pageInfo.hasNextPage;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Fetch the previous page and prepend nodes.\n\t * Mutates this connection instance in place (nodes are prepended, pageInfo updated).\n\t */\n\tpublic async fetchPrevious(options?: FetchOptions): Promise<this> {\n\t\tif (this.pageInfo.hasPreviousPage) {\n\t\t\tconst response = await this._fetch(\n\t\t\t\t{ before: this.pageInfo.startCursor },\n\t\t\t\toptions,\n\t\t\t);\n\t\t\tif (response) {\n\t\t\t\tthis.nodes = [...response.nodes, ...this.nodes];\n\t\t\t\tthis.pageInfo.startCursor = response.pageInfo.startCursor ?? this.pageInfo.startCursor;\n\t\t\t\tthis.pageInfo.hasPreviousPage = response.pageInfo.hasPreviousPage;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
export { __commonJS, __toESM };
|
|
28
|
+
//# sourceMappingURL=chunk-5WRI5ZAA.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-5WRI5ZAA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-5WRI5ZAA.js"}
|