perspectapi-ts-sdk 6.0.1 → 6.0.2
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.mts +1 -16
- package/dist/index.d.ts +1 -16
- package/dist/index.js +1 -38
- package/dist/index.mjs +1 -37
- package/package.json +1 -1
- package/src/cache/cache-manager.ts +2 -9
- package/src/index.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4110,21 +4110,6 @@ declare class CloudflareKVCacheAdapter implements CacheAdapter {
|
|
|
4110
4110
|
clear(): Promise<void>;
|
|
4111
4111
|
}
|
|
4112
4112
|
|
|
4113
|
-
/**
|
|
4114
|
-
* Simple in-memory cache adapter primarily suited for development and testing.
|
|
4115
|
-
*/
|
|
4116
|
-
|
|
4117
|
-
declare class InMemoryCacheAdapter implements CacheAdapter {
|
|
4118
|
-
private store;
|
|
4119
|
-
get(key: string): Promise<string | undefined>;
|
|
4120
|
-
set(key: string, value: string, options?: {
|
|
4121
|
-
ttlSeconds?: number;
|
|
4122
|
-
}): Promise<void>;
|
|
4123
|
-
delete(key: string): Promise<void>;
|
|
4124
|
-
deleteMany(keys: string[]): Promise<void>;
|
|
4125
|
-
clear(): Promise<void>;
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
4113
|
/**
|
|
4129
4114
|
* No-op cache adapter that disables caching while preserving the cache contract.
|
|
4130
4115
|
*/
|
|
@@ -4430,4 +4415,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4430
4415
|
error: string;
|
|
4431
4416
|
}>;
|
|
4432
4417
|
|
|
4433
|
-
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, CloudflareKVCacheAdapter, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions,
|
|
4418
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, CloudflareKVCacheAdapter, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type V2ApiKey, type V2CancelSubscriptionResult, type V2Category, type V2CategoryCreateParams, type V2CategoryUpdateParams, type V2Collection, type V2CollectionCreateParams, type V2CollectionItem, type V2CollectionUpdateParams, type V2ContactSubmission, type V2Content, type V2ContentCreateParams, type V2ContentListParams, type V2ContentUpdateParams, type V2CreditBalance, type V2CreditTransaction, type V2Deleted, type V2Error, type V2ErrorType, type V2GrantCreditParams, type V2GrantCreditResult, type V2List, type V2Media, type V2NewsletterCampaign, type V2NewsletterImportRequest, type V2NewsletterImportResult, type V2NewsletterList, type V2NewsletterListCreateParams, type V2NewsletterListUpdateParams, type V2NewsletterSubscription, type V2NewsletterSubscriptionListMembershipUpdate, type V2NewsletterSyncInput, type V2NewsletterSyncResult, type V2NewsletterTrackingResponse, type V2Object, type V2Order, type V2OrderAddress, type V2OrderCreateParams, type V2OrderCreateResult, type V2OrderFulfillmentUpdate, type V2OrderLineItem, type V2OrderLineItemPriceData, type V2OrderListParams, type V2OrderTaxRequest, type V2Organization, type V2PaginationParams, type V2Product, type V2ProductCreateParams, type V2ProductListParams, type V2ProductUpdateParams, type V2Site, type V2SiteUser, type V2SiteUserListParams, type V2SiteUserMeUpdateParams, type V2SiteUserProfile, type V2SiteUserSubscription, type V2SiteUserUpdateParams, type V2SiteUserWithProfile, type V2SubscriptionCancelParams, type V2SubscriptionChangePlanParams, type V2SubscriptionPauseParams, type V2Webhook, type V2WebhookCreateParams, type V2WebhookUpdateParams, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
package/dist/index.d.ts
CHANGED
|
@@ -4110,21 +4110,6 @@ declare class CloudflareKVCacheAdapter implements CacheAdapter {
|
|
|
4110
4110
|
clear(): Promise<void>;
|
|
4111
4111
|
}
|
|
4112
4112
|
|
|
4113
|
-
/**
|
|
4114
|
-
* Simple in-memory cache adapter primarily suited for development and testing.
|
|
4115
|
-
*/
|
|
4116
|
-
|
|
4117
|
-
declare class InMemoryCacheAdapter implements CacheAdapter {
|
|
4118
|
-
private store;
|
|
4119
|
-
get(key: string): Promise<string | undefined>;
|
|
4120
|
-
set(key: string, value: string, options?: {
|
|
4121
|
-
ttlSeconds?: number;
|
|
4122
|
-
}): Promise<void>;
|
|
4123
|
-
delete(key: string): Promise<void>;
|
|
4124
|
-
deleteMany(keys: string[]): Promise<void>;
|
|
4125
|
-
clear(): Promise<void>;
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
4113
|
/**
|
|
4129
4114
|
* No-op cache adapter that disables caching while preserving the cache contract.
|
|
4130
4115
|
*/
|
|
@@ -4430,4 +4415,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4430
4415
|
error: string;
|
|
4431
4416
|
}>;
|
|
4432
4417
|
|
|
4433
|
-
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, CloudflareKVCacheAdapter, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions,
|
|
4418
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, CloudflareKVCacheAdapter, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type V2ApiKey, type V2CancelSubscriptionResult, type V2Category, type V2CategoryCreateParams, type V2CategoryUpdateParams, type V2Collection, type V2CollectionCreateParams, type V2CollectionItem, type V2CollectionUpdateParams, type V2ContactSubmission, type V2Content, type V2ContentCreateParams, type V2ContentListParams, type V2ContentUpdateParams, type V2CreditBalance, type V2CreditTransaction, type V2Deleted, type V2Error, type V2ErrorType, type V2GrantCreditParams, type V2GrantCreditResult, type V2List, type V2Media, type V2NewsletterCampaign, type V2NewsletterImportRequest, type V2NewsletterImportResult, type V2NewsletterList, type V2NewsletterListCreateParams, type V2NewsletterListUpdateParams, type V2NewsletterSubscription, type V2NewsletterSubscriptionListMembershipUpdate, type V2NewsletterSyncInput, type V2NewsletterSyncResult, type V2NewsletterTrackingResponse, type V2Object, type V2Order, type V2OrderAddress, type V2OrderCreateParams, type V2OrderCreateResult, type V2OrderFulfillmentUpdate, type V2OrderLineItem, type V2OrderLineItemPriceData, type V2OrderListParams, type V2OrderTaxRequest, type V2Organization, type V2PaginationParams, type V2Product, type V2ProductCreateParams, type V2ProductListParams, type V2ProductUpdateParams, type V2Site, type V2SiteUser, type V2SiteUserListParams, type V2SiteUserMeUpdateParams, type V2SiteUserProfile, type V2SiteUserSubscription, type V2SiteUserUpdateParams, type V2SiteUserWithProfile, type V2SubscriptionCancelParams, type V2SubscriptionChangePlanParams, type V2SubscriptionPauseParams, type V2Webhook, type V2WebhookCreateParams, type V2WebhookUpdateParams, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,6 @@ __export(index_exports, {
|
|
|
32
32
|
ContentClient: () => ContentClient,
|
|
33
33
|
DEFAULT_IMAGE_SIZES: () => DEFAULT_IMAGE_SIZES,
|
|
34
34
|
HttpClient: () => HttpClient,
|
|
35
|
-
InMemoryCacheAdapter: () => InMemoryCacheAdapter,
|
|
36
35
|
NewsletterClient: () => NewsletterClient,
|
|
37
36
|
NewsletterManagementClient: () => NewsletterManagementClient,
|
|
38
37
|
NoopCacheAdapter: () => NoopCacheAdapter,
|
|
@@ -310,35 +309,6 @@ function createApiError(error) {
|
|
|
310
309
|
};
|
|
311
310
|
}
|
|
312
311
|
|
|
313
|
-
// src/cache/in-memory-adapter.ts
|
|
314
|
-
var InMemoryCacheAdapter = class {
|
|
315
|
-
store = /* @__PURE__ */ new Map();
|
|
316
|
-
async get(key) {
|
|
317
|
-
const entry = this.store.get(key);
|
|
318
|
-
if (!entry) {
|
|
319
|
-
return void 0;
|
|
320
|
-
}
|
|
321
|
-
if (entry.expiresAt && entry.expiresAt <= Date.now()) {
|
|
322
|
-
this.store.delete(key);
|
|
323
|
-
return void 0;
|
|
324
|
-
}
|
|
325
|
-
return entry.value;
|
|
326
|
-
}
|
|
327
|
-
async set(key, value, options) {
|
|
328
|
-
const expiresAt = options?.ttlSeconds && options.ttlSeconds > 0 ? Date.now() + options.ttlSeconds * 1e3 : void 0;
|
|
329
|
-
this.store.set(key, { value, expiresAt });
|
|
330
|
-
}
|
|
331
|
-
async delete(key) {
|
|
332
|
-
this.store.delete(key);
|
|
333
|
-
}
|
|
334
|
-
async deleteMany(keys) {
|
|
335
|
-
keys.forEach((key) => this.store.delete(key));
|
|
336
|
-
}
|
|
337
|
-
async clear() {
|
|
338
|
-
this.store.clear();
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
312
|
// src/cache/noop-adapter.ts
|
|
343
313
|
var NoopCacheAdapter = class {
|
|
344
314
|
async get() {
|
|
@@ -370,15 +340,9 @@ var CacheManager = class {
|
|
|
370
340
|
...defaultOptions,
|
|
371
341
|
...config
|
|
372
342
|
};
|
|
373
|
-
if (config && config.enabled
|
|
374
|
-
this.enabled = false;
|
|
375
|
-
this.adapter = new NoopCacheAdapter();
|
|
376
|
-
} else if (config && config.adapter) {
|
|
343
|
+
if (config && config.enabled !== false && config.adapter) {
|
|
377
344
|
this.enabled = true;
|
|
378
345
|
this.adapter = config.adapter;
|
|
379
|
-
} else if (config) {
|
|
380
|
-
this.enabled = true;
|
|
381
|
-
this.adapter = new InMemoryCacheAdapter();
|
|
382
346
|
} else {
|
|
383
347
|
this.enabled = false;
|
|
384
348
|
this.adapter = new NoopCacheAdapter();
|
|
@@ -4781,7 +4745,6 @@ async function createCheckoutSession(options) {
|
|
|
4781
4745
|
ContentClient,
|
|
4782
4746
|
DEFAULT_IMAGE_SIZES,
|
|
4783
4747
|
HttpClient,
|
|
4784
|
-
InMemoryCacheAdapter,
|
|
4785
4748
|
NewsletterClient,
|
|
4786
4749
|
NewsletterManagementClient,
|
|
4787
4750
|
NoopCacheAdapter,
|
package/dist/index.mjs
CHANGED
|
@@ -242,35 +242,6 @@ function createApiError(error) {
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
// src/cache/in-memory-adapter.ts
|
|
246
|
-
var InMemoryCacheAdapter = class {
|
|
247
|
-
store = /* @__PURE__ */ new Map();
|
|
248
|
-
async get(key) {
|
|
249
|
-
const entry = this.store.get(key);
|
|
250
|
-
if (!entry) {
|
|
251
|
-
return void 0;
|
|
252
|
-
}
|
|
253
|
-
if (entry.expiresAt && entry.expiresAt <= Date.now()) {
|
|
254
|
-
this.store.delete(key);
|
|
255
|
-
return void 0;
|
|
256
|
-
}
|
|
257
|
-
return entry.value;
|
|
258
|
-
}
|
|
259
|
-
async set(key, value, options) {
|
|
260
|
-
const expiresAt = options?.ttlSeconds && options.ttlSeconds > 0 ? Date.now() + options.ttlSeconds * 1e3 : void 0;
|
|
261
|
-
this.store.set(key, { value, expiresAt });
|
|
262
|
-
}
|
|
263
|
-
async delete(key) {
|
|
264
|
-
this.store.delete(key);
|
|
265
|
-
}
|
|
266
|
-
async deleteMany(keys) {
|
|
267
|
-
keys.forEach((key) => this.store.delete(key));
|
|
268
|
-
}
|
|
269
|
-
async clear() {
|
|
270
|
-
this.store.clear();
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
245
|
// src/cache/noop-adapter.ts
|
|
275
246
|
var NoopCacheAdapter = class {
|
|
276
247
|
async get() {
|
|
@@ -302,15 +273,9 @@ var CacheManager = class {
|
|
|
302
273
|
...defaultOptions,
|
|
303
274
|
...config
|
|
304
275
|
};
|
|
305
|
-
if (config && config.enabled
|
|
306
|
-
this.enabled = false;
|
|
307
|
-
this.adapter = new NoopCacheAdapter();
|
|
308
|
-
} else if (config && config.adapter) {
|
|
276
|
+
if (config && config.enabled !== false && config.adapter) {
|
|
309
277
|
this.enabled = true;
|
|
310
278
|
this.adapter = config.adapter;
|
|
311
|
-
} else if (config) {
|
|
312
|
-
this.enabled = true;
|
|
313
|
-
this.adapter = new InMemoryCacheAdapter();
|
|
314
279
|
} else {
|
|
315
280
|
this.enabled = false;
|
|
316
281
|
this.adapter = new NoopCacheAdapter();
|
|
@@ -4712,7 +4677,6 @@ export {
|
|
|
4712
4677
|
ContentClient,
|
|
4713
4678
|
DEFAULT_IMAGE_SIZES,
|
|
4714
4679
|
HttpClient,
|
|
4715
|
-
InMemoryCacheAdapter,
|
|
4716
4680
|
NewsletterClient,
|
|
4717
4681
|
NewsletterManagementClient,
|
|
4718
4682
|
NoopCacheAdapter,
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* CacheManager orchestrates cache get/set/invalidate behaviour using a pluggable adapter.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { InMemoryCacheAdapter } from './in-memory-adapter';
|
|
6
5
|
import { NoopCacheAdapter } from './noop-adapter';
|
|
7
6
|
import type {
|
|
8
7
|
CacheAdapter,
|
|
@@ -34,17 +33,11 @@ export class CacheManager {
|
|
|
34
33
|
...config,
|
|
35
34
|
};
|
|
36
35
|
|
|
37
|
-
if (config && config.enabled
|
|
38
|
-
this.enabled = false;
|
|
39
|
-
this.adapter = new NoopCacheAdapter();
|
|
40
|
-
} else if (config && config.adapter) {
|
|
36
|
+
if (config && config.enabled !== false && config.adapter) {
|
|
41
37
|
this.enabled = true;
|
|
42
38
|
this.adapter = config.adapter;
|
|
43
|
-
} else if (config) {
|
|
44
|
-
// Cache config supplied but no adapter; fall back to in-memory caching.
|
|
45
|
-
this.enabled = true;
|
|
46
|
-
this.adapter = new InMemoryCacheAdapter();
|
|
47
39
|
} else {
|
|
40
|
+
// No adapter provided — caching is disabled.
|
|
48
41
|
this.enabled = false;
|
|
49
42
|
this.adapter = new NoopCacheAdapter();
|
|
50
43
|
}
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { HttpClient, createApiError } from './utils/http-client';
|
|
|
37
37
|
// Cache utilities
|
|
38
38
|
export { CacheManager } from './cache/cache-manager';
|
|
39
39
|
export { CloudflareKVCacheAdapter } from './cache/cloudflare-kv-adapter';
|
|
40
|
-
|
|
40
|
+
// InMemoryCacheAdapter removed — useless in Cloudflare Workers (per-request memory, no persistence)
|
|
41
41
|
export { NoopCacheAdapter } from './cache/noop-adapter';
|
|
42
42
|
|
|
43
43
|
// Image transformation utilities
|