@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.mjs
CHANGED
|
@@ -593,7 +593,7 @@ var NotificationService = class {
|
|
|
593
593
|
constructor(options) {
|
|
594
594
|
this.apiToken = options.apiToken || "";
|
|
595
595
|
this.http = createNextHttp({
|
|
596
|
-
baseUrl: options.baseUrl,
|
|
596
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/notification",
|
|
597
597
|
serviceName: "POD-Notification",
|
|
598
598
|
headers: {
|
|
599
599
|
apiToken: this.apiToken
|
|
@@ -763,7 +763,7 @@ var CmsProductService = class {
|
|
|
763
763
|
this.revalidate = Number(options.revalidate) || 0;
|
|
764
764
|
this.formatter = options.formatter || new CmsDataFormatter(options.podspaceUrl || "https://podspace.pod.ir");
|
|
765
765
|
this.http = options.http || createNextHttp({
|
|
766
|
-
baseUrl: options.baseUrl || "https://
|
|
766
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/cms-server",
|
|
767
767
|
serviceName: "POD-CMS-PRODUCT"
|
|
768
768
|
});
|
|
769
769
|
}
|
|
@@ -1186,7 +1186,7 @@ var CmsTagService = class {
|
|
|
1186
1186
|
this.apiToken = options.apiToken || "";
|
|
1187
1187
|
this.revalidate = Number(options.revalidate) || 0;
|
|
1188
1188
|
this.http = options.http || createNextHttp({
|
|
1189
|
-
baseUrl: options.baseUrl || "https://
|
|
1189
|
+
baseUrl: options.baseUrl || "https://api.pod.ir/srv/cms-server",
|
|
1190
1190
|
serviceName: "POD-CMS-TAGS"
|
|
1191
1191
|
});
|
|
1192
1192
|
}
|
|
@@ -2162,13 +2162,15 @@ var CmsService = class {
|
|
|
2162
2162
|
};
|
|
2163
2163
|
var IumsService = class {
|
|
2164
2164
|
http;
|
|
2165
|
+
baseUrl;
|
|
2165
2166
|
clientId;
|
|
2166
2167
|
revalidate;
|
|
2167
2168
|
constructor(options) {
|
|
2168
2169
|
this.clientId = options.clientId || "";
|
|
2169
2170
|
this.revalidate = Number(options.revalidate) || 0;
|
|
2171
|
+
this.baseUrl = options.baseUrl || "https://indra.khatam.ac.ir/srv";
|
|
2170
2172
|
this.http = createNextHttp({
|
|
2171
|
-
baseUrl:
|
|
2173
|
+
baseUrl: this.baseUrl,
|
|
2172
2174
|
serviceName: "POD-IUMS",
|
|
2173
2175
|
headers: {
|
|
2174
2176
|
"Client-Id": this.clientId
|
|
@@ -2197,7 +2199,8 @@ var IumsService = class {
|
|
|
2197
2199
|
}
|
|
2198
2200
|
async request(serviceMethod, params = [], options) {
|
|
2199
2201
|
const dataPayload = this.generateIumsDataPayload(serviceMethod, params);
|
|
2200
|
-
const
|
|
2202
|
+
const endpoint = this.baseUrl.replace(/\/+$/, "").endsWith("/srv") ? "" : "/srv";
|
|
2203
|
+
const response = await this.http.get(endpoint, {
|
|
2201
2204
|
...options,
|
|
2202
2205
|
params: { data: dataPayload },
|
|
2203
2206
|
next: this.revalidate ? { revalidate: this.revalidate, ...options?.next || {} } : options?.next
|
|
@@ -2229,6 +2232,71 @@ var IumsService = class {
|
|
|
2229
2232
|
}
|
|
2230
2233
|
};
|
|
2231
2234
|
|
|
2235
|
+
// src/constants.ts
|
|
2236
|
+
var DEFAULT_POD_URLS = {
|
|
2237
|
+
accounts: "https://accounts.pod.ir",
|
|
2238
|
+
apiPod: "https://api.pod.ir",
|
|
2239
|
+
apiPodSandbox: "https://api.sandpod.ir",
|
|
2240
|
+
cms: "https://api.pod.ir/srv/cms-server",
|
|
2241
|
+
iums: "https://indra.khatam.ac.ir/srv",
|
|
2242
|
+
notification: "https://api.pod.ir/srv/notification",
|
|
2243
|
+
podreport: "https://reporting.pod.ir",
|
|
2244
|
+
podspace: "https://podspace.pod.ir",
|
|
2245
|
+
podform: "https://podform.pod.ir",
|
|
2246
|
+
sandboxCms: "http://api.sandpod.ir/srv/cms-sandbox",
|
|
2247
|
+
sandboxCmsClient: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2248
|
+
sandboxPodspace: "http://podspace.sandpod.ir",
|
|
2249
|
+
sandboxStream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2250
|
+
stream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2251
|
+
website: ""
|
|
2252
|
+
};
|
|
2253
|
+
var SANDBOX_POD_URLS = {
|
|
2254
|
+
accounts: "https://accounts.pod.ir",
|
|
2255
|
+
apiPod: "https://api.sandpod.ir",
|
|
2256
|
+
apiPodSandbox: "https://api.sandpod.ir",
|
|
2257
|
+
cms: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2258
|
+
iums: "https://indra.khatam.ac.ir/srv",
|
|
2259
|
+
notification: "https://api.pod.ir/srv/notification",
|
|
2260
|
+
podreport: "https://reporting.pod.ir",
|
|
2261
|
+
podspace: "http://podspace.sandpod.ir",
|
|
2262
|
+
podform: "https://podform.pod.ir",
|
|
2263
|
+
sandboxCms: "http://api.sandpod.ir/srv/cms-sandbox",
|
|
2264
|
+
sandboxCmsClient: "https://api.sandpod.ir/srv/cms-sandbox",
|
|
2265
|
+
sandboxPodspace: "http://podspace.sandpod.ir",
|
|
2266
|
+
sandboxStream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2267
|
+
stream: "https://sandbox-offline-stream.sandpod.ir",
|
|
2268
|
+
website: ""
|
|
2269
|
+
};
|
|
2270
|
+
function getEnv(key) {
|
|
2271
|
+
if (typeof process !== "undefined" && process?.env && process.env[key]) {
|
|
2272
|
+
const val = process.env[key]?.trim();
|
|
2273
|
+
if (val && val.length > 0) {
|
|
2274
|
+
return val;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
return void 0;
|
|
2278
|
+
}
|
|
2279
|
+
function resolvePodUrls(urls, sandbox = false) {
|
|
2280
|
+
const defaults = sandbox ? SANDBOX_POD_URLS : DEFAULT_POD_URLS;
|
|
2281
|
+
return {
|
|
2282
|
+
accounts: urls?.accounts || getEnv("NEXT_PUBLIC_ACCOUNTS_URL") || defaults.accounts,
|
|
2283
|
+
apiPod: urls?.apiPod || (sandbox ? getEnv("NEXT_PUBLIC_API_POD_SANDBOX_URL") || defaults.apiPod : getEnv("NEXT_PUBLIC_API_POD_URL") || defaults.apiPod),
|
|
2284
|
+
apiPodSandbox: urls?.apiPodSandbox || getEnv("NEXT_PUBLIC_API_POD_SANDBOX_URL") || defaults.apiPodSandbox,
|
|
2285
|
+
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),
|
|
2286
|
+
iums: urls?.iums || getEnv("NEXT_PUBLIC_IUMS_URL") || defaults.iums,
|
|
2287
|
+
notification: urls?.notification || getEnv("NEXT_PUBLIC_NOTIFICATION_URL") || defaults.notification,
|
|
2288
|
+
podreport: urls?.podreport || getEnv("NEXT_PUBLIC_PODREPORT_URL") || defaults.podreport,
|
|
2289
|
+
podspace: urls?.podspace || (sandbox ? getEnv("NEXT_PUBLIC_SANDBOX_PODSPACE_URL") || defaults.podspace : getEnv("NEXT_PUBLIC_PODSPACE_URL") || defaults.podspace),
|
|
2290
|
+
podform: urls?.podform || getEnv("NEXT_PUBLIC_PODFORM_URL") || defaults.podform,
|
|
2291
|
+
sandboxCms: urls?.sandboxCms || getEnv("NEXT_PUBLIC_SANDBOX_CMS_URL") || defaults.sandboxCms,
|
|
2292
|
+
sandboxCmsClient: urls?.sandboxCmsClient || getEnv("NEXT_PUBLIC_SANDBOX_CMS_CLIENT_URL") || defaults.sandboxCmsClient,
|
|
2293
|
+
sandboxPodspace: urls?.sandboxPodspace || getEnv("NEXT_PUBLIC_SANDBOX_PODSPACE_URL") || defaults.sandboxPodspace,
|
|
2294
|
+
sandboxStream: urls?.sandboxStream || urls?.stream || getEnv("NEXT_PUBLIC_SANDBOX_STREAM_URL") || defaults.sandboxStream,
|
|
2295
|
+
stream: urls?.stream || urls?.sandboxStream || getEnv("NEXT_PUBLIC_SANDBOX_STREAM_URL") || defaults.stream,
|
|
2296
|
+
website: urls?.website || getEnv("NEXT_PUBLIC_WEBSITE_URL") || defaults.website
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2232
2300
|
// src/client.ts
|
|
2233
2301
|
var PodSdk = class {
|
|
2234
2302
|
sso;
|
|
@@ -2241,17 +2309,10 @@ var PodSdk = class {
|
|
|
2241
2309
|
product;
|
|
2242
2310
|
tags;
|
|
2243
2311
|
iums;
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
cms: "https://cms.pod.ir",
|
|
2249
|
-
podspace: "https://podspace.pod.ir",
|
|
2250
|
-
podform: "https://podform.pod.ir",
|
|
2251
|
-
notification: "https://notification.pod.ir",
|
|
2252
|
-
iums: "https://iums.pod.ir",
|
|
2253
|
-
...config.urls
|
|
2254
|
-
};
|
|
2312
|
+
urls;
|
|
2313
|
+
constructor(config = {}) {
|
|
2314
|
+
const urls = resolvePodUrls(config.urls, config.sandbox);
|
|
2315
|
+
this.urls = urls;
|
|
2255
2316
|
const apiToken = config.apiToken || "";
|
|
2256
2317
|
const clientId = config.clientId || "";
|
|
2257
2318
|
const clientSecret = config.clientSecret || "";
|
|
@@ -2316,6 +2377,6 @@ function createPodSdk(config) {
|
|
|
2316
2377
|
}
|
|
2317
2378
|
var client_default = PodSdk;
|
|
2318
2379
|
|
|
2319
|
-
export { CmsDataFormatter, CmsProductService, CmsService, CmsTagService, CustomPostCrudService, CustomPostService, IumsService, NotificationService, PodFormService, PodSdk, PodspaceService, SocialService, SsoService, createPodSdk, client_default as default, encodeBase64, generatePodSignatureHeader };
|
|
2380
|
+
export { CmsDataFormatter, CmsProductService, CmsService, CmsTagService, CustomPostCrudService, CustomPostService, DEFAULT_POD_URLS, IumsService, NotificationService, PodFormService, PodSdk, PodspaceService, SANDBOX_POD_URLS, SocialService, SsoService, createPodSdk, client_default as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
|
2320
2381
|
//# sourceMappingURL=index.mjs.map
|
|
2321
2382
|
//# sourceMappingURL=index.mjs.map
|