@viu/emporix-sdk 1.0.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.
Files changed (132) hide show
  1. package/CHANGELOG.md +407 -0
  2. package/LICENSE +21 -0
  3. package/README.md +115 -0
  4. package/dist/cart.cjs +214 -0
  5. package/dist/cart.cjs.map +1 -0
  6. package/dist/cart.d.cts +1807 -0
  7. package/dist/cart.d.ts +1807 -0
  8. package/dist/cart.js +4 -0
  9. package/dist/cart.js.map +1 -0
  10. package/dist/category.cjs +97 -0
  11. package/dist/category.cjs.map +1 -0
  12. package/dist/category.d.cts +313 -0
  13. package/dist/category.d.ts +313 -0
  14. package/dist/category.js +4 -0
  15. package/dist/category.js.map +1 -0
  16. package/dist/checkout.cjs +98 -0
  17. package/dist/checkout.cjs.map +1 -0
  18. package/dist/checkout.d.cts +252 -0
  19. package/dist/checkout.d.ts +252 -0
  20. package/dist/checkout.js +4 -0
  21. package/dist/checkout.js.map +1 -0
  22. package/dist/chunk-4BJUCCKJ.js +86 -0
  23. package/dist/chunk-4BJUCCKJ.js.map +1 -0
  24. package/dist/chunk-6UNFMCHZ.js +95 -0
  25. package/dist/chunk-6UNFMCHZ.js.map +1 -0
  26. package/dist/chunk-B56JZNI7.js +49 -0
  27. package/dist/chunk-B56JZNI7.js.map +1 -0
  28. package/dist/chunk-BFQ732VZ.js +11 -0
  29. package/dist/chunk-BFQ732VZ.js.map +1 -0
  30. package/dist/chunk-F3WAQH2E.js +120 -0
  31. package/dist/chunk-F3WAQH2E.js.map +1 -0
  32. package/dist/chunk-GWJ2U2CP.js +14 -0
  33. package/dist/chunk-GWJ2U2CP.js.map +1 -0
  34. package/dist/chunk-HEO34WLO.js +47 -0
  35. package/dist/chunk-HEO34WLO.js.map +1 -0
  36. package/dist/chunk-HKPZI7Y5.js +30 -0
  37. package/dist/chunk-HKPZI7Y5.js.map +1 -0
  38. package/dist/chunk-IEZHGU7F.js +171 -0
  39. package/dist/chunk-IEZHGU7F.js.map +1 -0
  40. package/dist/chunk-KTODT6DV.js +86 -0
  41. package/dist/chunk-KTODT6DV.js.map +1 -0
  42. package/dist/chunk-NM7VDXBR.js +57 -0
  43. package/dist/chunk-NM7VDXBR.js.map +1 -0
  44. package/dist/chunk-OMYVOOSX.js +57 -0
  45. package/dist/chunk-OMYVOOSX.js.map +1 -0
  46. package/dist/chunk-QDABAMVN.js +89 -0
  47. package/dist/chunk-QDABAMVN.js.map +1 -0
  48. package/dist/chunk-RXVVFNYN.js +56 -0
  49. package/dist/chunk-RXVVFNYN.js.map +1 -0
  50. package/dist/chunk-SKX7KCMH.js +23 -0
  51. package/dist/chunk-SKX7KCMH.js.map +1 -0
  52. package/dist/chunk-TLH6SLAF.js +215 -0
  53. package/dist/chunk-TLH6SLAF.js.map +1 -0
  54. package/dist/chunk-Z6PNI5VT.js +142 -0
  55. package/dist/chunk-Z6PNI5VT.js.map +1 -0
  56. package/dist/companies.cjs +58 -0
  57. package/dist/companies.cjs.map +1 -0
  58. package/dist/companies.d.cts +31 -0
  59. package/dist/companies.d.ts +31 -0
  60. package/dist/companies.js +3 -0
  61. package/dist/companies.js.map +1 -0
  62. package/dist/contacts.cjs +51 -0
  63. package/dist/contacts.cjs.map +1 -0
  64. package/dist/contacts.d.cts +28 -0
  65. package/dist/contacts.d.ts +28 -0
  66. package/dist/contacts.js +3 -0
  67. package/dist/contacts.js.map +1 -0
  68. package/dist/context-vKgzZ-5f.d.cts +329 -0
  69. package/dist/context-vKgzZ-5f.d.ts +329 -0
  70. package/dist/customer-groups.cjs +25 -0
  71. package/dist/customer-groups.cjs.map +1 -0
  72. package/dist/customer-groups.d.cts +36 -0
  73. package/dist/customer-groups.d.ts +36 -0
  74. package/dist/customer-groups.js +3 -0
  75. package/dist/customer-groups.js.map +1 -0
  76. package/dist/customer.cjs +262 -0
  77. package/dist/customer.cjs.map +1 -0
  78. package/dist/customer.d.cts +386 -0
  79. package/dist/customer.d.ts +386 -0
  80. package/dist/customer.js +5 -0
  81. package/dist/customer.js.map +1 -0
  82. package/dist/index.cjs +2075 -0
  83. package/dist/index.cjs.map +1 -0
  84. package/dist/index.d.cts +218 -0
  85. package/dist/index.d.ts +218 -0
  86. package/dist/index.js +791 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/locations.cjs +59 -0
  89. package/dist/locations.cjs.map +1 -0
  90. package/dist/locations.d.cts +30 -0
  91. package/dist/locations.d.ts +30 -0
  92. package/dist/locations.js +3 -0
  93. package/dist/locations.js.map +1 -0
  94. package/dist/media.cjs +123 -0
  95. package/dist/media.cjs.map +1 -0
  96. package/dist/media.d.cts +219 -0
  97. package/dist/media.d.ts +219 -0
  98. package/dist/media.js +3 -0
  99. package/dist/media.js.map +1 -0
  100. package/dist/orders.cjs +98 -0
  101. package/dist/orders.cjs.map +1 -0
  102. package/dist/orders.d.cts +167 -0
  103. package/dist/orders.d.ts +167 -0
  104. package/dist/orders.js +3 -0
  105. package/dist/orders.js.map +1 -0
  106. package/dist/payment.cjs +77 -0
  107. package/dist/payment.cjs.map +1 -0
  108. package/dist/payment.d.cts +110 -0
  109. package/dist/payment.d.ts +110 -0
  110. package/dist/payment.js +5 -0
  111. package/dist/payment.js.map +1 -0
  112. package/dist/price.cjs +88 -0
  113. package/dist/price.cjs.map +1 -0
  114. package/dist/price.d.cts +445 -0
  115. package/dist/price.d.ts +445 -0
  116. package/dist/price.js +4 -0
  117. package/dist/price.js.map +1 -0
  118. package/dist/product.cjs +100 -0
  119. package/dist/product.cjs.map +1 -0
  120. package/dist/product.d.cts +400 -0
  121. package/dist/product.d.ts +400 -0
  122. package/dist/product.js +4 -0
  123. package/dist/product.js.map +1 -0
  124. package/dist/segment.cjs +189 -0
  125. package/dist/segment.cjs.map +1 -0
  126. package/dist/segment.d.cts +241 -0
  127. package/dist/segment.d.ts +241 -0
  128. package/dist/segment.js +5 -0
  129. package/dist/segment.js.map +1 -0
  130. package/dist/types.gen-D1QuqPLs.d.cts +166 -0
  131. package/dist/types.gen-D1QuqPLs.d.ts +166 -0
  132. package/package.json +141 -0
@@ -0,0 +1,329 @@
1
+ /** Log severity, low → high. */
2
+ type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
3
+ /** Numeric ordering used for fast comparison. */
4
+ declare const LEVEL: Record<LogLevel, number>;
5
+ /** Services that bind their own logger and are independently level-controllable. */
6
+ type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "http" | "auth";
7
+ /** Arbitrary structured fields attached to a log line. */
8
+ interface LogFields {
9
+ [key: string]: unknown;
10
+ }
11
+ /** The logger contract consumers may implement or swap. */
12
+ interface Logger {
13
+ level: LogLevel;
14
+ isLevelEnabled(level: LogLevel): boolean;
15
+ trace(msg: string, fields?: LogFields): void;
16
+ debug(msg: string, fields?: LogFields): void;
17
+ info(msg: string, fields?: LogFields): void;
18
+ warn(msg: string, fields?: LogFields): void;
19
+ error(msg: string, fields?: LogFields): void;
20
+ child(bindings: LogFields): Logger;
21
+ }
22
+ /** Object form of logger configuration. */
23
+ interface LoggerObjectConfig {
24
+ level?: LogLevel;
25
+ services?: Partial<Record<ServiceName, LogLevel>>;
26
+ pretty?: boolean;
27
+ redact?: string[];
28
+ }
29
+ /** `false` → noop logger; `Logger` → user-supplied; object → built-in console logger. */
30
+ type LoggerConfig = false | Logger | LoggerObjectConfig;
31
+ /**
32
+ * Resolves the effective level per service following:
33
+ * env per-service > env global > config.services[svc] > config.level > "warn".
34
+ * Runtime `set()` mutates programmatic levels but never overrides env-set ones
35
+ * unless `force` is passed.
36
+ */
37
+ declare class LevelResolver {
38
+ private readonly warn;
39
+ private cfgLevel;
40
+ private cfgServices;
41
+ private forcedServices;
42
+ private forcedGlobal;
43
+ private warned;
44
+ constructor(cfg: LoggerObjectConfig, warn?: (msg: string) => void);
45
+ private envFor;
46
+ private envGlobal;
47
+ /**
48
+ * Effective level for a service. Forced overrides (from `set(..., force)`)
49
+ * take precedence over env vars; otherwise env > programmatic config.
50
+ */
51
+ get(svc: ServiceName): LogLevel;
52
+ /** Numeric effective level for a service. */
53
+ numericLevel(svc: ServiceName): number;
54
+ /** True if `svc`'s effective level allows emitting at `at`. */
55
+ isAtLeast(svc: ServiceName, at: LogLevel): boolean;
56
+ /** Mutates programmatic level (global or one service). Env-set levels are sticky unless `force`. */
57
+ set(level: LogLevel, svc?: ServiceName, force?: boolean): void;
58
+ }
59
+ /** Deep-clones `value`, replacing redacted keys with a mask. AuthContext token is stripped. */
60
+ declare function redact(value: unknown, extra?: string[]): unknown;
61
+ interface Sink {
62
+ log: (...a: unknown[]) => void;
63
+ info: (...a: unknown[]) => void;
64
+ warn: (...a: unknown[]) => void;
65
+ error: (...a: unknown[]) => void;
66
+ }
67
+ /** Creates the built-in console logger. `opts.sink` overrides `console` (used in tests). */
68
+ declare function createConsoleLogger(resolver: LevelResolver, bindings?: LogFields, opts?: {
69
+ pretty?: boolean;
70
+ redact?: string[];
71
+ sink?: Sink;
72
+ }): Logger;
73
+ /** Creates a logger that discards everything. */
74
+ declare function createNoopLogger(): Logger;
75
+
76
+ /** Default Emporix API host. */
77
+ declare const DEFAULT_HOST = "https://api.emporix.io";
78
+ /** A client-credentials credential set (service / custom). */
79
+ interface ServiceCredentials {
80
+ clientId: string;
81
+ secret: string;
82
+ scope?: string;
83
+ }
84
+ /** Storefront credential — anonymous token needs the client id only, no secret. */
85
+ interface StorefrontCredentials {
86
+ clientId: string;
87
+ /**
88
+ * Session context bound at anonymous-login time. Required for
89
+ * `prices.matchByContext` to resolve currency/site/country server-side.
90
+ * `targetLocation` is an ISO country code.
91
+ */
92
+ context?: {
93
+ currency?: string;
94
+ siteCode?: string;
95
+ targetLocation?: string;
96
+ };
97
+ }
98
+ /** User-supplied SDK configuration. */
99
+ interface EmporixConfig {
100
+ tenant: string;
101
+ host?: string;
102
+ credentials: {
103
+ /**
104
+ * Service (client-credentials) credentials. Optional: storefront/SPA apps
105
+ * use only `storefront` (anonymous) + caller-supplied customer tokens and
106
+ * must never ship a backend secret. Required only when a `service`
107
+ * AuthContext is actually used — enforced lazily by the TokenProvider.
108
+ */
109
+ backend?: ServiceCredentials;
110
+ storefront?: StorefrontCredentials;
111
+ custom?: Record<string, ServiceCredentials>;
112
+ };
113
+ tokenProvider?: TokenProvider;
114
+ timeouts?: {
115
+ connectMs?: number;
116
+ readMs?: number;
117
+ };
118
+ retry?: {
119
+ maxAttempts?: number;
120
+ };
121
+ cache?: {
122
+ expirationBufferSeconds?: number;
123
+ maxLifetimeSeconds?: number;
124
+ };
125
+ logger?: LoggerConfig;
126
+ }
127
+ /** Fully-resolved configuration with defaults applied. */
128
+ interface ResolvedConfig {
129
+ tenant: string;
130
+ host: string;
131
+ credentials: EmporixConfig["credentials"];
132
+ tokenProvider: TokenProvider | undefined;
133
+ timeouts: {
134
+ connectMs: number;
135
+ readMs: number;
136
+ };
137
+ retry: {
138
+ maxAttempts: number;
139
+ };
140
+ cache: {
141
+ expirationBufferSeconds: number;
142
+ maxLifetimeSeconds: number;
143
+ };
144
+ logger: LoggerConfig | undefined;
145
+ }
146
+ /** Validates user config and applies defaults. Throws on invalid tenant/credentials. */
147
+ declare function validateConfig(input: EmporixConfig): ResolvedConfig;
148
+
149
+ /** Which token a call should use. */
150
+ type AuthKind = "service" | "customer" | "anonymous" | "raw";
151
+ /** Caller-supplied, per-call auth selector. Never stored on the client. */
152
+ type AuthContext = {
153
+ kind: "service";
154
+ credentials?: string;
155
+ } | {
156
+ kind: "anonymous";
157
+ } | {
158
+ kind: "customer";
159
+ token: string;
160
+ } | {
161
+ kind: "raw";
162
+ token: string;
163
+ };
164
+ /** An obtained anonymous storefront session. */
165
+ interface AnonymousSession {
166
+ accessToken: string;
167
+ refreshToken: string;
168
+ sessionId: string;
169
+ expiresIn: number;
170
+ }
171
+ /**
172
+ * Persistence callback for anonymous sessions. `read` is called once on the
173
+ * first need for an anonymous token to bootstrap a possibly-existing session;
174
+ * `write` is called after every successful login or refresh. `write(null)`
175
+ * means the SDK is invalidating the stored session.
176
+ */
177
+ interface AnonymousSessionStore {
178
+ read(): {
179
+ refreshToken: string;
180
+ sessionId: string;
181
+ } | null;
182
+ write(session: {
183
+ refreshToken: string;
184
+ sessionId: string;
185
+ } | null): void;
186
+ }
187
+ /** Supplies SDK-managed tokens (service/custom + anonymous). May be user-injected. */
188
+ interface TokenProvider {
189
+ /** Service/custom client-credentials token for the named credential set. */
190
+ getToken(credentialSet: string): Promise<string>;
191
+ /** Cached anonymous storefront session (preserves sessionId across refreshes). */
192
+ getAnonymousToken(): Promise<AnonymousSession>;
193
+ /** Refresh the anonymous session, preserving sessionId. */
194
+ refreshAnonymous?(): Promise<AnonymousSession>;
195
+ /** Invalidate a cached SDK-managed token so the next call re-auths. */
196
+ invalidate?(credentialSet: string): void;
197
+ /** Invalidate the cached anonymous session entirely (next call re-logs in). */
198
+ invalidateAnonymous?(): void;
199
+ /**
200
+ * Mark the anonymous access token stale but keep the refresh token, so the
201
+ * next {@link getAnonymousToken} refreshes (preserving sessionId) rather
202
+ * than starting a brand-new session.
203
+ */
204
+ expireAnonymous?(): void;
205
+ /**
206
+ * Install a persistence adapter for the anonymous session. The host (e.g.
207
+ * `EmporixProvider`) calls this at construction so the SDK can bootstrap
208
+ * an existing session and persist refreshes. Idempotent: a later call
209
+ * replaces the previous adapter.
210
+ */
211
+ attachAnonymousStore?(store: AnonymousSessionStore): void;
212
+ /**
213
+ * Subscribe to token-refresh events. Optional — implementations may no-op.
214
+ * Returns an unsubscribe function. `DefaultTokenProvider` emits for the
215
+ * anonymous-login / anonymous-refresh paths.
216
+ */
217
+ onRefresh?(listener: (event: {
218
+ kind: "anonymous" | "customer";
219
+ success: boolean;
220
+ }) => void): () => void;
221
+ }
222
+ /** Tiny constructors for {@link AuthContext}. */
223
+ declare const auth: {
224
+ /** Service/custom credential set (default `backend`). */
225
+ service: (credentials?: string) => AuthContext;
226
+ /** Cached anonymous storefront token. */
227
+ anonymous: () => AuthContext;
228
+ /** Caller-owned customer bearer token. */
229
+ customer: (token: string) => AuthContext;
230
+ /** Exact token, no transformation (SSO / token-exchange). */
231
+ raw: (token: string) => AuthContext;
232
+ };
233
+ /** Resolves an {@link AuthContext} to a concrete bearer token. */
234
+ declare function resolveToken(ctx: AuthContext, provider: TokenProvider): Promise<string>;
235
+ /** SDK-owned token provider: client-credentials service tokens + anonymous session. */
236
+ declare class DefaultTokenProvider implements TokenProvider {
237
+ private readonly cfg;
238
+ private readonly serviceCache;
239
+ private readonly serviceLocks;
240
+ private anon;
241
+ private anonLock;
242
+ private anonStore?;
243
+ private readonly refreshListeners;
244
+ constructor(cfg: ResolvedConfig);
245
+ onRefresh(listener: (event: {
246
+ kind: "anonymous" | "customer";
247
+ success: boolean;
248
+ }) => void): () => void;
249
+ private notifyRefresh;
250
+ attachAnonymousStore(store: AnonymousSessionStore): void;
251
+ private creds;
252
+ private fresh;
253
+ getToken(set: string): Promise<string>;
254
+ private requestServiceToken;
255
+ invalidate(set: string): void;
256
+ private anonFresh;
257
+ getAnonymousToken(): Promise<AnonymousSession>;
258
+ /** Refreshes the anonymous session, preserving its sessionId. */
259
+ refreshAnonymous(): Promise<AnonymousSession>;
260
+ invalidateAnonymous(): void;
261
+ /** Force a stale access token while keeping the refresh token + sessionId. */
262
+ expireAnonymous(): void;
263
+ private stripExpiry;
264
+ private fetchAnonymous;
265
+ }
266
+
267
+ /** A single HTTP request through the SDK. */
268
+ interface RequestOptions {
269
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
270
+ path: string;
271
+ auth: AuthContext;
272
+ query?: Record<string, string | number | undefined>;
273
+ body?: unknown;
274
+ /** Extra request headers (merged before auth; cannot override Authorization). */
275
+ headers?: Record<string, string>;
276
+ /** Per-request abort timeout override (ms). */
277
+ timeoutMs?: number;
278
+ }
279
+ /** Construction options for {@link HttpClient}. */
280
+ interface HttpClientOptions {
281
+ host: string;
282
+ provider: TokenProvider;
283
+ logger: Logger;
284
+ retry: {
285
+ maxAttempts: number;
286
+ };
287
+ timeouts: {
288
+ connectMs: number;
289
+ readMs: number;
290
+ };
291
+ /** Override the retry backoff delay (ms → Promise). Defaults to a real timer. */
292
+ sleep?: (ms: number) => Promise<void>;
293
+ }
294
+ /** Fetch wrapper: auth resolution, JSON parsing, typed error mapping, logging. */
295
+ declare class HttpClient {
296
+ private readonly opts;
297
+ private readonly sleep;
298
+ constructor(opts: HttpClientOptions);
299
+ request<T = unknown>(o: RequestOptions): Promise<T>;
300
+ }
301
+
302
+ /** Shared dependencies every service facade receives. */
303
+ interface ClientContext {
304
+ tenant: string;
305
+ http: HttpClient;
306
+ tokenProvider: TokenProvider;
307
+ logger: Logger;
308
+ }
309
+ /**
310
+ * A cursor-paged collection — `pageNumber`/`pageSize` indexing with a
311
+ * `hasNextPage` signal driven by the source page being full. Used by all
312
+ * paginated services and hooks across the SDK.
313
+ */
314
+ interface PaginatedItems<T> {
315
+ items: T[];
316
+ pageNumber: number;
317
+ pageSize: number;
318
+ hasNextPage: boolean;
319
+ }
320
+ /**
321
+ * Async-iterates every item across pages of a `PaginatedItems<T>` source.
322
+ * Stops when the source reports `hasNextPage: false`.
323
+ *
324
+ * @param fetchPage - given a 1-based page number, returns the page.
325
+ * @param start - first page to fetch (default `1`).
326
+ */
327
+ declare function iterateAll<T>(fetchPage: (pageNumber: number) => Promise<PaginatedItems<T>>, start?: number): AsyncIterable<T>;
328
+
329
+ export { type AnonymousSession as A, type ClientContext as C, DEFAULT_HOST as D, type EmporixConfig as E, HttpClient as H, LEVEL as L, type PaginatedItems as P, type RequestOptions as R, type ServiceCredentials as S, type TokenProvider as T, type AnonymousSessionStore as a, type AuthContext as b, type AuthKind as c, DefaultTokenProvider as d, type HttpClientOptions as e, LevelResolver as f, type LogFields as g, type LogLevel as h, type Logger as i, type LoggerConfig as j, type LoggerObjectConfig as k, type ResolvedConfig as l, type ServiceName as m, type StorefrontCredentials as n, auth as o, createConsoleLogger as p, createNoopLogger as q, iterateAll as r, redact as s, resolveToken as t, validateConfig as v };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ // src/services/customer-groups.ts
4
+ var CustomerGroupsService = class {
5
+ constructor(ctx) {
6
+ this.ctx = ctx;
7
+ }
8
+ ctx;
9
+ base() {
10
+ return `/iam/${this.ctx.tenant}/groups`;
11
+ }
12
+ /** Lists customer groups belonging to one legal entity. */
13
+ async listForCompany(legalEntityId, auth) {
14
+ return this.ctx.http.request({
15
+ method: "GET",
16
+ path: this.base(),
17
+ query: { "b2b.legalEntityId": legalEntityId },
18
+ auth
19
+ });
20
+ }
21
+ };
22
+
23
+ exports.CustomerGroupsService = CustomerGroupsService;
24
+ //# sourceMappingURL=customer-groups.cjs.map
25
+ //# sourceMappingURL=customer-groups.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/customer-groups.ts"],"names":[],"mappings":";;;AAWO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,KAAA,EAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,OAAA,CAAA;AAAA,EAChC;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAwC;AAClF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAoB;AAAA,MACvC,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,mBAAA,EAAqB,aAAA,EAAc;AAAA,MAC5C;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"customer-groups.cjs","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type { IamGroup } from \"../generated/iam\";\n\n/**\n * Read-only access to IAM customer groups for a legal entity.\n *\n * Member-management endpoints (`addMember`/`removeMember`) are deferred —\n * the exact IAM path/body shape isn't in the SDK input set yet. They will\n * land in a small follow-up plan once the API reference is confirmed.\n */\nexport class CustomerGroupsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/iam/${this.ctx.tenant}/groups`;\n }\n\n /** Lists customer groups belonging to one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<IamGroup[]> {\n return this.ctx.http.request<IamGroup[]>({\n method: \"GET\",\n path: this.base(),\n query: { \"b2b.legalEntityId\": legalEntityId },\n auth,\n });\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.cjs';
2
+
3
+ /**
4
+ * Hand-written mirror of the minimal IAM Service group shape needed for
5
+ * B2B foundation reads. The Emporix IAM API exposes groups keyed by
6
+ * `b2b.legalEntityId`. Membership-mutation endpoints exist on the server
7
+ * but their exact path/body shape is not in the current SDK input set —
8
+ * `customer-groups.ts` ships read-only here; mutations follow in a small
9
+ * follow-up plan once the API reference is confirmed.
10
+ */
11
+ interface IamGroupB2B {
12
+ legalEntityId?: string;
13
+ }
14
+ interface IamGroup {
15
+ id: string;
16
+ name?: Record<string, string>;
17
+ role?: string;
18
+ b2b?: IamGroupB2B;
19
+ }
20
+
21
+ /**
22
+ * Read-only access to IAM customer groups for a legal entity.
23
+ *
24
+ * Member-management endpoints (`addMember`/`removeMember`) are deferred —
25
+ * the exact IAM path/body shape isn't in the SDK input set yet. They will
26
+ * land in a small follow-up plan once the API reference is confirmed.
27
+ */
28
+ declare class CustomerGroupsService {
29
+ private readonly ctx;
30
+ constructor(ctx: ClientContext);
31
+ private base;
32
+ /** Lists customer groups belonging to one legal entity. */
33
+ listForCompany(legalEntityId: string, auth: AuthContext): Promise<IamGroup[]>;
34
+ }
35
+
36
+ export { CustomerGroupsService, type IamGroup, type IamGroupB2B };
@@ -0,0 +1,36 @@
1
+ import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
2
+
3
+ /**
4
+ * Hand-written mirror of the minimal IAM Service group shape needed for
5
+ * B2B foundation reads. The Emporix IAM API exposes groups keyed by
6
+ * `b2b.legalEntityId`. Membership-mutation endpoints exist on the server
7
+ * but their exact path/body shape is not in the current SDK input set —
8
+ * `customer-groups.ts` ships read-only here; mutations follow in a small
9
+ * follow-up plan once the API reference is confirmed.
10
+ */
11
+ interface IamGroupB2B {
12
+ legalEntityId?: string;
13
+ }
14
+ interface IamGroup {
15
+ id: string;
16
+ name?: Record<string, string>;
17
+ role?: string;
18
+ b2b?: IamGroupB2B;
19
+ }
20
+
21
+ /**
22
+ * Read-only access to IAM customer groups for a legal entity.
23
+ *
24
+ * Member-management endpoints (`addMember`/`removeMember`) are deferred —
25
+ * the exact IAM path/body shape isn't in the SDK input set yet. They will
26
+ * land in a small follow-up plan once the API reference is confirmed.
27
+ */
28
+ declare class CustomerGroupsService {
29
+ private readonly ctx;
30
+ constructor(ctx: ClientContext);
31
+ private base;
32
+ /** Lists customer groups belonging to one legal entity. */
33
+ listForCompany(legalEntityId: string, auth: AuthContext): Promise<IamGroup[]>;
34
+ }
35
+
36
+ export { CustomerGroupsService, type IamGroup, type IamGroupB2B };
@@ -0,0 +1,3 @@
1
+ export { CustomerGroupsService } from './chunk-SKX7KCMH.js';
2
+ //# sourceMappingURL=customer-groups.js.map
3
+ //# sourceMappingURL=customer-groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"customer-groups.js"}