@serialsubscriptions/platform-integration 0.0.8-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/README.md +1 -0
- package/lib/SSIProject.d.ts +343 -0
- package/lib/SSIProject.js +429 -0
- package/lib/SSIProjectApi.d.ts +384 -0
- package/lib/SSIProjectApi.js +534 -0
- package/lib/SSISubscribedFeatureApi.d.ts +387 -0
- package/lib/SSISubscribedFeatureApi.js +511 -0
- package/lib/SSISubscribedLimitApi.d.ts +384 -0
- package/lib/SSISubscribedLimitApi.js +534 -0
- package/lib/SSISubscribedPlanApi.d.ts +395 -0
- package/lib/SSISubscribedPlanApi.js +567 -0
- package/lib/SubscribedPlanManager.d.ts +400 -0
- package/lib/SubscribedPlanManager.js +319 -0
- package/lib/UsageApi.d.ts +128 -0
- package/lib/UsageApi.js +224 -0
- package/lib/auth.server.d.ts +212 -0
- package/lib/auth.server.js +624 -0
- package/lib/cache/SSICache.d.ts +40 -0
- package/lib/cache/SSICache.js +134 -0
- package/lib/cache/backends/MemoryCacheBackend.d.ts +15 -0
- package/lib/cache/backends/MemoryCacheBackend.js +46 -0
- package/lib/cache/backends/RedisCacheBackend.d.ts +27 -0
- package/lib/cache/backends/RedisCacheBackend.js +95 -0
- package/lib/cache/constants.d.ts +7 -0
- package/lib/cache/constants.js +10 -0
- package/lib/cache/types.d.ts +27 -0
- package/lib/cache/types.js +2 -0
- package/lib/clientConfig.d.ts +42 -0
- package/lib/clientConfig.js +80 -0
- package/lib/frontend/index.d.ts +3 -0
- package/lib/frontend/index.js +12 -0
- package/lib/frontend/session/SessionClient.d.ts +36 -0
- package/lib/frontend/session/SessionClient.js +151 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +40 -0
- package/lib/lib/session/SessionClient.d.ts +11 -0
- package/lib/lib/session/SessionClient.js +47 -0
- package/lib/lib/session/index.d.ts +3 -0
- package/lib/lib/session/index.js +3 -0
- package/lib/lib/session/stores/MemoryStore.d.ts +7 -0
- package/lib/lib/session/stores/MemoryStore.js +23 -0
- package/lib/lib/session/stores/index.d.ts +1 -0
- package/lib/lib/session/stores/index.js +1 -0
- package/lib/lib/session/types.d.ts +37 -0
- package/lib/lib/session/types.js +1 -0
- package/lib/requestConfig.d.ts +60 -0
- package/lib/requestConfig.js +151 -0
- package/lib/session/SessionClient.d.ts +19 -0
- package/lib/session/SessionClient.js +132 -0
- package/lib/session/SessionManager.d.ts +142 -0
- package/lib/session/SessionManager.js +437 -0
- package/lib/stateStore.d.ts +5 -0
- package/lib/stateStore.js +9 -0
- package/lib/storage/SSIStorage.d.ts +24 -0
- package/lib/storage/SSIStorage.js +117 -0
- package/lib/storage/backends/MemoryBackend.d.ts +10 -0
- package/lib/storage/backends/MemoryBackend.js +44 -0
- package/lib/storage/backends/PostgresBackend.d.ts +24 -0
- package/lib/storage/backends/PostgresBackend.js +106 -0
- package/lib/storage/backends/RedisBackend.d.ts +19 -0
- package/lib/storage/backends/RedisBackend.js +78 -0
- package/lib/storage/types.d.ts +27 -0
- package/lib/storage/types.js +2 -0
- package/package.json +74 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* SubscribedPlanManager - High-level manager for subscribed plans with features and limits
|
|
4
|
+
*
|
|
5
|
+
* This manager wires together the three JSON:API clients (SSISubscribedPlanApi,
|
|
6
|
+
* SSISubscribedFeatureApi, SSISubscribedLimitApi) and provides a convenient interface
|
|
7
|
+
* for fetching subscribed plans with their associated features and limits already attached.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const domain = 'https://account.serialsubscriptionsdev.com';
|
|
13
|
+
* const manager = new SubscribedPlanManager(domain);
|
|
14
|
+
*
|
|
15
|
+
* // Use the ACCESS_TOKEN from your session (not id_token). Set it before each request if the manager is shared.
|
|
16
|
+
* manager.setBearerToken(accessTokenFromSession);
|
|
17
|
+
*
|
|
18
|
+
* // Get all plans with features and limits
|
|
19
|
+
* const allPlans = await manager.getAllPlans();
|
|
20
|
+
*
|
|
21
|
+
* // Get a single plan by internal numeric ID
|
|
22
|
+
* const plan = await manager.getPlanById(1);
|
|
23
|
+
*
|
|
24
|
+
* // Get plans by project ID
|
|
25
|
+
* const projectPlans = await manager.getPlansByProjectId(42);
|
|
26
|
+
*
|
|
27
|
+
* // Get single plan for a project (or null)
|
|
28
|
+
* const plan = await manager.getPlanForProject(42);
|
|
29
|
+
*
|
|
30
|
+
* // Get plans by user internal ID
|
|
31
|
+
* const userPlans = await manager.getPlansByUserId(3);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import { type JsonApiResource } from './SSISubscribedPlanApi';
|
|
35
|
+
/**
|
|
36
|
+
* Attributes for a subscribed_plan--subscribed_plan resource.
|
|
37
|
+
* Based on your JSON sample; extra fields will still be present in the raw JSON:API resource.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Known values for subscribed plan `status` (and for project `subscription_status`
|
|
41
|
+
* when synced from the platform). Document the full list in SUBSCRIBEDPLAN_MANAGER.md.
|
|
42
|
+
*/
|
|
43
|
+
export declare const SUBSCRIPTION_STATUS: {};
|
|
44
|
+
export type SubscriptionStatusValue = (typeof SUBSCRIPTION_STATUS)[keyof typeof SUBSCRIPTION_STATUS] | string;
|
|
45
|
+
export interface SubscribedPlanAttributes {
|
|
46
|
+
drupal_internal__id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
/** Plan status from the platform. See SUBSCRIBEDPLAN_MANAGER.md for possible values. */
|
|
49
|
+
status: string;
|
|
50
|
+
subscription_period: string;
|
|
51
|
+
name_subscript: string | null;
|
|
52
|
+
most_popular: boolean;
|
|
53
|
+
free_trial: boolean;
|
|
54
|
+
free_trial_days: number;
|
|
55
|
+
description: string | null;
|
|
56
|
+
description_features: {
|
|
57
|
+
value: string | null;
|
|
58
|
+
format: string | null;
|
|
59
|
+
processed: string | null;
|
|
60
|
+
} | null;
|
|
61
|
+
order: number;
|
|
62
|
+
price_show: boolean;
|
|
63
|
+
price_monthly: string;
|
|
64
|
+
price_monthly_subscript: string | null;
|
|
65
|
+
price_annually: string;
|
|
66
|
+
price_annually_subscript: string | null;
|
|
67
|
+
price_discounted: boolean;
|
|
68
|
+
price_discount_monthly: string;
|
|
69
|
+
price_discount_annually: string;
|
|
70
|
+
price_discount_months: number;
|
|
71
|
+
price_discount_years: number;
|
|
72
|
+
button_cta: string;
|
|
73
|
+
footer_description: string | null;
|
|
74
|
+
active_date: string | null;
|
|
75
|
+
archive_date: string | null;
|
|
76
|
+
trial_end_date: string | null;
|
|
77
|
+
created: string;
|
|
78
|
+
changed: string;
|
|
79
|
+
organization_id: number;
|
|
80
|
+
project_id: number | null;
|
|
81
|
+
metadata: unknown | null;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Attributes for a subscribed_feature--subscribed_feature resource.
|
|
86
|
+
*/
|
|
87
|
+
export interface SubscribedFeatureAttributes {
|
|
88
|
+
drupal_internal__id: number;
|
|
89
|
+
feature_name: string;
|
|
90
|
+
feature_category: string;
|
|
91
|
+
feature_type: string;
|
|
92
|
+
feature_value: string | null;
|
|
93
|
+
order: number;
|
|
94
|
+
created: string;
|
|
95
|
+
changed: string;
|
|
96
|
+
[key: string]: unknown;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Attributes for a subscribed_limit--subscribed_limit resource.
|
|
100
|
+
*/
|
|
101
|
+
export interface SubscribedLimitAttributes {
|
|
102
|
+
drupal_internal__id: number;
|
|
103
|
+
limit_name: string;
|
|
104
|
+
limit_description: string;
|
|
105
|
+
status: boolean;
|
|
106
|
+
limit_units: string;
|
|
107
|
+
limit_units_plural: string;
|
|
108
|
+
limit_type: string;
|
|
109
|
+
limit_value: number;
|
|
110
|
+
limit_period: string;
|
|
111
|
+
base_fee: string;
|
|
112
|
+
limit_rate: number;
|
|
113
|
+
allow_overage: boolean;
|
|
114
|
+
overage_rate: number;
|
|
115
|
+
overage_limit: number;
|
|
116
|
+
order: number;
|
|
117
|
+
created: string;
|
|
118
|
+
changed: string;
|
|
119
|
+
[key: string]: unknown;
|
|
120
|
+
}
|
|
121
|
+
export interface SubscribedFeature extends SubscribedFeatureAttributes {
|
|
122
|
+
/**
|
|
123
|
+
* UUID of the subscribed_feature entity.
|
|
124
|
+
*/
|
|
125
|
+
uuid: string;
|
|
126
|
+
/**
|
|
127
|
+
* Raw JSON:API relationships if you need them.
|
|
128
|
+
*/
|
|
129
|
+
relationships?: JsonApiResource['relationships'];
|
|
130
|
+
}
|
|
131
|
+
export interface SubscribedLimit extends SubscribedLimitAttributes {
|
|
132
|
+
/**
|
|
133
|
+
* UUID of the subscribed_limit entity.
|
|
134
|
+
*/
|
|
135
|
+
uuid: string;
|
|
136
|
+
relationships?: JsonApiResource['relationships'];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* High-level plan object with its features and limits already attached.
|
|
140
|
+
*/
|
|
141
|
+
export interface SubscribedPlan extends SubscribedPlanAttributes {
|
|
142
|
+
/**
|
|
143
|
+
* UUID of the subscribed_plan entity.
|
|
144
|
+
*/
|
|
145
|
+
uuid: string;
|
|
146
|
+
relationships?: JsonApiResource['relationships'];
|
|
147
|
+
/**
|
|
148
|
+
* Features attached to this subscribed plan.
|
|
149
|
+
*/
|
|
150
|
+
features: SubscribedFeature[];
|
|
151
|
+
/**
|
|
152
|
+
* Limits attached to this subscribed plan.
|
|
153
|
+
*/
|
|
154
|
+
limits: SubscribedLimit[];
|
|
155
|
+
}
|
|
156
|
+
export interface SubscribedPlanManagerOptions {
|
|
157
|
+
/**
|
|
158
|
+
* Override the JSON:API base path for subscribed plans.
|
|
159
|
+
* Default: '/jsonapi/subscribed_plan/subscribed_plan'
|
|
160
|
+
*/
|
|
161
|
+
planApiBasePath?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Override the JSON:API base path for subscribed features.
|
|
164
|
+
* Default: '/jsonapi/subscribed_feature/subscribed_feature'
|
|
165
|
+
*/
|
|
166
|
+
featureApiBasePath?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Override the JSON:API base path for subscribed limits.
|
|
169
|
+
* Default: '/jsonapi/subscribed_limit/subscribed_limit'
|
|
170
|
+
*/
|
|
171
|
+
limitApiBasePath?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Optional request timeout (ms) if your API clients support it.
|
|
174
|
+
*/
|
|
175
|
+
timeout?: number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* SubscribedPlanManager
|
|
179
|
+
*
|
|
180
|
+
* Fetches subscribed plans and hydrates each with its subscribed features and limits.
|
|
181
|
+
*
|
|
182
|
+
* Filtering conventions (using internal integer IDs):
|
|
183
|
+
* - By plan ID: filter[drupal_internal__id]={subscribed_plan_int_id}
|
|
184
|
+
* - By project ID: filter[project_id]={project_int_id}
|
|
185
|
+
* - By user ID: filter[user_id.meta.drupal_internal__target_id]={user_int_id}
|
|
186
|
+
*
|
|
187
|
+
* For features/limits attached to a plan:
|
|
188
|
+
* - filter[subscribed_plan_id.meta.drupal_internal__target_id]={subscribed_plan_int_id}
|
|
189
|
+
*/
|
|
190
|
+
export declare class SubscribedPlanManager {
|
|
191
|
+
private planApi;
|
|
192
|
+
private featureApi;
|
|
193
|
+
private limitApi;
|
|
194
|
+
private featureCache;
|
|
195
|
+
private limitCache;
|
|
196
|
+
private static readonly CACHE_TTL_SEC;
|
|
197
|
+
constructor(domain: string, options?: SubscribedPlanManagerOptions);
|
|
198
|
+
/**
|
|
199
|
+
* Set a shared Bearer token on all three underlying API clients.
|
|
200
|
+
* Use the OAuth access_token from your session (e.g. SessionManager.getSessionData(sessionId, 'access_token')).
|
|
201
|
+
* Do not use the id_token — the JSON:API expects the access_token for authorization.
|
|
202
|
+
* If the manager is shared across requests, call this with the current request's access_token before each API call.
|
|
203
|
+
*/
|
|
204
|
+
setBearerToken(token: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Get *all* subscribed plans for the current context,
|
|
207
|
+
* each with its features[] and limits[].
|
|
208
|
+
*/
|
|
209
|
+
getAllPlans(): Promise<SubscribedPlan[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Get a single subscribed plan by its internal numeric ID
|
|
212
|
+
* (attributes.drupal_internal__id), with features[] and limits[].
|
|
213
|
+
*/
|
|
214
|
+
getPlanById(subscribedPlanId: number): Promise<SubscribedPlan | null>;
|
|
215
|
+
/**
|
|
216
|
+
* Get all subscribed plans for a given project_id.
|
|
217
|
+
*
|
|
218
|
+
* Uses: ?filter[project_id]={project_int_id}
|
|
219
|
+
*/
|
|
220
|
+
getPlansByProjectId(projectId: number): Promise<SubscribedPlan[]>;
|
|
221
|
+
/**
|
|
222
|
+
* Get the single subscribed plan for a given project_id (with features and limits).
|
|
223
|
+
* Returns the first matching plan, or null if none. Use when at most one plan per project.
|
|
224
|
+
*
|
|
225
|
+
* Uses: ?filter[project_id]={project_int_id}
|
|
226
|
+
*/
|
|
227
|
+
getPlanForProject(projectId: number): Promise<SubscribedPlan | null>;
|
|
228
|
+
/**
|
|
229
|
+
* Filter an array of plans by project_id.
|
|
230
|
+
*
|
|
231
|
+
* @param plans - Array of subscribed plans to filter.
|
|
232
|
+
* @param projectId - The project ID to filter by.
|
|
233
|
+
* @returns Array of plans that match the project ID.
|
|
234
|
+
*/
|
|
235
|
+
getPlanByProjectId(plans: SubscribedPlan[], projectId: number): SubscribedPlan[];
|
|
236
|
+
/**
|
|
237
|
+
* Get all subscribed plans for a given user (internal user ID).
|
|
238
|
+
*
|
|
239
|
+
* Uses: ?filter[user_id.meta.drupal_internal__target_id]={user_int_id}
|
|
240
|
+
*/
|
|
241
|
+
getPlansByUserId(userId: number): Promise<SubscribedPlan[]>;
|
|
242
|
+
/**
|
|
243
|
+
* Get the internal numeric ID of a limit by its name from a plan.
|
|
244
|
+
*
|
|
245
|
+
* @param plan - The subscribed plan to search in.
|
|
246
|
+
* @param limit_name - The name of the limit to find.
|
|
247
|
+
* @returns The internal numeric ID (drupal_internal__id) of the limit, or null if not found.
|
|
248
|
+
*/
|
|
249
|
+
getLimitId(plan: SubscribedPlan, limit_name: string): number | null;
|
|
250
|
+
/**
|
|
251
|
+
* Internal helper to find a limit by name or ID.
|
|
252
|
+
*/
|
|
253
|
+
private findLimit;
|
|
254
|
+
/**
|
|
255
|
+
* Check if a limit is enabled (status is true).
|
|
256
|
+
*
|
|
257
|
+
* @param plan - The subscribed plan to search in.
|
|
258
|
+
* @param limit_name - The name of the limit to check.
|
|
259
|
+
* @returns True if the limit exists and is enabled, false otherwise.
|
|
260
|
+
*/
|
|
261
|
+
isLimitEnabled(plan: SubscribedPlan, limit_name: string): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Check if a limit is enabled (status is true).
|
|
264
|
+
*
|
|
265
|
+
* @param plan - The subscribed plan to search in.
|
|
266
|
+
* @param limit_id - The internal numeric ID of the limit to check.
|
|
267
|
+
* @returns True if the limit exists and is enabled, false otherwise.
|
|
268
|
+
*/
|
|
269
|
+
isLimitEnabled(plan: SubscribedPlan, limit_id: number): boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Get the type of a limit.
|
|
272
|
+
*
|
|
273
|
+
* @param plan - The subscribed plan to search in.
|
|
274
|
+
* @param limit_name - The name of the limit.
|
|
275
|
+
* @returns The limit_type, or null if not found.
|
|
276
|
+
*/
|
|
277
|
+
getLimitType(plan: SubscribedPlan, limit_name: string): string | null;
|
|
278
|
+
/**
|
|
279
|
+
* Get the type of a limit.
|
|
280
|
+
*
|
|
281
|
+
* @param plan - The subscribed plan to search in.
|
|
282
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
283
|
+
* @returns The limit_type, or null if not found.
|
|
284
|
+
*/
|
|
285
|
+
getLimitType(plan: SubscribedPlan, limit_id: number): string | null;
|
|
286
|
+
/**
|
|
287
|
+
* Get the maximum value (limit_value) of a limit.
|
|
288
|
+
*
|
|
289
|
+
* @param plan - The subscribed plan to search in.
|
|
290
|
+
* @param limit_name - The name of the limit.
|
|
291
|
+
* @returns The limit_value, or null if not found.
|
|
292
|
+
*/
|
|
293
|
+
getLimitMax(plan: SubscribedPlan, limit_name: string): number | null;
|
|
294
|
+
/**
|
|
295
|
+
* Get the maximum value (limit_value) of a limit.
|
|
296
|
+
*
|
|
297
|
+
* @param plan - The subscribed plan to search in.
|
|
298
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
299
|
+
* @returns The limit_value, or null if not found.
|
|
300
|
+
*/
|
|
301
|
+
getLimitMax(plan: SubscribedPlan, limit_id: number): number | null;
|
|
302
|
+
/**
|
|
303
|
+
* Check if a limit allows overage.
|
|
304
|
+
*
|
|
305
|
+
* @param plan - The subscribed plan to search in.
|
|
306
|
+
* @param limit_name - The name of the limit.
|
|
307
|
+
* @returns True if allow_overage is true, false otherwise.
|
|
308
|
+
*/
|
|
309
|
+
limitAllowsOverage(plan: SubscribedPlan, limit_name: string): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Check if a limit allows overage.
|
|
312
|
+
*
|
|
313
|
+
* @param plan - The subscribed plan to search in.
|
|
314
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
315
|
+
* @returns True if allow_overage is true, false otherwise.
|
|
316
|
+
*/
|
|
317
|
+
limitAllowsOverage(plan: SubscribedPlan, limit_id: number): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Get the maximum overage limit. Returns 0 if overage is not allowed.
|
|
320
|
+
*
|
|
321
|
+
* @param plan - The subscribed plan to search in.
|
|
322
|
+
* @param limit_name - The name of the limit.
|
|
323
|
+
* @returns The overage_limit if allow_overage is true, 0 otherwise.
|
|
324
|
+
*/
|
|
325
|
+
limitOverageMax(plan: SubscribedPlan, limit_name: string): number;
|
|
326
|
+
/**
|
|
327
|
+
* Get the maximum overage limit. Returns 0 if overage is not allowed.
|
|
328
|
+
*
|
|
329
|
+
* @param plan - The subscribed plan to search in.
|
|
330
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
331
|
+
* @returns The overage_limit if allow_overage is true, 0 otherwise.
|
|
332
|
+
*/
|
|
333
|
+
limitOverageMax(plan: SubscribedPlan, limit_id: number): number;
|
|
334
|
+
/**
|
|
335
|
+
* Get the units for a limit.
|
|
336
|
+
*
|
|
337
|
+
* @param plan - The subscribed plan to search in.
|
|
338
|
+
* @param limit_name - The name of the limit.
|
|
339
|
+
* @returns The limit_units, or null if not found.
|
|
340
|
+
*/
|
|
341
|
+
getLimitUnits(plan: SubscribedPlan, limit_name: string): string | null;
|
|
342
|
+
/**
|
|
343
|
+
* Get the units for a limit.
|
|
344
|
+
*
|
|
345
|
+
* @param plan - The subscribed plan to search in.
|
|
346
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
347
|
+
* @returns The limit_units, or null if not found.
|
|
348
|
+
*/
|
|
349
|
+
getLimitUnits(plan: SubscribedPlan, limit_id: number): string | null;
|
|
350
|
+
/**
|
|
351
|
+
* Get the plural units for a limit.
|
|
352
|
+
*
|
|
353
|
+
* @param plan - The subscribed plan to search in.
|
|
354
|
+
* @param limit_name - The name of the limit.
|
|
355
|
+
* @returns The limit_units_plural, or null if not found.
|
|
356
|
+
*/
|
|
357
|
+
getLimitUnitsPlural(plan: SubscribedPlan, limit_name: string): string | null;
|
|
358
|
+
/**
|
|
359
|
+
* Get the plural units for a limit.
|
|
360
|
+
*
|
|
361
|
+
* @param plan - The subscribed plan to search in.
|
|
362
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
363
|
+
* @returns The limit_units_plural, or null if not found.
|
|
364
|
+
*/
|
|
365
|
+
getLimitUnitsPlural(plan: SubscribedPlan, limit_id: number): string | null;
|
|
366
|
+
/**
|
|
367
|
+
* Get the period for a limit.
|
|
368
|
+
*
|
|
369
|
+
* @param plan - The subscribed plan to search in.
|
|
370
|
+
* @param limit_name - The name of the limit.
|
|
371
|
+
* @returns The limit_period, or null if not found.
|
|
372
|
+
*/
|
|
373
|
+
getLimitPeriod(plan: SubscribedPlan, limit_name: string): string | null;
|
|
374
|
+
/**
|
|
375
|
+
* Get the period for a limit.
|
|
376
|
+
*
|
|
377
|
+
* @param plan - The subscribed plan to search in.
|
|
378
|
+
* @param limit_id - The internal numeric ID of the limit.
|
|
379
|
+
* @returns The limit_period, or null if not found.
|
|
380
|
+
*/
|
|
381
|
+
getLimitPeriod(plan: SubscribedPlan, limit_id: number): string | null;
|
|
382
|
+
/**
|
|
383
|
+
* Internal: turn a JSON:API document of subscribed plans into hydrated SubscribedPlan[]
|
|
384
|
+
* with features[] and limits[] attached.
|
|
385
|
+
*/
|
|
386
|
+
private hydratePlans;
|
|
387
|
+
/**
|
|
388
|
+
* Internal: hydrate a single plan resource with its features and limits.
|
|
389
|
+
* Features and limits are cached since they never change.
|
|
390
|
+
*/
|
|
391
|
+
private hydrateSinglePlan;
|
|
392
|
+
/**
|
|
393
|
+
* Internal: map a subscribed_feature JSON:API document to SubscribedFeature[].
|
|
394
|
+
*/
|
|
395
|
+
private mapFeatures;
|
|
396
|
+
/**
|
|
397
|
+
* Internal: map a subscribed_limit JSON:API document to SubscribedLimit[].
|
|
398
|
+
*/
|
|
399
|
+
private mapLimits;
|
|
400
|
+
}
|