@fonderie/client 0.17.1 → 0.18.0
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/brain/signatures.md +30 -0
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -42,6 +42,7 @@ declare class HttpClient {
|
|
|
42
42
|
private defaultTtlMs;
|
|
43
43
|
private refresh;
|
|
44
44
|
constructor(baseUrl: string, deps?: IHttpDeps);
|
|
45
|
+
absolute(path: string): string;
|
|
45
46
|
clearCache(): void;
|
|
46
47
|
request<T>(opts: IRequestOptions): Promise<T>;
|
|
47
48
|
private exec;
|
|
@@ -466,6 +467,19 @@ interface ISessionDTO {
|
|
|
466
467
|
interface ISessionsResult {
|
|
467
468
|
sessions: ISessionDTO[];
|
|
468
469
|
}
|
|
470
|
+
interface IMediaAssetDTO {
|
|
471
|
+
id: string;
|
|
472
|
+
url: string;
|
|
473
|
+
contentType: string;
|
|
474
|
+
byteSize: number;
|
|
475
|
+
ownerType: string;
|
|
476
|
+
ownerId: string;
|
|
477
|
+
purpose: string;
|
|
478
|
+
createdAt: string;
|
|
479
|
+
}
|
|
480
|
+
interface IMediaAssetResult {
|
|
481
|
+
asset: IMediaAssetDTO;
|
|
482
|
+
}
|
|
469
483
|
interface IWebhookEndpointDTO {
|
|
470
484
|
id: string;
|
|
471
485
|
url: string;
|
|
@@ -907,6 +921,25 @@ declare class CustomersClient {
|
|
|
907
921
|
removeLabel(labelId: string): Promise<IApiResponse<undefined>>;
|
|
908
922
|
}
|
|
909
923
|
|
|
924
|
+
interface IUploadMediaInput {
|
|
925
|
+
dataBase64: string;
|
|
926
|
+
purpose?: string;
|
|
927
|
+
ownerType?: string;
|
|
928
|
+
ownerId?: string;
|
|
929
|
+
}
|
|
930
|
+
declare class MediaClient {
|
|
931
|
+
private http;
|
|
932
|
+
private tokens;
|
|
933
|
+
constructor(http: HttpClient, tokens: TokenStore);
|
|
934
|
+
setAccessToken(token: string | undefined): void;
|
|
935
|
+
upload(input: IUploadMediaInput): Promise<IApiResponse<IMediaAssetResult>>;
|
|
936
|
+
delete(id: string): Promise<IApiResponse<{
|
|
937
|
+
id: string;
|
|
938
|
+
}>>;
|
|
939
|
+
assetUrl(id: string): string;
|
|
940
|
+
assetIdFromUrl(url: string | null | undefined): string | null;
|
|
941
|
+
}
|
|
942
|
+
|
|
910
943
|
interface ICreateWebhookEndpointInput {
|
|
911
944
|
url: string;
|
|
912
945
|
events?: string[];
|
|
@@ -1048,6 +1081,7 @@ declare class FonderieClient {
|
|
|
1048
1081
|
readonly audit: AuditClient;
|
|
1049
1082
|
readonly webhooks: WebhooksClient;
|
|
1050
1083
|
readonly customers: CustomersClient;
|
|
1084
|
+
readonly media: MediaClient;
|
|
1051
1085
|
private http;
|
|
1052
1086
|
private tokens;
|
|
1053
1087
|
private workspaceId;
|
|
@@ -1144,4 +1178,4 @@ declare class CourierAdminClient {
|
|
|
1144
1178
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1145
1179
|
}
|
|
1146
1180
|
|
|
1147
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1181
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ declare class HttpClient {
|
|
|
42
42
|
private defaultTtlMs;
|
|
43
43
|
private refresh;
|
|
44
44
|
constructor(baseUrl: string, deps?: IHttpDeps);
|
|
45
|
+
absolute(path: string): string;
|
|
45
46
|
clearCache(): void;
|
|
46
47
|
request<T>(opts: IRequestOptions): Promise<T>;
|
|
47
48
|
private exec;
|
|
@@ -466,6 +467,19 @@ interface ISessionDTO {
|
|
|
466
467
|
interface ISessionsResult {
|
|
467
468
|
sessions: ISessionDTO[];
|
|
468
469
|
}
|
|
470
|
+
interface IMediaAssetDTO {
|
|
471
|
+
id: string;
|
|
472
|
+
url: string;
|
|
473
|
+
contentType: string;
|
|
474
|
+
byteSize: number;
|
|
475
|
+
ownerType: string;
|
|
476
|
+
ownerId: string;
|
|
477
|
+
purpose: string;
|
|
478
|
+
createdAt: string;
|
|
479
|
+
}
|
|
480
|
+
interface IMediaAssetResult {
|
|
481
|
+
asset: IMediaAssetDTO;
|
|
482
|
+
}
|
|
469
483
|
interface IWebhookEndpointDTO {
|
|
470
484
|
id: string;
|
|
471
485
|
url: string;
|
|
@@ -907,6 +921,25 @@ declare class CustomersClient {
|
|
|
907
921
|
removeLabel(labelId: string): Promise<IApiResponse<undefined>>;
|
|
908
922
|
}
|
|
909
923
|
|
|
924
|
+
interface IUploadMediaInput {
|
|
925
|
+
dataBase64: string;
|
|
926
|
+
purpose?: string;
|
|
927
|
+
ownerType?: string;
|
|
928
|
+
ownerId?: string;
|
|
929
|
+
}
|
|
930
|
+
declare class MediaClient {
|
|
931
|
+
private http;
|
|
932
|
+
private tokens;
|
|
933
|
+
constructor(http: HttpClient, tokens: TokenStore);
|
|
934
|
+
setAccessToken(token: string | undefined): void;
|
|
935
|
+
upload(input: IUploadMediaInput): Promise<IApiResponse<IMediaAssetResult>>;
|
|
936
|
+
delete(id: string): Promise<IApiResponse<{
|
|
937
|
+
id: string;
|
|
938
|
+
}>>;
|
|
939
|
+
assetUrl(id: string): string;
|
|
940
|
+
assetIdFromUrl(url: string | null | undefined): string | null;
|
|
941
|
+
}
|
|
942
|
+
|
|
910
943
|
interface ICreateWebhookEndpointInput {
|
|
911
944
|
url: string;
|
|
912
945
|
events?: string[];
|
|
@@ -1048,6 +1081,7 @@ declare class FonderieClient {
|
|
|
1048
1081
|
readonly audit: AuditClient;
|
|
1049
1082
|
readonly webhooks: WebhooksClient;
|
|
1050
1083
|
readonly customers: CustomersClient;
|
|
1084
|
+
readonly media: MediaClient;
|
|
1051
1085
|
private http;
|
|
1052
1086
|
private tokens;
|
|
1053
1087
|
private workspaceId;
|
|
@@ -1144,4 +1178,4 @@ declare class CourierAdminClient {
|
|
|
1144
1178
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1145
1179
|
}
|
|
1146
1180
|
|
|
1147
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1181
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,12 @@ var HttpClient = class {
|
|
|
61
61
|
cache;
|
|
62
62
|
defaultTtlMs;
|
|
63
63
|
refresh;
|
|
64
|
+
// Absolute URL for a path on this client's origin — for endpoints a browser
|
|
65
|
+
// navigates to or embeds (e.g. a public `<img src>`) rather than fetches
|
|
66
|
+
// through request(). Mirrors the `${baseUrl}${path}` join request() uses.
|
|
67
|
+
absolute(path) {
|
|
68
|
+
return `${this.baseUrl}${path}`;
|
|
69
|
+
}
|
|
64
70
|
// Drop all cached responses — sign-out must not leave one session's data
|
|
65
71
|
// servable to the next.
|
|
66
72
|
clearCache() {
|
|
@@ -983,6 +989,55 @@ var CustomersClient = class {
|
|
|
983
989
|
}
|
|
984
990
|
};
|
|
985
991
|
|
|
992
|
+
// src/modules/media.ts
|
|
993
|
+
var MediaClient = class {
|
|
994
|
+
constructor(http, tokens) {
|
|
995
|
+
this.http = http;
|
|
996
|
+
this.tokens = tokens;
|
|
997
|
+
}
|
|
998
|
+
http;
|
|
999
|
+
tokens;
|
|
1000
|
+
setAccessToken(token) {
|
|
1001
|
+
this.tokens.set(token);
|
|
1002
|
+
}
|
|
1003
|
+
// POST /media — store an image; returns the asset with its monomorphic
|
|
1004
|
+
// /media/:id url. requireAuth server-side.
|
|
1005
|
+
upload(input) {
|
|
1006
|
+
return this.http.request({
|
|
1007
|
+
method: "POST",
|
|
1008
|
+
path: "/media",
|
|
1009
|
+
body: input,
|
|
1010
|
+
token: this.tokens.get()
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
// DELETE /media/:id — uploader-only (403 for anyone else).
|
|
1014
|
+
delete(id) {
|
|
1015
|
+
return this.http.request({
|
|
1016
|
+
method: "DELETE",
|
|
1017
|
+
path: `/media/${encodeURIComponent(id)}`,
|
|
1018
|
+
token: this.tokens.get()
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
// Absolute URL for a stored asset — an `<img src>` target. The GET /media/:id
|
|
1022
|
+
// route is public and cached (it can't carry a Bearer token), so turn an
|
|
1023
|
+
// upload's `asset.id` into a browser-loadable URL with this, and use it as
|
|
1024
|
+
// the avatarUrl handed to auth's updateProfile.
|
|
1025
|
+
assetUrl(id) {
|
|
1026
|
+
return this.http.absolute(`/media/${encodeURIComponent(id)}`);
|
|
1027
|
+
}
|
|
1028
|
+
// Inverse of assetUrl: pull the asset id out of one of THIS brick's
|
|
1029
|
+
// /media/:id URLs (absolute or relative); null for empty/external URLs. Lets
|
|
1030
|
+
// avatar cleanup delete only assets we minted (matched as a UUID), never a
|
|
1031
|
+
// placeholder or third-party avatar URL.
|
|
1032
|
+
assetIdFromUrl(url) {
|
|
1033
|
+
if (!url) return null;
|
|
1034
|
+
const m = url.match(
|
|
1035
|
+
/\/media\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[/?#]|$)/i
|
|
1036
|
+
);
|
|
1037
|
+
return m ? m[1] : null;
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
|
|
986
1041
|
// src/modules/webhooks.ts
|
|
987
1042
|
var WebhooksClient = class {
|
|
988
1043
|
constructor(http, tokens) {
|
|
@@ -1318,6 +1373,7 @@ var FonderieClient = class {
|
|
|
1318
1373
|
audit;
|
|
1319
1374
|
webhooks;
|
|
1320
1375
|
customers;
|
|
1376
|
+
media;
|
|
1321
1377
|
http;
|
|
1322
1378
|
tokens;
|
|
1323
1379
|
workspaceId;
|
|
@@ -1340,6 +1396,7 @@ var FonderieClient = class {
|
|
|
1340
1396
|
this.audit = new AuditClient(this.http, this.tokens);
|
|
1341
1397
|
this.webhooks = new WebhooksClient(this.http, this.tokens);
|
|
1342
1398
|
this.customers = new CustomersClient(this.http, this.tokens);
|
|
1399
|
+
this.media = new MediaClient(this.http, this.tokens);
|
|
1343
1400
|
if (opts.workspaceId !== void 0) this.setWorkspaceId(opts.workspaceId);
|
|
1344
1401
|
}
|
|
1345
1402
|
// Single-flight refresh: POST /auth/refresh with the app-supplied refresh
|
|
@@ -1627,6 +1684,7 @@ export {
|
|
|
1627
1684
|
CustomersClient,
|
|
1628
1685
|
FonderieApiError,
|
|
1629
1686
|
FonderieClient,
|
|
1687
|
+
MediaClient,
|
|
1630
1688
|
WebhooksClient,
|
|
1631
1689
|
WorkspacesClient,
|
|
1632
1690
|
createMemoryCache,
|