@01.software/sdk 0.4.3-dev.260324.6dc30aa → 0.5.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/dist/index.d.cts CHANGED
@@ -19,11 +19,11 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
19
19
  * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
20
20
  */
21
21
  declare function resolveApiUrl(): string;
22
- interface ClientBrowserConfig {
22
+ interface ClientConfig {
23
23
  clientKey: string;
24
24
  /**
25
25
  * Customer authentication options.
26
- * Used to initialize CustomerAuth on BrowserClient.
26
+ * Used to initialize CustomerAuth on Client.
27
27
  */
28
28
  customer?: {
29
29
  /**
@@ -42,7 +42,7 @@ interface ClientBrowserConfig {
42
42
  onTokenChange?: (token: string | null) => void;
43
43
  };
44
44
  }
45
- interface ClientServerConfig extends ClientBrowserConfig {
45
+ interface ClientServerConfig extends ClientConfig {
46
46
  secretKey: string;
47
47
  }
48
48
  interface ClientMetadata {
@@ -451,7 +451,7 @@ declare class CollectionClient extends HttpClient {
451
451
 
452
452
  /**
453
453
  * Read-only subset of CollectionQueryBuilder.
454
- * BrowserClient.from() returns this type to prevent write operations at compile time.
454
+ * Client.from() returns this type to prevent write operations at compile time.
455
455
  */
456
456
  type ReadOnlyQueryBuilder<T extends PublicCollection> = Pick<CollectionQueryBuilder<T>, 'find' | 'findById' | 'count' | 'findMetadata' | 'findMetadataById'>;
457
457
  declare class CollectionQueryBuilder<T extends PublicCollection> {
@@ -585,7 +585,7 @@ interface CustomerAuthOptions {
585
585
  }
586
586
 
587
587
  /**
588
- * Customer authentication client for BrowserClient.
588
+ * Customer authentication client.
589
589
  *
590
590
  * Manages customer registration, login, logout, and token lifecycle.
591
591
  * All requests include X-Client-Key for tenant resolution.
@@ -894,21 +894,26 @@ declare class QueryHooks extends CollectionHooks {
894
894
  setCustomerData: CustomerHooks['setCustomerData'];
895
895
  }
896
896
 
897
- declare class BrowserClient {
897
+ declare class Client {
898
898
  cart: CartApi;
899
899
  query: ReadOnlyQueryHooks;
900
900
  collections: CollectionClient;
901
901
  queryClient: QueryClient;
902
902
  customer: CustomerAuth;
903
903
  protected state: ClientState;
904
- protected config: ClientBrowserConfig;
904
+ protected config: ClientConfig;
905
905
  protected baseUrl: string;
906
- constructor(options: ClientBrowserConfig);
906
+ constructor(options: ClientConfig);
907
907
  from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
908
908
  getState(): ClientState;
909
- getConfig(): ClientBrowserConfig;
909
+ getConfig(): ClientConfig;
910
910
  }
911
- declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
911
+ /**
912
+ * Create an SDK client. Works in both browser and server environments.
913
+ * Read-only collection queries + customer auth (cart, login, profile).
914
+ * Use `createServerClient()` when you need full CRUD with secretKey.
915
+ */
916
+ declare function createClient(options: ClientConfig): Client;
912
917
 
913
918
  declare class ServerClient {
914
919
  api: OrderApi;
@@ -923,8 +928,12 @@ declare class ServerClient {
923
928
  constructor(options: ClientServerConfig);
924
929
  from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
925
930
  getState(): ClientState;
926
- getConfig(): ClientBrowserConfig;
931
+ getConfig(): ClientConfig;
927
932
  }
933
+ /**
934
+ * Create a server-only client with full read/write access. Requires secretKey.
935
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
936
+ */
928
937
  declare function createServerClient(options: ClientServerConfig): ServerClient;
929
938
 
930
939
  declare function getQueryClient(): QueryClient;
@@ -947,4 +956,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
947
956
  */
948
957
  declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
949
958
 
950
- export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
959
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.d.ts CHANGED
@@ -19,11 +19,11 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
19
19
  * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
20
20
  */
21
21
  declare function resolveApiUrl(): string;
22
- interface ClientBrowserConfig {
22
+ interface ClientConfig {
23
23
  clientKey: string;
24
24
  /**
25
25
  * Customer authentication options.
26
- * Used to initialize CustomerAuth on BrowserClient.
26
+ * Used to initialize CustomerAuth on Client.
27
27
  */
28
28
  customer?: {
29
29
  /**
@@ -42,7 +42,7 @@ interface ClientBrowserConfig {
42
42
  onTokenChange?: (token: string | null) => void;
43
43
  };
44
44
  }
45
- interface ClientServerConfig extends ClientBrowserConfig {
45
+ interface ClientServerConfig extends ClientConfig {
46
46
  secretKey: string;
47
47
  }
48
48
  interface ClientMetadata {
@@ -451,7 +451,7 @@ declare class CollectionClient extends HttpClient {
451
451
 
452
452
  /**
453
453
  * Read-only subset of CollectionQueryBuilder.
454
- * BrowserClient.from() returns this type to prevent write operations at compile time.
454
+ * Client.from() returns this type to prevent write operations at compile time.
455
455
  */
456
456
  type ReadOnlyQueryBuilder<T extends PublicCollection> = Pick<CollectionQueryBuilder<T>, 'find' | 'findById' | 'count' | 'findMetadata' | 'findMetadataById'>;
457
457
  declare class CollectionQueryBuilder<T extends PublicCollection> {
@@ -585,7 +585,7 @@ interface CustomerAuthOptions {
585
585
  }
586
586
 
587
587
  /**
588
- * Customer authentication client for BrowserClient.
588
+ * Customer authentication client.
589
589
  *
590
590
  * Manages customer registration, login, logout, and token lifecycle.
591
591
  * All requests include X-Client-Key for tenant resolution.
@@ -894,21 +894,26 @@ declare class QueryHooks extends CollectionHooks {
894
894
  setCustomerData: CustomerHooks['setCustomerData'];
895
895
  }
896
896
 
897
- declare class BrowserClient {
897
+ declare class Client {
898
898
  cart: CartApi;
899
899
  query: ReadOnlyQueryHooks;
900
900
  collections: CollectionClient;
901
901
  queryClient: QueryClient;
902
902
  customer: CustomerAuth;
903
903
  protected state: ClientState;
904
- protected config: ClientBrowserConfig;
904
+ protected config: ClientConfig;
905
905
  protected baseUrl: string;
906
- constructor(options: ClientBrowserConfig);
906
+ constructor(options: ClientConfig);
907
907
  from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
908
908
  getState(): ClientState;
909
- getConfig(): ClientBrowserConfig;
909
+ getConfig(): ClientConfig;
910
910
  }
911
- declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
911
+ /**
912
+ * Create an SDK client. Works in both browser and server environments.
913
+ * Read-only collection queries + customer auth (cart, login, profile).
914
+ * Use `createServerClient()` when you need full CRUD with secretKey.
915
+ */
916
+ declare function createClient(options: ClientConfig): Client;
912
917
 
913
918
  declare class ServerClient {
914
919
  api: OrderApi;
@@ -923,8 +928,12 @@ declare class ServerClient {
923
928
  constructor(options: ClientServerConfig);
924
929
  from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
925
930
  getState(): ClientState;
926
- getConfig(): ClientBrowserConfig;
931
+ getConfig(): ClientConfig;
927
932
  }
933
+ /**
934
+ * Create a server-only client with full read/write access. Requires secretKey.
935
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
936
+ */
928
937
  declare function createServerClient(options: ClientServerConfig): ServerClient;
929
938
 
930
939
  declare function getQueryClient(): QueryClient;
@@ -947,4 +956,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
947
956
  */
948
957
  declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
949
958
 
950
- export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
959
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.js CHANGED
@@ -267,7 +267,7 @@ function resolveApiUrl() {
267
267
  return envUrl.replace(/\/$/, "");
268
268
  }
269
269
  }
270
- return "https://api-dev.01.software";
270
+ return "https://api.01.software";
271
271
  }
272
272
 
273
273
  // src/core/internal/utils/http.ts
@@ -1873,7 +1873,7 @@ var CustomerHooks = class {
1873
1873
  ensureCustomerAuth() {
1874
1874
  if (!this.customerAuth) {
1875
1875
  throw createConfigError(
1876
- "Customer hooks require BrowserClient. Use createBrowserClient() instead of createServerClient()."
1876
+ "Customer hooks require Client. Use createClient() instead of createServerClient()."
1877
1877
  );
1878
1878
  }
1879
1879
  return this.customerAuth;
@@ -1997,7 +1997,7 @@ var QueryHooks = class extends CollectionHooks {
1997
1997
  };
1998
1998
 
1999
1999
  // src/core/client/client.ts
2000
- var BrowserClient = class {
2000
+ var Client = class {
2001
2001
  constructor(options) {
2002
2002
  var _a;
2003
2003
  if (!options.clientKey) {
@@ -2054,8 +2054,8 @@ var BrowserClient = class {
2054
2054
  return __spreadValues({}, this.config);
2055
2055
  }
2056
2056
  };
2057
- function createBrowserClient(options) {
2058
- return new BrowserClient(options);
2057
+ function createClient(options) {
2058
+ return new Client(options);
2059
2059
  }
2060
2060
 
2061
2061
  // src/core/client/client.server.ts
@@ -2063,7 +2063,7 @@ var ServerClient = class {
2063
2063
  constructor(options) {
2064
2064
  if (typeof window !== "undefined") {
2065
2065
  throw createConfigError(
2066
- "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createBrowserClient() for browser code instead."
2066
+ "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createClient() for browser code instead."
2067
2067
  );
2068
2068
  }
2069
2069
  if (!options.clientKey) {
@@ -2467,9 +2467,9 @@ function getVideoMp4Url(playbackId, resolution = "high") {
2467
2467
  export {
2468
2468
  ApiError,
2469
2469
  BaseApi,
2470
- BrowserClient,
2471
2470
  COLLECTIONS,
2472
2471
  CartApi,
2472
+ Client,
2473
2473
  CollectionClient,
2474
2474
  CollectionHooks,
2475
2475
  CollectionQueryBuilder,
@@ -2491,7 +2491,7 @@ export {
2491
2491
  ValidationError,
2492
2492
  collectionKeys,
2493
2493
  createApiKey,
2494
- createBrowserClient,
2494
+ createClient,
2495
2495
  createServerClient,
2496
2496
  createServerToken,
2497
2497
  createTypedWebhookHandler,