@praxium/sdk 0.4.85 → 0.4.87
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.ts +16 -2
- package/dist/index.js +8 -2
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -674,7 +674,7 @@ type ClientLocale = SupportedLocale | '*';
|
|
|
674
674
|
/**
|
|
675
675
|
* Extract the tenant slug from a profile-scoped API key.
|
|
676
676
|
*
|
|
677
|
-
* Key format:
|
|
677
|
+
* Key format: `${API_KEY_PREFIX}_{tenantSlug}_{profileSlug}_{timestamp}_{signature}`
|
|
678
678
|
* Parts: [0]praxium [1]v1 [2]tenantSlug [3]profileSlug [4]timestamp [5]signature
|
|
679
679
|
*
|
|
680
680
|
* @throws Error if key format is invalid (wrong prefix or insufficient parts)
|
|
@@ -719,6 +719,20 @@ declare function createPraxiumClient(config: PraxiumClientConfig & {
|
|
|
719
719
|
/** Locale-specific mode: returns PublicTeamMember[] with resolved labels/values */
|
|
720
720
|
declare function createPraxiumClient(config: PraxiumClientConfig): PraxiumClient;
|
|
721
721
|
|
|
722
|
+
/** Version-prefixed identifier at the start of every Praxium API key. */
|
|
723
|
+
declare const API_KEY_PREFIX: "praxium_v1";
|
|
724
|
+
/** Separator used between all key segments. */
|
|
725
|
+
declare const API_KEY_SEPARATOR: "_";
|
|
726
|
+
/**
|
|
727
|
+
* Convenience composition: `praxium_v1_` (prefix + separator).
|
|
728
|
+
*
|
|
729
|
+
* Use this when validating that a string starts with the full Praxium API
|
|
730
|
+
* key prefix. Avoids re-composing `${API_KEY_PREFIX}${API_KEY_SEPARATOR}`
|
|
731
|
+
* at every call site. Compile-time `as const` so consumer Zod schemas can
|
|
732
|
+
* pass it to `.startsWith()` without widening to `string`.
|
|
733
|
+
*/
|
|
734
|
+
declare const API_KEY_PREFIX_WITH_SEPARATOR: "praxium_v1_";
|
|
735
|
+
|
|
722
736
|
/**
|
|
723
737
|
* Typed error hierarchy for the Praxium SDK.
|
|
724
738
|
*
|
|
@@ -849,4 +863,4 @@ declare function getCustomField(member: MultilingualTeamMember, identifier: stri
|
|
|
849
863
|
*/
|
|
850
864
|
declare function localizeText(text: MultilingualText | null | undefined, locale: SupportedLocale): string;
|
|
851
865
|
|
|
852
|
-
export { type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ClientLocale, type ContactDetails, type ContactFormResult, type CustomField, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type Location, type MultilingualCustomField, type MultilingualPraxiumClient, type MultilingualTeamMember, type MultilingualText, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, type PraxiumClient, type PraxiumClientConfig, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type SupportedLocale, type TeamMembers, type ValidationDetail, createPraxiumClient, extractTenantSlugFromApiKey, getCustomField, getCustomFieldValue, localizeText };
|
|
866
|
+
export { API_KEY_PREFIX, API_KEY_PREFIX_WITH_SEPARATOR, API_KEY_SEPARATOR, type ApiError, type BilingualText, type BookableService, type BookableServices, type BookableVariantInfo, type BusinessName, type ClientLocale, type ContactDetails, type ContactFormResult, type CustomField, type FaqCategory, type FaqContent, type FaqGroup, type FaqItem, type FeatureItem, type FeatureList, type InsuranceInfo, type InsuranceList, type Location, type MultilingualCustomField, type MultilingualPraxiumClient, type MultilingualTeamMember, type MultilingualText, type OpeningHours, type PaymentMethod, type PaymentMethodList, type PolicyInfo, type PolicyList, PraxiumAuthError, type PraxiumClient, type PraxiumClientConfig, PraxiumError, PraxiumForbiddenError, PraxiumNotFoundError, PraxiumRateLimitError, PraxiumValidationError, type PricingVariant, type PricingVariants, type PublicDaySchedule, type PublicTeamMember, type ServiceCategoryInfo, type SocialLinks, type SupportedLocale, type TeamMembers, type ValidationDetail, createPraxiumClient, extractTenantSlugFromApiKey, getCustomField, getCustomFieldValue, localizeText };
|
package/dist/index.js
CHANGED
|
@@ -928,16 +928,19 @@ var STATUS_ERROR_MAP = {
|
|
|
928
928
|
429: PraxiumRateLimitError
|
|
929
929
|
};
|
|
930
930
|
|
|
931
|
-
// src/
|
|
931
|
+
// src/api-key.constants.ts
|
|
932
932
|
var API_KEY_PREFIX = "praxium_v1";
|
|
933
933
|
var API_KEY_SEPARATOR = "_";
|
|
934
|
+
var API_KEY_PREFIX_WITH_SEPARATOR = `${API_KEY_PREFIX}${API_KEY_SEPARATOR}`;
|
|
935
|
+
|
|
936
|
+
// src/tenant-client.ts
|
|
934
937
|
function extractTenantSlugFromApiKey(apiKey) {
|
|
935
938
|
const parts = apiKey.split(API_KEY_SEPARATOR);
|
|
936
939
|
if (parts.length < 6 || `${parts[0]}${API_KEY_SEPARATOR}${parts[1]}` !== API_KEY_PREFIX) {
|
|
937
940
|
throw new PraxiumError(
|
|
938
941
|
400,
|
|
939
942
|
"INVALID_API_KEY_FORMAT",
|
|
940
|
-
`API key must start with '${API_KEY_PREFIX}' and contain at least 6 segments. Format:
|
|
943
|
+
`API key must start with '${API_KEY_PREFIX}' and contain at least 6 segments. Format: ${API_KEY_PREFIX}${API_KEY_SEPARATOR}{tenantSlug}${API_KEY_SEPARATOR}{profileSlug}${API_KEY_SEPARATOR}{timestamp}${API_KEY_SEPARATOR}{signature}`
|
|
941
944
|
);
|
|
942
945
|
}
|
|
943
946
|
return parts[2];
|
|
@@ -1013,6 +1016,9 @@ function localizeText(text, locale) {
|
|
|
1013
1016
|
return text[locale] || text["en"] || Object.values(text)[0] || "";
|
|
1014
1017
|
}
|
|
1015
1018
|
export {
|
|
1019
|
+
API_KEY_PREFIX,
|
|
1020
|
+
API_KEY_PREFIX_WITH_SEPARATOR,
|
|
1021
|
+
API_KEY_SEPARATOR,
|
|
1016
1022
|
PraxiumAuthError,
|
|
1017
1023
|
PraxiumError,
|
|
1018
1024
|
PraxiumForbiddenError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxium/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.87",
|
|
4
4
|
"description": "Official TypeScript SDK for the Praxium platform API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,14 +19,18 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"generate": "openapi-ts",
|
|
21
21
|
"build": "tsup",
|
|
22
|
+
"lint": "eslint src/ tests/",
|
|
22
23
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
23
24
|
"test": "vitest run",
|
|
24
25
|
"test:watch": "vitest"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
28
|
+
"@eslint/js": "^9.0.0",
|
|
27
29
|
"@hey-api/openapi-ts": "^0.92.4",
|
|
30
|
+
"eslint": "^9.0.0",
|
|
28
31
|
"tsup": "^8.0.0",
|
|
29
32
|
"typescript": "^5.7.0",
|
|
33
|
+
"typescript-eslint": "^8.0.0",
|
|
30
34
|
"vitest": "^4.0.18"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|