@rezamirzapour/pod-sdk 1.0.4 → 1.0.5
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 +742 -713
- package/dist/index.d.mts +49 -6
- package/dist/index.d.ts +49 -6
- package/dist/index.js +80 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +60 -60
package/dist/index.d.mts
CHANGED
|
@@ -43,18 +43,27 @@ interface SendOtpOptions {
|
|
|
43
43
|
interface PodUrlsConfig {
|
|
44
44
|
accounts?: string;
|
|
45
45
|
apiPod?: string;
|
|
46
|
+
apiPodSandbox?: string;
|
|
46
47
|
cms?: string;
|
|
48
|
+
iums?: string;
|
|
49
|
+
notification?: string;
|
|
50
|
+
podreport?: string;
|
|
47
51
|
podspace?: string;
|
|
48
52
|
podform?: string;
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
sandboxCms?: string;
|
|
54
|
+
sandboxCmsClient?: string;
|
|
55
|
+
sandboxPodspace?: string;
|
|
56
|
+
sandboxStream?: string;
|
|
57
|
+
stream?: string;
|
|
51
58
|
website?: string;
|
|
59
|
+
[key: string]: string | undefined;
|
|
52
60
|
}
|
|
53
61
|
interface PodSdkConfig {
|
|
54
62
|
apiToken?: string;
|
|
55
63
|
clientId?: string;
|
|
56
64
|
clientSecret?: string;
|
|
57
65
|
privateKeyPem?: string;
|
|
66
|
+
sandbox?: boolean;
|
|
58
67
|
urls?: PodUrlsConfig;
|
|
59
68
|
revalidate?: number | string;
|
|
60
69
|
timeout?: number;
|
|
@@ -434,7 +443,7 @@ interface SendSmsResponse {
|
|
|
434
443
|
}
|
|
435
444
|
|
|
436
445
|
interface NotificationServiceOptions {
|
|
437
|
-
baseUrl
|
|
446
|
+
baseUrl?: string;
|
|
438
447
|
apiToken: string;
|
|
439
448
|
}
|
|
440
449
|
declare class NotificationService {
|
|
@@ -1649,12 +1658,13 @@ interface IumsResponse<T = any> {
|
|
|
1649
1658
|
}
|
|
1650
1659
|
|
|
1651
1660
|
interface IumsServiceOptions {
|
|
1652
|
-
baseUrl
|
|
1661
|
+
baseUrl?: string;
|
|
1653
1662
|
clientId: string;
|
|
1654
1663
|
revalidate?: number | string;
|
|
1655
1664
|
}
|
|
1656
1665
|
declare class IumsService {
|
|
1657
1666
|
private http;
|
|
1667
|
+
private baseUrl;
|
|
1658
1668
|
private clientId;
|
|
1659
1669
|
private revalidate;
|
|
1660
1670
|
constructor(options: IumsServiceOptions);
|
|
@@ -1679,7 +1689,8 @@ declare class PodSdk {
|
|
|
1679
1689
|
readonly product: CmsProductService;
|
|
1680
1690
|
readonly tags: CmsTagService;
|
|
1681
1691
|
readonly iums: IumsService;
|
|
1682
|
-
|
|
1692
|
+
readonly urls: Required<PodUrlsConfig>;
|
|
1693
|
+
constructor(config?: PodSdkConfig);
|
|
1683
1694
|
/**
|
|
1684
1695
|
* Helper shortcut to instantiate a Generic CRUD repository for any entity type on POD CustomPost.
|
|
1685
1696
|
*/
|
|
@@ -1690,6 +1701,38 @@ declare class PodSdk {
|
|
|
1690
1701
|
*/
|
|
1691
1702
|
declare function createPodSdk(config: PodSdkConfig): PodSdk;
|
|
1692
1703
|
|
|
1704
|
+
/**
|
|
1705
|
+
* Official POD Platform Production URLs.
|
|
1706
|
+
*/
|
|
1707
|
+
declare const DEFAULT_POD_URLS: Required<PodUrlsConfig>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Official POD Platform Sandbox URLs for development and testing.
|
|
1710
|
+
*/
|
|
1711
|
+
declare const SANDBOX_POD_URLS: Required<PodUrlsConfig>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Resolves full POD URL configuration with the following priority:
|
|
1714
|
+
* 1. Explicit user overrides in `config.urls`
|
|
1715
|
+
* 2. Next.js / Node environment variables (`process.env.NEXT_PUBLIC_*`)
|
|
1716
|
+
* 3. Default production / sandbox URLs
|
|
1717
|
+
*
|
|
1718
|
+
* Supported Environment Variables:
|
|
1719
|
+
* - `NEXT_PUBLIC_ACCOUNTS_URL`
|
|
1720
|
+
* - `NEXT_PUBLIC_API_POD_URL`
|
|
1721
|
+
* - `NEXT_PUBLIC_API_POD_SANDBOX_URL`
|
|
1722
|
+
* - `NEXT_PUBLIC_CMS_URL`
|
|
1723
|
+
* - `NEXT_PUBLIC_IUMS_URL`
|
|
1724
|
+
* - `NEXT_PUBLIC_NOTIFICATION_URL`
|
|
1725
|
+
* - `NEXT_PUBLIC_PODREPORT_URL`
|
|
1726
|
+
* - `NEXT_PUBLIC_PODSPACE_URL`
|
|
1727
|
+
* - `NEXT_PUBLIC_SANDBOX_CMS_URL`
|
|
1728
|
+
* - `NEXT_PUBLIC_SANDBOX_CMS_CLIENT_URL`
|
|
1729
|
+
* - `NEXT_PUBLIC_SANDBOX_PODSPACE_URL`
|
|
1730
|
+
* - `NEXT_PUBLIC_SANDBOX_STREAM_URL`
|
|
1731
|
+
* - `NEXT_PUBLIC_PODFORM_URL`
|
|
1732
|
+
* - `NEXT_PUBLIC_WEBSITE_URL`
|
|
1733
|
+
*/
|
|
1734
|
+
declare function resolvePodUrls(urls?: PodUrlsConfig, sandbox?: boolean): Required<PodUrlsConfig>;
|
|
1735
|
+
|
|
1693
1736
|
/**
|
|
1694
1737
|
* Cryptographic and encoding utilities for POD Platform services.
|
|
1695
1738
|
* Uses standard Web Crypto API (supported natively in Node.js 18+, Browsers, and Edge).
|
|
@@ -1697,4 +1740,4 @@ declare function createPodSdk(config: PodSdkConfig): PodSdk;
|
|
|
1697
1740
|
declare function encodeBase64(str: string): string;
|
|
1698
1741
|
declare function generatePodSignatureHeader(keyId: string, privateKeyPem?: string): Promise<string>;
|
|
1699
1742
|
|
|
1700
|
-
export { type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, type EditContentParams, type EditProductParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceService, type PodspaceServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ResultItem, type ResultItemWithFormatted, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type SocialResponse, SocialService, type SocialServiceOptions, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UserPostInfo, type VerifyResponse, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader };
|
|
1743
|
+
export { type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, DEFAULT_POD_URLS, type EditContentParams, type EditProductParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceService, type PodspaceServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ResultItem, type ResultItemWithFormatted, SANDBOX_POD_URLS, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type SocialResponse, SocialService, type SocialServiceOptions, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UserPostInfo, type VerifyResponse, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
package/dist/index.d.ts
CHANGED
|
@@ -43,18 +43,27 @@ interface SendOtpOptions {
|
|
|
43
43
|
interface PodUrlsConfig {
|
|
44
44
|
accounts?: string;
|
|
45
45
|
apiPod?: string;
|
|
46
|
+
apiPodSandbox?: string;
|
|
46
47
|
cms?: string;
|
|
48
|
+
iums?: string;
|
|
49
|
+
notification?: string;
|
|
50
|
+
podreport?: string;
|
|
47
51
|
podspace?: string;
|
|
48
52
|
podform?: string;
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
sandboxCms?: string;
|
|
54
|
+
sandboxCmsClient?: string;
|
|
55
|
+
sandboxPodspace?: string;
|
|
56
|
+
sandboxStream?: string;
|
|
57
|
+
stream?: string;
|
|
51
58
|
website?: string;
|
|
59
|
+
[key: string]: string | undefined;
|
|
52
60
|
}
|
|
53
61
|
interface PodSdkConfig {
|
|
54
62
|
apiToken?: string;
|
|
55
63
|
clientId?: string;
|
|
56
64
|
clientSecret?: string;
|
|
57
65
|
privateKeyPem?: string;
|
|
66
|
+
sandbox?: boolean;
|
|
58
67
|
urls?: PodUrlsConfig;
|
|
59
68
|
revalidate?: number | string;
|
|
60
69
|
timeout?: number;
|
|
@@ -434,7 +443,7 @@ interface SendSmsResponse {
|
|
|
434
443
|
}
|
|
435
444
|
|
|
436
445
|
interface NotificationServiceOptions {
|
|
437
|
-
baseUrl
|
|
446
|
+
baseUrl?: string;
|
|
438
447
|
apiToken: string;
|
|
439
448
|
}
|
|
440
449
|
declare class NotificationService {
|
|
@@ -1649,12 +1658,13 @@ interface IumsResponse<T = any> {
|
|
|
1649
1658
|
}
|
|
1650
1659
|
|
|
1651
1660
|
interface IumsServiceOptions {
|
|
1652
|
-
baseUrl
|
|
1661
|
+
baseUrl?: string;
|
|
1653
1662
|
clientId: string;
|
|
1654
1663
|
revalidate?: number | string;
|
|
1655
1664
|
}
|
|
1656
1665
|
declare class IumsService {
|
|
1657
1666
|
private http;
|
|
1667
|
+
private baseUrl;
|
|
1658
1668
|
private clientId;
|
|
1659
1669
|
private revalidate;
|
|
1660
1670
|
constructor(options: IumsServiceOptions);
|
|
@@ -1679,7 +1689,8 @@ declare class PodSdk {
|
|
|
1679
1689
|
readonly product: CmsProductService;
|
|
1680
1690
|
readonly tags: CmsTagService;
|
|
1681
1691
|
readonly iums: IumsService;
|
|
1682
|
-
|
|
1692
|
+
readonly urls: Required<PodUrlsConfig>;
|
|
1693
|
+
constructor(config?: PodSdkConfig);
|
|
1683
1694
|
/**
|
|
1684
1695
|
* Helper shortcut to instantiate a Generic CRUD repository for any entity type on POD CustomPost.
|
|
1685
1696
|
*/
|
|
@@ -1690,6 +1701,38 @@ declare class PodSdk {
|
|
|
1690
1701
|
*/
|
|
1691
1702
|
declare function createPodSdk(config: PodSdkConfig): PodSdk;
|
|
1692
1703
|
|
|
1704
|
+
/**
|
|
1705
|
+
* Official POD Platform Production URLs.
|
|
1706
|
+
*/
|
|
1707
|
+
declare const DEFAULT_POD_URLS: Required<PodUrlsConfig>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Official POD Platform Sandbox URLs for development and testing.
|
|
1710
|
+
*/
|
|
1711
|
+
declare const SANDBOX_POD_URLS: Required<PodUrlsConfig>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Resolves full POD URL configuration with the following priority:
|
|
1714
|
+
* 1. Explicit user overrides in `config.urls`
|
|
1715
|
+
* 2. Next.js / Node environment variables (`process.env.NEXT_PUBLIC_*`)
|
|
1716
|
+
* 3. Default production / sandbox URLs
|
|
1717
|
+
*
|
|
1718
|
+
* Supported Environment Variables:
|
|
1719
|
+
* - `NEXT_PUBLIC_ACCOUNTS_URL`
|
|
1720
|
+
* - `NEXT_PUBLIC_API_POD_URL`
|
|
1721
|
+
* - `NEXT_PUBLIC_API_POD_SANDBOX_URL`
|
|
1722
|
+
* - `NEXT_PUBLIC_CMS_URL`
|
|
1723
|
+
* - `NEXT_PUBLIC_IUMS_URL`
|
|
1724
|
+
* - `NEXT_PUBLIC_NOTIFICATION_URL`
|
|
1725
|
+
* - `NEXT_PUBLIC_PODREPORT_URL`
|
|
1726
|
+
* - `NEXT_PUBLIC_PODSPACE_URL`
|
|
1727
|
+
* - `NEXT_PUBLIC_SANDBOX_CMS_URL`
|
|
1728
|
+
* - `NEXT_PUBLIC_SANDBOX_CMS_CLIENT_URL`
|
|
1729
|
+
* - `NEXT_PUBLIC_SANDBOX_PODSPACE_URL`
|
|
1730
|
+
* - `NEXT_PUBLIC_SANDBOX_STREAM_URL`
|
|
1731
|
+
* - `NEXT_PUBLIC_PODFORM_URL`
|
|
1732
|
+
* - `NEXT_PUBLIC_WEBSITE_URL`
|
|
1733
|
+
*/
|
|
1734
|
+
declare function resolvePodUrls(urls?: PodUrlsConfig, sandbox?: boolean): Required<PodUrlsConfig>;
|
|
1735
|
+
|
|
1693
1736
|
/**
|
|
1694
1737
|
* Cryptographic and encoding utilities for POD Platform services.
|
|
1695
1738
|
* Uses standard Web Crypto API (supported natively in Node.js 18+, Browsers, and Edge).
|
|
@@ -1697,4 +1740,4 @@ declare function createPodSdk(config: PodSdkConfig): PodSdk;
|
|
|
1697
1740
|
declare function encodeBase64(str: string): string;
|
|
1698
1741
|
declare function generatePodSignatureHeader(keyId: string, privateKeyPem?: string): Promise<string>;
|
|
1699
1742
|
|
|
1700
|
-
export { type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, type EditContentParams, type EditProductParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceService, type PodspaceServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ResultItem, type ResultItemWithFormatted, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type SocialResponse, SocialService, type SocialServiceOptions, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UserPostInfo, type VerifyResponse, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader };
|
|
1743
|
+
export { type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type AddProductParams, type ArchiveParams, type ArchiveProductParams, type BatchPublishParams, type BatchPublishProductParams, type BatchUnpublishParams, type BatchUnpublishProductParams, type Business, CmsDataFormatter, type CmsMetadata, CmsProductService, type CmsProductServiceOptions, type CmsRequestOptions, CmsService, type CmsServiceOptions, CmsTagService, type CmsTagServiceOptions, type CommentItem, type ContentBody, type CreateTagCategoryParams, type CreateTagTreeItemParams, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, DEFAULT_POD_URLS, type EditContentParams, type EditProductParams, type FormattedGetContentResponse, type FormattedGetProductResponse, type FormattedProductSubject, type FormattedSubject, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetCommentsParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetInfOfGraduatedByGraduateDateResponse, type GetProductByEntityIdParams, type GetProductParams, type GetProductResponse, type GetReactionsParams, type GetSessionClassInCurrentDayResponse, type GetTagCategoriesResponse, type GetTagTreeParams, type GetTagTreeResponse, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceService, type PodspaceServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type ProductBody, type ProductItem, type ProductItemWithFormatted, type Rate, type ResultItem, type ResultItemWithFormatted, SANDBOX_POD_URLS, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type SocialResponse, SocialService, type SocialServiceOptions, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagCategoryItem, type TagCategoryListParams, type TagTreeAncestorsParams, type TagTreeMetadata, type TagtreesType, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UpdateTagCategoryParams, type UpdateTagTreeItemParams, type UserPostInfo, type VerifyResponse, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
package/dist/index.js
CHANGED
|
@@ -597,7 +597,7 @@ var NotificationService = class {
|
|
|
597
597
|
constructor(options) {
|
|
598
598
|
this.apiToken = options.apiToken || "";
|
|
599
599
|
this.http = http.createNextHttp({
|
|
600
|
-
baseUrl: options.baseUrl,
|
|
600
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/notification",
|
|
601
601
|
serviceName: "POD-Notification",
|
|
602
602
|
headers: {
|
|
603
603
|
apiToken: this.apiToken
|
|
@@ -767,7 +767,7 @@ var CmsProductService = class {
|
|
|
767
767
|
this.revalidate = Number(options.revalidate) || 0;
|
|
768
768
|
this.formatter = options.formatter || new CmsDataFormatter(options.podspaceUrl || "https://podspace.pod.ir");
|
|
769
769
|
this.http = options.http || http.createNextHttp({
|
|
770
|
-
baseUrl: options.baseUrl || "https://
|
|
770
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/cms-server",
|
|
771
771
|
serviceName: "POD-CMS-PRODUCT"
|
|
772
772
|
});
|
|
773
773
|
}
|
|
@@ -1190,7 +1190,7 @@ var CmsTagService = class {
|
|
|
1190
1190
|
this.apiToken = options.apiToken || "";
|
|
1191
1191
|
this.revalidate = Number(options.revalidate) || 0;
|
|
1192
1192
|
this.http = options.http || http.createNextHttp({
|
|
1193
|
-
baseUrl: options.baseUrl || "https://
|
|
1193
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/cms-server",
|
|
1194
1194
|
serviceName: "POD-CMS-TAGS"
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
@@ -2166,13 +2166,15 @@ var CmsService = class {
|
|
|
2166
2166
|
};
|
|
2167
2167
|
var IumsService = class {
|
|
2168
2168
|
http;
|
|
2169
|
+
baseUrl;
|
|
2169
2170
|
clientId;
|
|
2170
2171
|
revalidate;
|
|
2171
2172
|
constructor(options) {
|
|
2172
2173
|
this.clientId = options.clientId || "";
|
|
2173
2174
|
this.revalidate = Number(options.revalidate) || 0;
|
|
2175
|
+
this.baseUrl = options.baseUrl || "https://indra.khatam.ac.ir/srv";
|
|
2174
2176
|
this.http = http.createNextHttp({
|
|
2175
|
-
baseUrl:
|
|
2177
|
+
baseUrl: this.baseUrl,
|
|
2176
2178
|
serviceName: "POD-IUMS",
|
|
2177
2179
|
headers: {
|
|
2178
2180
|
"Client-Id": this.clientId
|
|
@@ -2201,7 +2203,8 @@ var IumsService = class {
|
|
|
2201
2203
|
}
|
|
2202
2204
|
async request(serviceMethod, params = [], options) {
|
|
2203
2205
|
const dataPayload = this.generateIumsDataPayload(serviceMethod, params);
|
|
2204
|
-
const
|
|
2206
|
+
const endpoint = this.baseUrl.replace(/\/+$/, "").endsWith("/srv") ? "" : "/srv";
|
|
2207
|
+
const response = await this.http.get(endpoint, {
|
|
2205
2208
|
...options,
|
|
2206
2209
|
params: { data: dataPayload },
|
|
2207
2210
|
next: this.revalidate ? { revalidate: this.revalidate, ...options?.next || {} } : options?.next
|
|
@@ -2233,6 +2236,71 @@ var IumsService = class {
|
|
|
2233
2236
|
}
|
|
2234
2237
|
};
|
|
2235
2238
|
|
|
2239
|
+
// src/constants.ts
|
|
2240
|
+
var DEFAULT_POD_URLS = {
|
|
2241
|
+
accounts: "https://accounts.pod.ir",
|
|
2242
|
+
apiPod: "https://api.pod.ir",
|
|
2243
|
+
apiPodSandbox: "https://api.sandpod.ir",
|
|
2244
|
+
cms: "https://api.pod.ir/srv/cms-server",
|
|
2245
|
+
iums: "https://indra.khatam.ac.ir/srv",
|
|
2246
|
+
notification: "https://api.pod.ir/srv/notification",
|
|
2247
|
+
podreport: "https://reporting.pod.ir",
|
|
2248
|
+
podspace: "https://podspace.pod.ir",
|
|
2249
|
+
podform: "https://podform.pod.ir",
|
|
2250
|
+
sandboxCms: "http://api.sandpod.ir/srv/cms-sandbox",
|
|
2251
|
+
sandboxCmsClient: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2252
|
+
sandboxPodspace: "http://podspace.sandpod.ir",
|
|
2253
|
+
sandboxStream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2254
|
+
stream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2255
|
+
website: ""
|
|
2256
|
+
};
|
|
2257
|
+
var SANDBOX_POD_URLS = {
|
|
2258
|
+
accounts: "https://accounts.pod.ir",
|
|
2259
|
+
apiPod: "https://api.sandpod.ir",
|
|
2260
|
+
apiPodSandbox: "https://api.sandpod.ir",
|
|
2261
|
+
cms: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2262
|
+
iums: "https://indra.khatam.ac.ir/srv",
|
|
2263
|
+
notification: "https://api.pod.ir/srv/notification",
|
|
2264
|
+
podreport: "https://reporting.pod.ir",
|
|
2265
|
+
podspace: "http://podspace.sandpod.ir",
|
|
2266
|
+
podform: "https://podform.pod.ir",
|
|
2267
|
+
sandboxCms: "http://api.sandpod.ir/srv/cms-sandbox",
|
|
2268
|
+
sandboxCmsClient: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2269
|
+
sandboxPodspace: "http://podspace.sandpod.ir",
|
|
2270
|
+
sandboxStream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2271
|
+
stream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2272
|
+
website: ""
|
|
2273
|
+
};
|
|
2274
|
+
function getEnv(key) {
|
|
2275
|
+
if (typeof process !== "undefined" && process?.env && process.env[key]) {
|
|
2276
|
+
const val = process.env[key]?.trim();
|
|
2277
|
+
if (val && val.length > 0) {
|
|
2278
|
+
return val;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
return void 0;
|
|
2282
|
+
}
|
|
2283
|
+
function resolvePodUrls(urls, sandbox = false) {
|
|
2284
|
+
const defaults = sandbox ? SANDBOX_POD_URLS : DEFAULT_POD_URLS;
|
|
2285
|
+
return {
|
|
2286
|
+
accounts: urls?.accounts || getEnv("NEXT_PUBLIC_ACCOUNTS_URL") || defaults.accounts,
|
|
2287
|
+
apiPod: urls?.apiPod || (sandbox ? getEnv("NEXT_PUBLIC_API_POD_SANDBOX_URL") || defaults.apiPod : getEnv("NEXT_PUBLIC_API_POD_URL") || defaults.apiPod),
|
|
2288
|
+
apiPodSandbox: urls?.apiPodSandbox || getEnv("NEXT_PUBLIC_API_POD_SANDBOX_URL") || defaults.apiPodSandbox,
|
|
2289
|
+
cms: urls?.cms || (sandbox ? getEnv("NEXT_PUBLIC_SANDBOX_CMS_CLIENT_URL") || getEnv("NEXT_PUBLIC_SANDBOX_CMS_URL") || defaults.cms : getEnv("NEXT_PUBLIC_CMS_URL") || defaults.cms),
|
|
2290
|
+
iums: urls?.iums || getEnv("NEXT_PUBLIC_IUMS_URL") || defaults.iums,
|
|
2291
|
+
notification: urls?.notification || getEnv("NEXT_PUBLIC_NOTIFICATION_URL") || defaults.notification,
|
|
2292
|
+
podreport: urls?.podreport || getEnv("NEXT_PUBLIC_PODREPORT_URL") || defaults.podreport,
|
|
2293
|
+
podspace: urls?.podspace || (sandbox ? getEnv("NEXT_PUBLIC_SANDBOX_PODSPACE_URL") || defaults.podspace : getEnv("NEXT_PUBLIC_PODSPACE_URL") || defaults.podspace),
|
|
2294
|
+
podform: urls?.podform || getEnv("NEXT_PUBLIC_PODFORM_URL") || defaults.podform,
|
|
2295
|
+
sandboxCms: urls?.sandboxCms || getEnv("NEXT_PUBLIC_SANDBOX_CMS_URL") || defaults.sandboxCms,
|
|
2296
|
+
sandboxCmsClient: urls?.sandboxCmsClient || getEnv("NEXT_PUBLIC_SANDBOX_CMS_CLIENT_URL") || defaults.sandboxCmsClient,
|
|
2297
|
+
sandboxPodspace: urls?.sandboxPodspace || getEnv("NEXT_PUBLIC_SANDBOX_PODSPACE_URL") || defaults.sandboxPodspace,
|
|
2298
|
+
sandboxStream: urls?.sandboxStream || urls?.stream || getEnv("NEXT_PUBLIC_SANDBOX_STREAM_URL") || defaults.sandboxStream,
|
|
2299
|
+
stream: urls?.stream || urls?.sandboxStream || getEnv("NEXT_PUBLIC_SANDBOX_STREAM_URL") || defaults.stream,
|
|
2300
|
+
website: urls?.website || getEnv("NEXT_PUBLIC_WEBSITE_URL") || defaults.website
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2236
2304
|
// src/client.ts
|
|
2237
2305
|
var PodSdk = class {
|
|
2238
2306
|
sso;
|
|
@@ -2245,17 +2313,10 @@ var PodSdk = class {
|
|
|
2245
2313
|
product;
|
|
2246
2314
|
tags;
|
|
2247
2315
|
iums;
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
cms: "https://cms.pod.ir",
|
|
2253
|
-
podspace: "https://podspace.pod.ir",
|
|
2254
|
-
podform: "https://podform.pod.ir",
|
|
2255
|
-
notification: "https://notification.pod.ir",
|
|
2256
|
-
iums: "https://iums.pod.ir",
|
|
2257
|
-
...config.urls
|
|
2258
|
-
};
|
|
2316
|
+
urls;
|
|
2317
|
+
constructor(config = {}) {
|
|
2318
|
+
const urls = resolvePodUrls(config.urls, config.sandbox);
|
|
2319
|
+
this.urls = urls;
|
|
2259
2320
|
const apiToken = config.apiToken || "";
|
|
2260
2321
|
const clientId = config.clientId || "";
|
|
2261
2322
|
const clientSecret = config.clientSecret || "";
|
|
@@ -2326,16 +2387,19 @@ exports.CmsService = CmsService;
|
|
|
2326
2387
|
exports.CmsTagService = CmsTagService;
|
|
2327
2388
|
exports.CustomPostCrudService = CustomPostCrudService;
|
|
2328
2389
|
exports.CustomPostService = CustomPostService;
|
|
2390
|
+
exports.DEFAULT_POD_URLS = DEFAULT_POD_URLS;
|
|
2329
2391
|
exports.IumsService = IumsService;
|
|
2330
2392
|
exports.NotificationService = NotificationService;
|
|
2331
2393
|
exports.PodFormService = PodFormService;
|
|
2332
2394
|
exports.PodSdk = PodSdk;
|
|
2333
2395
|
exports.PodspaceService = PodspaceService;
|
|
2396
|
+
exports.SANDBOX_POD_URLS = SANDBOX_POD_URLS;
|
|
2334
2397
|
exports.SocialService = SocialService;
|
|
2335
2398
|
exports.SsoService = SsoService;
|
|
2336
2399
|
exports.createPodSdk = createPodSdk;
|
|
2337
2400
|
exports.default = client_default;
|
|
2338
2401
|
exports.encodeBase64 = encodeBase64;
|
|
2339
2402
|
exports.generatePodSignatureHeader = generatePodSignatureHeader;
|
|
2403
|
+
exports.resolvePodUrls = resolvePodUrls;
|
|
2340
2404
|
//# sourceMappingURL=index.js.map
|
|
2341
2405
|
//# sourceMappingURL=index.js.map
|