@viu/emporix-sdk 2.21.0 → 2.23.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 (114) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/availability.cjs +118 -0
  3. package/dist/availability.cjs.map +1 -1
  4. package/dist/availability.d.cts +178 -2
  5. package/dist/availability.d.ts +178 -2
  6. package/dist/availability.js +1 -1
  7. package/dist/cart.cjs +215 -9
  8. package/dist/cart.cjs.map +1 -1
  9. package/dist/cart.d.cts +281 -3
  10. package/dist/cart.d.ts +281 -3
  11. package/dist/cart.js +1 -1
  12. package/dist/category.cjs +220 -2
  13. package/dist/category.cjs.map +1 -1
  14. package/dist/category.d.cts +408 -1
  15. package/dist/category.d.ts +408 -1
  16. package/dist/category.js +1 -1
  17. package/dist/{chunk-HD5RBCM6.js → chunk-27NLS646.js} +10 -2
  18. package/dist/chunk-27NLS646.js.map +1 -0
  19. package/dist/{chunk-PYLWZZC4.js → chunk-6PJFOX3A.js} +126 -2
  20. package/dist/chunk-6PJFOX3A.js.map +1 -0
  21. package/dist/chunk-HWVFF6B2.js +378 -0
  22. package/dist/chunk-HWVFF6B2.js.map +1 -0
  23. package/dist/chunk-LQFRJSVT.js +224 -0
  24. package/dist/chunk-LQFRJSVT.js.map +1 -0
  25. package/dist/chunk-P7G4LOOV.js +264 -0
  26. package/dist/chunk-P7G4LOOV.js.map +1 -0
  27. package/dist/{chunk-HBEQEIT6.js → chunk-PRN3T6TY.js} +63 -3
  28. package/dist/chunk-PRN3T6TY.js.map +1 -0
  29. package/dist/{chunk-44F52KRE.js → chunk-QQMLN76U.js} +27 -2
  30. package/dist/chunk-QQMLN76U.js.map +1 -0
  31. package/dist/chunk-UNW6SFSB.js +363 -0
  32. package/dist/chunk-UNW6SFSB.js.map +1 -0
  33. package/dist/chunk-V3275BA7.js +181 -0
  34. package/dist/chunk-V3275BA7.js.map +1 -0
  35. package/dist/chunk-W2KBVWJ2.js +323 -0
  36. package/dist/chunk-W2KBVWJ2.js.map +1 -0
  37. package/dist/chunk-YVZ6GOLE.js +399 -0
  38. package/dist/chunk-YVZ6GOLE.js.map +1 -0
  39. package/dist/chunk-ZOFGDNSX.js +305 -0
  40. package/dist/chunk-ZOFGDNSX.js.map +1 -0
  41. package/dist/companies.cjs +25 -0
  42. package/dist/companies.cjs.map +1 -1
  43. package/dist/companies.d.cts +14 -0
  44. package/dist/companies.d.ts +14 -0
  45. package/dist/companies.js +1 -1
  46. package/dist/contacts.cjs +8 -0
  47. package/dist/contacts.cjs.map +1 -1
  48. package/dist/contacts.d.cts +2 -0
  49. package/dist/contacts.d.ts +2 -0
  50. package/dist/contacts.js +1 -1
  51. package/dist/customer-groups-BxSNFHq1.d.cts +706 -0
  52. package/dist/customer-groups-GlzWhDsi.d.ts +706 -0
  53. package/dist/customer-groups.cjs +200 -17
  54. package/dist/customer-groups.cjs.map +1 -1
  55. package/dist/customer-groups.d.cts +2 -110
  56. package/dist/customer-groups.d.ts +2 -110
  57. package/dist/customer-groups.js +1 -1
  58. package/dist/customer.cjs +61 -1
  59. package/dist/customer.cjs.map +1 -1
  60. package/dist/customer.d.cts +48 -1
  61. package/dist/customer.d.ts +48 -1
  62. package/dist/customer.js +1 -1
  63. package/dist/index.cjs +2566 -554
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.cts +455 -12
  66. package/dist/index.d.ts +455 -12
  67. package/dist/index.js +687 -342
  68. package/dist/index.js.map +1 -1
  69. package/dist/orders.cjs +160 -2
  70. package/dist/orders.cjs.map +1 -1
  71. package/dist/orders.d.cts +221 -1
  72. package/dist/orders.d.ts +221 -1
  73. package/dist/orders.js +1 -1
  74. package/dist/payment.cjs +124 -0
  75. package/dist/payment.cjs.map +1 -1
  76. package/dist/payment.d.cts +335 -1
  77. package/dist/payment.d.ts +335 -1
  78. package/dist/payment.js +1 -1
  79. package/dist/price.cjs +197 -0
  80. package/dist/price.cjs.map +1 -1
  81. package/dist/price.d.cts +577 -1
  82. package/dist/price.d.ts +577 -1
  83. package/dist/price.js +1 -1
  84. package/dist/product.cjs +190 -0
  85. package/dist/product.cjs.map +1 -1
  86. package/dist/product.d.cts +503 -1
  87. package/dist/product.d.ts +503 -1
  88. package/dist/product.js +1 -1
  89. package/dist/segment.cjs +179 -0
  90. package/dist/segment.cjs.map +1 -1
  91. package/dist/segment.d.cts +181 -1
  92. package/dist/segment.d.ts +181 -1
  93. package/dist/segment.js +1 -1
  94. package/package.json +1 -1
  95. package/dist/chunk-36T4YPQJ.js +0 -106
  96. package/dist/chunk-36T4YPQJ.js.map +0 -1
  97. package/dist/chunk-3BTPX7IJ.js +0 -41
  98. package/dist/chunk-3BTPX7IJ.js.map +0 -1
  99. package/dist/chunk-44F52KRE.js.map +0 -1
  100. package/dist/chunk-A3LYJUD4.js +0 -108
  101. package/dist/chunk-A3LYJUD4.js.map +0 -1
  102. package/dist/chunk-FZMP5NQZ.js +0 -173
  103. package/dist/chunk-FZMP5NQZ.js.map +0 -1
  104. package/dist/chunk-HBEQEIT6.js.map +0 -1
  105. package/dist/chunk-HD5RBCM6.js.map +0 -1
  106. package/dist/chunk-HUEMYP2L.js +0 -193
  107. package/dist/chunk-HUEMYP2L.js.map +0 -1
  108. package/dist/chunk-IVCCGJN5.js +0 -63
  109. package/dist/chunk-IVCCGJN5.js.map +0 -1
  110. package/dist/chunk-NE7MIZPR.js +0 -144
  111. package/dist/chunk-NE7MIZPR.js.map +0 -1
  112. package/dist/chunk-PYLWZZC4.js.map +0 -1
  113. package/dist/chunk-ZNLHLFQM.js +0 -160
  114. package/dist/chunk-ZNLHLFQM.js.map +0 -1
@@ -1,38 +1,221 @@
1
1
  'use strict';
2
2
 
3
- // src/services/customer-groups.ts
4
- var CustomerGroupsService = class {
3
+ // src/services/iam.ts
4
+ var IamService = class {
5
5
  constructor(ctx) {
6
6
  this.ctx = ctx;
7
7
  }
8
8
  ctx;
9
9
  static channel = "iam";
10
10
  base() {
11
- return `/iam/${this.ctx.tenant}/groups`;
11
+ return `/iam/${this.ctx.tenant}`;
12
12
  }
13
- /** Lists customer groups belonging to one legal entity. */
14
- async listForCompany(legalEntityId, auth) {
15
- return this.ctx.http.request({
13
+ users = {
14
+ list: async (auth, query) => this.ctx.http.request({
15
+ method: "GET",
16
+ path: `${this.base()}/users`,
17
+ auth,
18
+ ...query ? { query } : {}
19
+ }),
20
+ create: async (input, auth) => this.ctx.http.request({
21
+ method: "POST",
22
+ path: `${this.base()}/users`,
23
+ auth,
24
+ body: input
25
+ }),
26
+ get: async (userId, auth) => this.ctx.http.request({
16
27
  method: "GET",
17
- path: this.base(),
18
- query: { "b2b.legalEntityId": legalEntityId },
28
+ path: `${this.base()}/users/${userId}`,
19
29
  auth
20
- });
30
+ }),
31
+ getMe: async (auth) => this.ctx.http.request({
32
+ method: "GET",
33
+ path: `${this.base()}/users/me`,
34
+ auth
35
+ }),
36
+ update: async (userId, input, auth) => {
37
+ await this.ctx.http.request({
38
+ method: "PUT",
39
+ path: `${this.base()}/users/${userId}`,
40
+ auth,
41
+ body: input
42
+ });
43
+ },
44
+ delete: async (userId, auth) => {
45
+ await this.ctx.http.request({
46
+ method: "DELETE",
47
+ path: `${this.base()}/users/${userId}`,
48
+ auth
49
+ });
50
+ },
51
+ getGroups: async (userId, auth) => this.ctx.http.request({
52
+ method: "GET",
53
+ path: `${this.base()}/users/${userId}/groups`,
54
+ auth
55
+ }),
56
+ getScopes: async (userId, auth) => this.ctx.http.request({
57
+ method: "GET",
58
+ path: `${this.base()}/users/${userId}/scopes`,
59
+ auth
60
+ }),
61
+ getMyScopes: async (auth) => this.ctx.http.request({
62
+ method: "GET",
63
+ path: `${this.base()}/users/me/scopes`,
64
+ auth
65
+ }),
66
+ getAccessControls: async (userId, auth) => this.ctx.http.request({
67
+ method: "GET",
68
+ path: `${this.base()}/users/${userId}/access-controls`,
69
+ auth
70
+ }),
71
+ getMyAccessControls: async (auth) => this.ctx.http.request({
72
+ method: "GET",
73
+ path: `${this.base()}/users/me/access-controls`,
74
+ auth
75
+ })
76
+ };
77
+ groups = {
78
+ list: async (auth, query) => this.ctx.http.request({
79
+ method: "GET",
80
+ path: `${this.base()}/groups`,
81
+ auth,
82
+ ...query ? { query } : {}
83
+ }),
84
+ create: async (input, auth) => this.ctx.http.request({
85
+ method: "POST",
86
+ path: `${this.base()}/groups`,
87
+ auth,
88
+ body: input
89
+ }),
90
+ get: async (groupId, auth) => this.ctx.http.request({
91
+ method: "GET",
92
+ path: `${this.base()}/groups/${groupId}`,
93
+ auth
94
+ }),
95
+ update: async (groupId, input, auth) => {
96
+ await this.ctx.http.request({
97
+ method: "PUT",
98
+ path: `${this.base()}/groups/${groupId}`,
99
+ auth,
100
+ body: input
101
+ });
102
+ },
103
+ delete: async (groupId, auth) => {
104
+ await this.ctx.http.request({
105
+ method: "DELETE",
106
+ path: `${this.base()}/groups/${groupId}`,
107
+ auth
108
+ });
109
+ },
110
+ listUsers: async (groupId, auth) => this.ctx.http.request({
111
+ method: "GET",
112
+ path: `${this.base()}/groups/${groupId}/users`,
113
+ auth
114
+ }),
115
+ addUser: async (groupId, input, auth) => this.ctx.http.request({
116
+ method: "POST",
117
+ path: `${this.base()}/groups/${groupId}/users`,
118
+ auth,
119
+ body: input
120
+ }),
121
+ updateUser: async (groupId, userType, userId, input, auth) => this.ctx.http.request({
122
+ method: "PUT",
123
+ path: `${this.base()}/groups/${groupId}/users/${userType}/${userId}`,
124
+ auth,
125
+ body: input
126
+ }),
127
+ removeAllUsers: async (groupId, auth) => {
128
+ await this.ctx.http.request({
129
+ method: "DELETE",
130
+ path: `${this.base()}/groups/${groupId}/users`,
131
+ auth
132
+ });
133
+ },
134
+ listAccessControls: async (groupId, auth) => this.ctx.http.request({
135
+ method: "GET",
136
+ path: `${this.base()}/groups/${groupId}/access-controls`,
137
+ auth
138
+ })
139
+ };
140
+ accessControls = {
141
+ list: async (auth) => this.ctx.http.request({
142
+ method: "GET",
143
+ path: `${this.base()}/access-controls`,
144
+ auth
145
+ }),
146
+ get: async (id, auth) => this.ctx.http.request({
147
+ method: "GET",
148
+ path: `${this.base()}/access-controls/${id}`,
149
+ auth
150
+ }),
151
+ upsert: async (id, input, auth) => this.ctx.http.request({
152
+ method: "PUT",
153
+ path: `${this.base()}/access-controls/${id}`,
154
+ auth,
155
+ body: input
156
+ }),
157
+ delete: async (id, auth) => {
158
+ await this.ctx.http.request({
159
+ method: "DELETE",
160
+ path: `${this.base()}/access-controls/${id}`,
161
+ auth
162
+ });
163
+ }
164
+ };
165
+ scopes = {
166
+ list: async (auth) => this.ctx.http.request({
167
+ method: "GET",
168
+ path: `${this.base()}/scopes`,
169
+ auth
170
+ }),
171
+ get: async (scopeId, auth) => this.ctx.http.request({
172
+ method: "GET",
173
+ path: `${this.base()}/scopes/${scopeId}`,
174
+ auth
175
+ }),
176
+ upsertCustom: async (scopeId, input, auth) => this.ctx.http.request({
177
+ method: "PUT",
178
+ path: `${this.base()}/scopes/${scopeId}`,
179
+ auth,
180
+ body: input
181
+ }),
182
+ deleteCustom: async (scopeId, auth) => {
183
+ await this.ctx.http.request({
184
+ method: "DELETE",
185
+ path: `${this.base()}/scopes/${scopeId}`,
186
+ auth
187
+ });
188
+ }
189
+ };
190
+ };
191
+
192
+ // src/services/customer-groups.ts
193
+ var CustomerGroupsService = class {
194
+ constructor(ctx) {
195
+ this.ctx = ctx;
196
+ this.iam = new IamService(ctx);
197
+ }
198
+ ctx;
199
+ static channel = "iam";
200
+ iam;
201
+ /** Lists customer groups belonging to one legal entity. */
202
+ async listForCompany(legalEntityId, auth) {
203
+ return this.iam.groups.list(auth, { "b2b.legalEntityId": legalEntityId });
21
204
  }
22
205
  /** Adds a user (customer or employee) to a group. */
23
206
  async addMember(groupId, member, auth) {
24
- return this.ctx.http.request({
25
- method: "POST",
26
- path: `${this.base()}/${groupId}/users`,
27
- auth,
28
- body: member
29
- });
207
+ return await this.iam.groups.addUser(groupId, member, auth);
30
208
  }
31
- /** Removes a user from a group. */
209
+ /**
210
+ * Removes a user from a group. Uses `DELETE …/groups/{groupId}/users/{userId}`
211
+ * directly — this endpoint is deprecated upstream and intentionally not
212
+ * exposed on {@link IamService}, so it is not delegated. No non-deprecated
213
+ * single-user removal exists.
214
+ */
32
215
  async removeMember(groupId, userId, auth) {
33
216
  await this.ctx.http.request({
34
217
  method: "DELETE",
35
- path: `${this.base()}/${groupId}/users/${userId}`,
218
+ path: `/iam/${this.ctx.tenant}/groups/${groupId}/users/${userId}`,
36
219
  auth
37
220
  });
38
221
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/customer-groups.ts"],"names":[],"mappings":";;;AAeO,IAAM,wBAAN,MAA4B;AAAA,EAEjC,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAD7B,OAAgB,OAAA,GAAU,KAAA;AAAA,EAGlB,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,EAAmD;AAC7F,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA+B;AAAA,MAClD,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;AAAA;AAAA,EAGA,MAAM,SAAA,CACJ,OAAA,EACA,MAAA,EACA,IAAA,EACyB;AACzB,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,OAAO,CAAA,MAAA,CAAA;AAAA,MAC/B,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,YAAA,CAAa,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAkC;AACpF,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,IAAA,EAAM,GAAG,IAAA,CAAK,IAAA,EAAM,CAAA,CAAA,EAAI,OAAO,UAAU,MAAM,CAAA,CAAA;AAAA,MAC/C;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 {\n GroupsQueryDocument,\n AssignmentCreateRequest,\n} from \"../generated/iam\";\n\n/**\n * Access to IAM customer groups for a legal entity.\n *\n * `listForCompany` requires `iam.group_read`; the member mutations\n * (`addMember`/`removeMember`) require `iam.group_manage` — typically only\n * granted to Admin-group customers; a 403 surfaces as\n * `EmporixInsufficientScopeError`.\n */\nexport class CustomerGroupsService {\n static readonly channel = \"iam\" as const;\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<GroupsQueryDocument[]> {\n return this.ctx.http.request<GroupsQueryDocument[]>({\n method: \"GET\",\n path: this.base(),\n query: { \"b2b.legalEntityId\": legalEntityId },\n auth,\n });\n }\n\n /** Adds a user (customer or employee) to a group. */\n async addMember(\n groupId: string,\n member: AssignmentCreateRequest,\n auth: AuthContext,\n ): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: `${this.base()}/${groupId}/users`,\n auth,\n body: member,\n });\n }\n\n /** Removes a user from a group. */\n async removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${groupId}/users/${userId}`,\n auth,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/services/iam.ts","../src/services/customer-groups.ts"],"names":[],"mappings":";;;AA+BO,IAAM,aAAN,MAAiB;AAAA,EAEtB,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAD7B,OAAgB,OAAA,GAAU,KAAA;AAAA,EAGlB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,KAAA,EAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,CAAA;AAAA,EAChC;AAAA,EAES,KAAA,GAAQ;AAAA,IACf,MAAM,OAAO,IAAA,EAAmB,UAC9B,IAAA,CAAK,GAAA,CAAI,KAAK,OAAA,CAAmB;AAAA,MAC/B,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,CAAA,MAAA,CAAA;AAAA,MACpB,IAAA;AAAA,MACA,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU;AAAC,KAC1B,CAAA;AAAA,IACH,QAAQ,OAAO,KAAA,EAAsB,SACnC,IAAA,CAAK,GAAA,CAAI,KAAK,OAAA,CAAwB;AAAA,MACpC,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,CAAA,MAAA,CAAA;AAAA,MACpB,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,IACH,KAAK,OAAO,MAAA,EAAgB,SAC1B,IAAA,CAAK,GAAA,CAAI,KAAK,OAAA,CAAuB;AAAA,MACnC,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,UAAU,MAAM,CAAA,CAAA;AAAA,MACpC;AAAA,KACD,CAAA;AAAA,IACH,OAAO,OAAO,I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,CAAa,OAAA,EAAiB,MAAA,EAAgB,IAAA,EAAkC;AACpF,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,IAAA,EAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,QAAA,EAAW,OAAO,UAAU,MAAM,CAAA,CAAA;AAAA,MAC/D;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 {\n IamUser,\n IamUserDetail,\n IamUserCreate,\n IamUserUpdate,\n IamUserScopes,\n IamUserCreated,\n IamGroup,\n IamGroupCreate,\n IamGroupUpdate,\n IamGroupCreated,\n IamGroupMemberInput,\n IamGroupMemberCreated,\n IamAccessControl,\n IamAccessControlUpsert,\n IamAccessControlCreated,\n IamScope,\n IamScopeUpsert,\n IamScopeCreated,\n} from \"./iam-types\";\n\nexport type * from \"./iam-types\";\n\n/**\n * IAM admin CRUD: users, user-groups, access-controls, scopes. Every method\n * requires an explicit `auth` (admin/service token; `getMe*` take the caller's\n * customer token). The deprecated legacy-RBAC model (roles/permissions/\n * resources/templates) is intentionally not wrapped.\n */\nexport class IamService {\n static readonly channel = \"iam\" as const;\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/iam/${this.ctx.tenant}`;\n }\n\n readonly users = {\n list: async (auth: AuthContext, query?: Record<string, string | number>): Promise<IamUser[]> =>\n this.ctx.http.request<IamUser[]>({\n method: \"GET\",\n path: `${this.base()}/users`,\n auth,\n ...(query ? { query } : {}),\n }),\n create: async (input: IamUserCreate, auth: AuthContext): Promise<IamUserCreated> =>\n this.ctx.http.request<IamUserCreated>({\n method: \"POST\",\n path: `${this.base()}/users`,\n auth,\n body: input,\n }),\n get: async (userId: string, auth: AuthContext): Promise<IamUserDetail> =>\n this.ctx.http.request<IamUserDetail>({\n method: \"GET\",\n path: `${this.base()}/users/${userId}`,\n auth,\n }),\n getMe: async (auth: AuthContext): Promise<IamUserDetail> =>\n this.ctx.http.request<IamUserDetail>({\n method: \"GET\",\n path: `${this.base()}/users/me`,\n auth,\n }),\n update: async (userId: string, input: IamUserUpdate, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/users/${userId}`,\n auth,\n body: input,\n });\n },\n delete: async (userId: string, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/users/${userId}`,\n auth,\n });\n },\n getGroups: async (userId: string, auth: AuthContext): Promise<IamGroup[]> =>\n this.ctx.http.request<IamGroup[]>({\n method: \"GET\",\n path: `${this.base()}/users/${userId}/groups`,\n auth,\n }),\n getScopes: async (userId: string, auth: AuthContext): Promise<IamUserScopes> =>\n this.ctx.http.request<IamUserScopes>({\n method: \"GET\",\n path: `${this.base()}/users/${userId}/scopes`,\n auth,\n }),\n getMyScopes: async (auth: AuthContext): Promise<IamUserScopes> =>\n this.ctx.http.request<IamUserScopes>({\n method: \"GET\",\n path: `${this.base()}/users/me/scopes`,\n auth,\n }),\n getAccessControls: async (userId: string, auth: AuthContext): Promise<IamAccessControl[]> =>\n this.ctx.http.request<IamAccessControl[]>({\n method: \"GET\",\n path: `${this.base()}/users/${userId}/access-controls`,\n auth,\n }),\n getMyAccessControls: async (auth: AuthContext): Promise<IamAccessControl[]> =>\n this.ctx.http.request<IamAccessControl[]>({\n method: \"GET\",\n path: `${this.base()}/users/me/access-controls`,\n auth,\n }),\n };\n\n readonly groups = {\n list: async (auth: AuthContext, query?: Record<string, string | number>): Promise<IamGroup[]> =>\n this.ctx.http.request<IamGroup[]>({\n method: \"GET\",\n path: `${this.base()}/groups`,\n auth,\n ...(query ? { query } : {}),\n }),\n create: async (input: IamGroupCreate, auth: AuthContext): Promise<IamGroupCreated> =>\n this.ctx.http.request<IamGroupCreated>({\n method: \"POST\",\n path: `${this.base()}/groups`,\n auth,\n body: input,\n }),\n get: async (groupId: string, auth: AuthContext): Promise<IamGroup> =>\n this.ctx.http.request<IamGroup>({\n method: \"GET\",\n path: `${this.base()}/groups/${groupId}`,\n auth,\n }),\n update: async (groupId: string, input: IamGroupUpdate, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/groups/${groupId}`,\n auth,\n body: input,\n });\n },\n delete: async (groupId: string, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/groups/${groupId}`,\n auth,\n });\n },\n listUsers: async (groupId: string, auth: AuthContext): Promise<IamUser[]> =>\n this.ctx.http.request<IamUser[]>({\n method: \"GET\",\n path: `${this.base()}/groups/${groupId}/users`,\n auth,\n }),\n addUser: async (\n groupId: string,\n input: IamGroupMemberInput,\n auth: AuthContext,\n ): Promise<IamGroupMemberCreated> =>\n this.ctx.http.request<IamGroupMemberCreated>({\n method: \"POST\",\n path: `${this.base()}/groups/${groupId}/users`,\n auth,\n body: input,\n }),\n updateUser: async (\n groupId: string,\n userType: string,\n userId: string,\n input: IamGroupMemberInput,\n auth: AuthContext,\n ): Promise<IamGroupMemberCreated> =>\n this.ctx.http.request<IamGroupMemberCreated>({\n method: \"PUT\",\n path: `${this.base()}/groups/${groupId}/users/${userType}/${userId}`,\n auth,\n body: input,\n }),\n removeAllUsers: async (groupId: string, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/groups/${groupId}/users`,\n auth,\n });\n },\n listAccessControls: async (groupId: string, auth: AuthContext): Promise<IamAccessControl[]> =>\n this.ctx.http.request<IamAccessControl[]>({\n method: \"GET\",\n path: `${this.base()}/groups/${groupId}/access-controls`,\n auth,\n }),\n };\n\n readonly accessControls = {\n list: async (auth: AuthContext): Promise<IamAccessControl[]> =>\n this.ctx.http.request<IamAccessControl[]>({\n method: \"GET\",\n path: `${this.base()}/access-controls`,\n auth,\n }),\n get: async (id: string, auth: AuthContext): Promise<IamAccessControl> =>\n this.ctx.http.request<IamAccessControl>({\n method: \"GET\",\n path: `${this.base()}/access-controls/${id}`,\n auth,\n }),\n upsert: async (\n id: string,\n input: IamAccessControlUpsert,\n auth: AuthContext,\n ): Promise<IamAccessControlCreated> =>\n this.ctx.http.request<IamAccessControlCreated>({\n method: \"PUT\",\n path: `${this.base()}/access-controls/${id}`,\n auth,\n body: input,\n }),\n delete: async (id: string, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/access-controls/${id}`,\n auth,\n });\n },\n };\n\n readonly scopes = {\n list: async (auth: AuthContext): Promise<IamScope[]> =>\n this.ctx.http.request<IamScope[]>({\n method: \"GET\",\n path: `${this.base()}/scopes`,\n auth,\n }),\n get: async (scopeId: string, auth: AuthContext): Promise<IamScope> =>\n this.ctx.http.request<IamScope>({\n method: \"GET\",\n path: `${this.base()}/scopes/${scopeId}`,\n auth,\n }),\n upsertCustom: async (\n scopeId: string,\n input: IamScopeUpsert,\n auth: AuthContext,\n ): Promise<IamScopeCreated> =>\n this.ctx.http.request<IamScopeCreated>({\n method: \"PUT\",\n path: `${this.base()}/scopes/${scopeId}`,\n auth,\n body: input,\n }),\n deleteCustom: async (scopeId: string, auth: AuthContext): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/scopes/${scopeId}`,\n auth,\n });\n },\n };\n}\n","import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type { GroupsQueryDocument, AssignmentCreateRequest } from \"../generated/iam\";\nimport { IamService } from \"./iam\";\n\n/**\n * Access to IAM customer groups for a legal entity. Thin B2B-friendly wrapper\n * over {@link IamService.groups}; kept for backward compatibility.\n *\n * `listForCompany` requires `iam.group_read`; the member mutations\n * (`addMember`/`removeMember`) require `iam.group_manage` — typically only\n * granted to Admin-group customers; a 403 surfaces as\n * `EmporixInsufficientScopeError`.\n */\nexport class CustomerGroupsService {\n static readonly channel = \"iam\" as const;\n private readonly iam: IamService;\n constructor(private readonly ctx: ClientContext) {\n this.iam = new IamService(ctx);\n }\n\n /** Lists customer groups belonging to one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]> {\n return this.iam.groups.list(auth, { \"b2b.legalEntityId\": legalEntityId });\n }\n\n /** Adds a user (customer or employee) to a group. */\n async addMember(\n groupId: string,\n member: AssignmentCreateRequest,\n auth: AuthContext,\n ): Promise<{ id: string }> {\n // `addUser` returns `AssignmentIdResponse` (id optional); the original public\n // contract is `{ id: string }` (the old `request<{id:string}>` asserted the\n // same). Cast to preserve that contract — the wire body is identical.\n return (await this.iam.groups.addUser(groupId, member, auth)) as { id: string };\n }\n\n /**\n * Removes a user from a group. Uses `DELETE …/groups/{groupId}/users/{userId}`\n * directly — this endpoint is deprecated upstream and intentionally not\n * exposed on {@link IamService}, so it is not delegated. No non-deprecated\n * single-user removal exists.\n */\n async removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `/iam/${this.ctx.tenant}/groups/${groupId}/users/${userId}`,\n auth,\n });\n }\n}\n"]}
@@ -1,110 +1,2 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CfXJcYKP.cjs';
2
-
3
- type AssignmentCreateRequest = {
4
- /**
5
- * User unique identifier generated when the user is created. Might be customer ID or Management Dashboard user ID.
6
- */
7
- userId: string;
8
- /**
9
- * Assignment type, possible values: CUSTOMER, EMPLOYEE
10
- */
11
- userType?: 'CUSTOMER' | 'EMPLOYEE';
12
- };
13
- /**
14
- * Group metadata.
15
- */
16
- type GroupsMetadataQueryDocument = {
17
- /**
18
- * Group document version.
19
- */
20
- version: number;
21
- /**
22
- * Timestamp indicating when the group was created.
23
- */
24
- createdAt: string;
25
- /**
26
- * Timestamp indicating when the group was last modified.
27
- */
28
- modifiedAt?: string;
29
- };
30
- /**
31
- * Definition of groups
32
- */
33
- type GroupsQueryDocument = {
34
- /**
35
- * Group unique identifier generated when the group is created.
36
- */
37
- id?: string;
38
- /**
39
- * Localized group name in the form of a map of translations.
40
- */
41
- name?: {
42
- [key: string]: string;
43
- };
44
- /**
45
- * Localized group description in the form of a map of translations.
46
- */
47
- description?: {
48
- [key: string]: string;
49
- };
50
- /**
51
- * An identifier of a vendor to whom the group belongs. Can only be set during creation and is immutable thereafter. A group with vendorId can only be assigned to users of type `EMPLOYEE`
52
- */
53
- readonly vendorId?: string;
54
- /**
55
- * Access control unique identifiers associated with this group.
56
- */
57
- accessControls?: Array<string>;
58
- /**
59
- * Template unique identifiers associated with this group.
60
- */
61
- templates?: Array<string>;
62
- code?: string;
63
- /**
64
- * The group type determines if the group can consist of users of the `CUSTOMER` or the `EMPLOYEE` type.
65
- */
66
- userType?: string;
67
- /**
68
- * additional properties for B2B
69
- */
70
- b2b?: {
71
- /**
72
- * identifier of the assigned legal entity
73
- */
74
- legalEntityId?: string;
75
- };
76
- restrictions?: Restrictions;
77
- /**
78
- * Custom group attributes that need to be included directly in the `mixins` object.
79
- */
80
- mixins?: {
81
- [key: string]: string;
82
- };
83
- metadata?: GroupsMetadataQueryDocument;
84
- };
85
- type Restrictions = Array<string>;
86
-
87
- /**
88
- * Access to IAM customer groups for a legal entity.
89
- *
90
- * `listForCompany` requires `iam.group_read`; the member mutations
91
- * (`addMember`/`removeMember`) require `iam.group_manage` — typically only
92
- * granted to Admin-group customers; a 403 surfaces as
93
- * `EmporixInsufficientScopeError`.
94
- */
95
- declare class CustomerGroupsService {
96
- private readonly ctx;
97
- static readonly channel: "iam";
98
- constructor(ctx: ClientContext);
99
- private base;
100
- /** Lists customer groups belonging to one legal entity. */
101
- listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]>;
102
- /** Adds a user (customer or employee) to a group. */
103
- addMember(groupId: string, member: AssignmentCreateRequest, auth: AuthContext): Promise<{
104
- id: string;
105
- }>;
106
- /** Removes a user from a group. */
107
- removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void>;
108
- }
109
-
110
- export { CustomerGroupsService, type GroupsQueryDocument as IamGroup, type AssignmentCreateRequest as IamGroupMemberAssignment };
1
+ export { g as CustomerGroupsService, j as IamGroup, c as IamGroupMemberAssignment } from './customer-groups-BxSNFHq1.cjs';
2
+ import './context-CfXJcYKP.cjs';
@@ -1,110 +1,2 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CfXJcYKP.js';
2
-
3
- type AssignmentCreateRequest = {
4
- /**
5
- * User unique identifier generated when the user is created. Might be customer ID or Management Dashboard user ID.
6
- */
7
- userId: string;
8
- /**
9
- * Assignment type, possible values: CUSTOMER, EMPLOYEE
10
- */
11
- userType?: 'CUSTOMER' | 'EMPLOYEE';
12
- };
13
- /**
14
- * Group metadata.
15
- */
16
- type GroupsMetadataQueryDocument = {
17
- /**
18
- * Group document version.
19
- */
20
- version: number;
21
- /**
22
- * Timestamp indicating when the group was created.
23
- */
24
- createdAt: string;
25
- /**
26
- * Timestamp indicating when the group was last modified.
27
- */
28
- modifiedAt?: string;
29
- };
30
- /**
31
- * Definition of groups
32
- */
33
- type GroupsQueryDocument = {
34
- /**
35
- * Group unique identifier generated when the group is created.
36
- */
37
- id?: string;
38
- /**
39
- * Localized group name in the form of a map of translations.
40
- */
41
- name?: {
42
- [key: string]: string;
43
- };
44
- /**
45
- * Localized group description in the form of a map of translations.
46
- */
47
- description?: {
48
- [key: string]: string;
49
- };
50
- /**
51
- * An identifier of a vendor to whom the group belongs. Can only be set during creation and is immutable thereafter. A group with vendorId can only be assigned to users of type `EMPLOYEE`
52
- */
53
- readonly vendorId?: string;
54
- /**
55
- * Access control unique identifiers associated with this group.
56
- */
57
- accessControls?: Array<string>;
58
- /**
59
- * Template unique identifiers associated with this group.
60
- */
61
- templates?: Array<string>;
62
- code?: string;
63
- /**
64
- * The group type determines if the group can consist of users of the `CUSTOMER` or the `EMPLOYEE` type.
65
- */
66
- userType?: string;
67
- /**
68
- * additional properties for B2B
69
- */
70
- b2b?: {
71
- /**
72
- * identifier of the assigned legal entity
73
- */
74
- legalEntityId?: string;
75
- };
76
- restrictions?: Restrictions;
77
- /**
78
- * Custom group attributes that need to be included directly in the `mixins` object.
79
- */
80
- mixins?: {
81
- [key: string]: string;
82
- };
83
- metadata?: GroupsMetadataQueryDocument;
84
- };
85
- type Restrictions = Array<string>;
86
-
87
- /**
88
- * Access to IAM customer groups for a legal entity.
89
- *
90
- * `listForCompany` requires `iam.group_read`; the member mutations
91
- * (`addMember`/`removeMember`) require `iam.group_manage` — typically only
92
- * granted to Admin-group customers; a 403 surfaces as
93
- * `EmporixInsufficientScopeError`.
94
- */
95
- declare class CustomerGroupsService {
96
- private readonly ctx;
97
- static readonly channel: "iam";
98
- constructor(ctx: ClientContext);
99
- private base;
100
- /** Lists customer groups belonging to one legal entity. */
101
- listForCompany(legalEntityId: string, auth: AuthContext): Promise<GroupsQueryDocument[]>;
102
- /** Adds a user (customer or employee) to a group. */
103
- addMember(groupId: string, member: AssignmentCreateRequest, auth: AuthContext): Promise<{
104
- id: string;
105
- }>;
106
- /** Removes a user from a group. */
107
- removeMember(groupId: string, userId: string, auth: AuthContext): Promise<void>;
108
- }
109
-
110
- export { CustomerGroupsService, type GroupsQueryDocument as IamGroup, type AssignmentCreateRequest as IamGroupMemberAssignment };
1
+ export { g as CustomerGroupsService, j as IamGroup, c as IamGroupMemberAssignment } from './customer-groups-GlzWhDsi.js';
2
+ import './context-CfXJcYKP.js';
@@ -1,3 +1,3 @@
1
- export { CustomerGroupsService } from './chunk-3BTPX7IJ.js';
1
+ export { CustomerGroupsService } from './chunk-LQFRJSVT.js';
2
2
  //# sourceMappingURL=customer-groups.js.map
3
3
  //# sourceMappingURL=customer-groups.js.map
package/dist/customer.cjs CHANGED
@@ -223,6 +223,45 @@ var CustomerService = class {
223
223
  body: input
224
224
  });
225
225
  }
226
+ /**
227
+ * Completes double opt-in signup with the emailed token, creating the account
228
+ * and returning a logged-in {@link CustomerSession}. Default auth: anonymous.
229
+ */
230
+ async confirmSignup(token, auth = { kind: "anonymous" }) {
231
+ const wire = await this.ctx.http.request({
232
+ method: "GET",
233
+ path: `/customer/${this.ctx.tenant}/signup/optin/${encodeURIComponent(token)}`,
234
+ auth
235
+ });
236
+ return toSession("confirmSignup", wire);
237
+ }
238
+ /** Resends the double opt-in activation link. Default auth: anonymous. */
239
+ async resendActivation(input, auth = { kind: "anonymous" }) {
240
+ await this.ctx.http.request({
241
+ method: "POST",
242
+ path: `/customer/${this.ctx.tenant}/signup/optin/refresh_token`,
243
+ auth,
244
+ body: input
245
+ });
246
+ }
247
+ /** Requests a login-email change (emails a confirmation token). Requires customer/raw auth. */
248
+ async changeEmail(input, auth) {
249
+ await this.ctx.http.request({
250
+ method: "POST",
251
+ path: `/customer/${this.ctx.tenant}/me/accounts/internal/email/change`,
252
+ auth: requireCustomer(auth),
253
+ body: input
254
+ });
255
+ }
256
+ /** Confirms a login-email change with the emailed token. Default auth: anonymous. */
257
+ async confirmEmailChange(input, auth = { kind: "anonymous" }) {
258
+ await this.ctx.http.request({
259
+ method: "POST",
260
+ path: `/customer/${this.ctx.tenant}/me/accounts/internal/email/change/confirm`,
261
+ auth,
262
+ body: input
263
+ });
264
+ }
226
265
  /** Address sub-resource. All operations require customer/raw auth. */
227
266
  addresses = {
228
267
  list: async (auth) => this.ctx.http.request({
@@ -246,7 +285,28 @@ var CustomerService = class {
246
285
  method: "DELETE",
247
286
  path: `/customer/${this.ctx.tenant}/me/addresses/${id}`,
248
287
  auth: requireCustomer(auth)
249
- })
288
+ }),
289
+ get: async (id, auth) => this.ctx.http.request({
290
+ method: "GET",
291
+ path: `/customer/${this.ctx.tenant}/me/addresses/${id}`,
292
+ auth: requireCustomer(auth)
293
+ }),
294
+ addTags: async (id, tags, auth) => {
295
+ await this.ctx.http.request({
296
+ method: "POST",
297
+ path: `/customer/${this.ctx.tenant}/me/addresses/${id}/tags`,
298
+ query: { tags: tags.join(",") },
299
+ auth: requireCustomer(auth)
300
+ });
301
+ },
302
+ removeTags: async (id, tags, auth) => {
303
+ await this.ctx.http.request({
304
+ method: "DELETE",
305
+ path: `/customer/${this.ctx.tenant}/me/addresses/${id}/tags`,
306
+ query: { tags: tags.join(",") },
307
+ auth: requireCustomer(auth)
308
+ });
309
+ }
250
310
  };
251
311
  };
252
312