@blimu/client 1.1.1 → 1.1.3
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 +21 -26
- package/dist/__tests__/example.test.cjs +17135 -0
- package/dist/__tests__/example.test.cjs.map +1 -0
- package/dist/__tests__/example.test.d.mts +2 -0
- package/dist/__tests__/example.test.d.ts +2 -0
- package/dist/__tests__/example.test.mjs +17134 -0
- package/dist/__tests__/example.test.mjs.map +1 -0
- package/dist/auth-strategies.cjs +40 -0
- package/dist/auth-strategies.cjs.map +1 -0
- package/dist/auth-strategies.d.mts +9 -0
- package/dist/auth-strategies.d.ts +9 -0
- package/dist/auth-strategies.mjs +15 -0
- package/dist/auth-strategies.mjs.map +1 -0
- package/dist/{client.js → client.cjs} +158 -66
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.mts +12 -18
- package/dist/client.d.ts +12 -18
- package/dist/client.mjs +155 -64
- package/dist/client.mjs.map +1 -1
- package/dist/{index.js → index.cjs} +114 -134
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +6 -19
- package/dist/index.d.ts +6 -19
- package/dist/index.mjs +112 -132
- package/dist/index.mjs.map +1 -1
- package/dist/{schema-B4iFbKly.d.mts → schema-Z0doltxY.d.mts} +8 -10
- package/dist/{schema-B4iFbKly.d.ts → schema-Z0doltxY.d.ts} +8 -10
- package/dist/{schema.js → schema.cjs} +1 -1
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.mts +1 -2
- package/dist/schema.d.ts +1 -2
- package/dist/{schema.zod-CyY7RTSY.d.mts → schema.zod-BaQz36Pd.d.mts} +2 -6
- package/dist/{schema.zod-CyY7RTSY.d.ts → schema.zod-BaQz36Pd.d.ts} +2 -6
- package/dist/{schema.zod.js → schema.zod.cjs} +15 -25
- package/dist/schema.zod.cjs.map +1 -0
- package/dist/schema.zod.d.mts +1 -1
- package/dist/schema.zod.d.ts +1 -1
- package/dist/schema.zod.mjs +14 -22
- package/dist/schema.zod.mjs.map +1 -1
- package/dist/services/{auth.js → auth.cjs} +15 -5
- package/dist/services/auth.cjs.map +1 -0
- package/dist/services/auth.d.mts +6 -8
- package/dist/services/auth.d.ts +6 -8
- package/dist/services/auth.mjs +12 -4
- package/dist/services/auth.mjs.map +1 -1
- package/dist/services/{entitlements.js → entitlements.cjs} +3 -6
- package/dist/services/entitlements.cjs.map +1 -0
- package/dist/services/entitlements.d.mts +4 -6
- package/dist/services/entitlements.d.ts +4 -6
- package/dist/services/entitlements.mjs +2 -5
- package/dist/services/entitlements.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{utils.js → utils.cjs} +44 -26
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.mts +4 -3
- package/dist/utils.d.ts +4 -3
- package/dist/utils.mjs +42 -25
- package/dist/utils.mjs.map +1 -1
- package/package.json +32 -13
- package/dist/client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/schema.zod.js.map +0 -1
- package/dist/services/auth.js.map +0 -1
- package/dist/services/entitlements.js.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -27,7 +27,6 @@ __export(index_exports, {
|
|
|
27
27
|
BlimuError: () => BlimuError,
|
|
28
28
|
ClientError: () => ClientError,
|
|
29
29
|
ConflictError: () => ConflictError,
|
|
30
|
-
CoreClient: () => CoreClient,
|
|
31
30
|
EntitlementsService: () => EntitlementsService,
|
|
32
31
|
FetchClient: () => FetchClient,
|
|
33
32
|
FetchError: () => FetchError,
|
|
@@ -56,6 +55,7 @@ __export(index_exports, {
|
|
|
56
55
|
isBrowser: () => isBrowser,
|
|
57
56
|
isFetchAvailable: () => isFetchAvailable,
|
|
58
57
|
isNode: () => isNode,
|
|
58
|
+
isNotUndefined: () => isNotUndefined,
|
|
59
59
|
isSuccessResponse: () => isSuccessResponse,
|
|
60
60
|
linearStrategy: () => linearStrategy,
|
|
61
61
|
listAll: () => listAll,
|
|
@@ -307,7 +307,7 @@ var HookRegistry = class {
|
|
|
307
307
|
if (!this.hooks.has(stage)) {
|
|
308
308
|
this.hooks.set(stage, []);
|
|
309
309
|
}
|
|
310
|
-
this.hooks.get(stage)
|
|
310
|
+
this.hooks.get(stage)?.push(hook);
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
313
|
* Remove a specific hook from a stage
|
|
@@ -353,7 +353,14 @@ var HookRegistry = class {
|
|
|
353
353
|
* Check if any hooks are registered for a stage
|
|
354
354
|
*/
|
|
355
355
|
has(stage) {
|
|
356
|
-
|
|
356
|
+
if (!this.hooks.has(stage)) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
const hooks = this.hooks.get(stage);
|
|
360
|
+
if (!hooks) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
return hooks.length > 0;
|
|
357
364
|
}
|
|
358
365
|
};
|
|
359
366
|
var exponentialStrategy = /* @__PURE__ */ __name((attempt, baseBackoffMs) => {
|
|
@@ -468,7 +475,7 @@ async function* parseNDJSONStream(response) {
|
|
|
468
475
|
try {
|
|
469
476
|
const parsed = JSON.parse(trimmed);
|
|
470
477
|
yield parsed;
|
|
471
|
-
} catch
|
|
478
|
+
} catch {
|
|
472
479
|
console.warn("Skipping invalid JSON line:", trimmed);
|
|
473
480
|
}
|
|
474
481
|
}
|
|
@@ -477,7 +484,7 @@ async function* parseNDJSONStream(response) {
|
|
|
477
484
|
try {
|
|
478
485
|
const parsed = JSON.parse(buffer.trim());
|
|
479
486
|
yield parsed;
|
|
480
|
-
} catch
|
|
487
|
+
} catch {
|
|
481
488
|
console.warn("Skipping invalid JSON in buffer:", buffer.trim());
|
|
482
489
|
}
|
|
483
490
|
}
|
|
@@ -682,19 +689,17 @@ var FetchClient = class {
|
|
|
682
689
|
* Add an authentication strategy
|
|
683
690
|
*/
|
|
684
691
|
addAuthStrategy(strategy) {
|
|
685
|
-
if (!this.cfg.
|
|
686
|
-
this.cfg.
|
|
687
|
-
strategies: []
|
|
688
|
-
};
|
|
692
|
+
if (!this.cfg.authStrategies) {
|
|
693
|
+
this.cfg.authStrategies = [];
|
|
689
694
|
}
|
|
690
|
-
this.cfg.
|
|
695
|
+
this.cfg.authStrategies.push(strategy);
|
|
691
696
|
}
|
|
692
697
|
/**
|
|
693
698
|
* Remove all authentication strategies
|
|
694
699
|
*/
|
|
695
700
|
clearAuthStrategies() {
|
|
696
|
-
if (this.cfg.
|
|
697
|
-
this.cfg.
|
|
701
|
+
if (this.cfg.authStrategies) {
|
|
702
|
+
this.cfg.authStrategies = [];
|
|
698
703
|
}
|
|
699
704
|
}
|
|
700
705
|
/**
|
|
@@ -718,8 +723,9 @@ var FetchClient = class {
|
|
|
718
723
|
/**
|
|
719
724
|
* Make an HTTP request
|
|
720
725
|
*/
|
|
726
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
721
727
|
async request(init) {
|
|
722
|
-
|
|
728
|
+
const url = buildUrl(this.cfg.baseURL || "", init.path, init.query);
|
|
723
729
|
const headers = new Headers(this.cfg.headers || {});
|
|
724
730
|
if (init.headers) {
|
|
725
731
|
if (init.headers instanceof Headers) {
|
|
@@ -756,7 +762,7 @@ var FetchClient = class {
|
|
|
756
762
|
let lastError;
|
|
757
763
|
for (let attempt = 0; attempt <= retries + 1; attempt++) {
|
|
758
764
|
try {
|
|
759
|
-
|
|
765
|
+
const attemptUrl = buildUrl(this.cfg.baseURL || "", init.path, init.query);
|
|
760
766
|
const attemptHeaders = new Headers(headers);
|
|
761
767
|
await this.applyAuthentication(attemptHeaders, attemptUrl);
|
|
762
768
|
return await this.doRequest(attemptUrl, init, attemptHeaders, attempt, bodyContentType);
|
|
@@ -765,11 +771,13 @@ var FetchClient = class {
|
|
|
765
771
|
const shouldRetry = this.shouldRetry(err, attempt, retries, retryOn);
|
|
766
772
|
if (shouldRetry) {
|
|
767
773
|
if (this.hookRegistry.has("beforeRetry")) {
|
|
774
|
+
const serializedBody = serializeBody(init.body, bodyContentType);
|
|
768
775
|
await this.hookRegistry.execute("beforeRetry", {
|
|
769
776
|
url: url.toString(),
|
|
770
777
|
init: {
|
|
771
778
|
...init,
|
|
772
|
-
headers
|
|
779
|
+
headers,
|
|
780
|
+
body: serializedBody
|
|
773
781
|
},
|
|
774
782
|
attempt,
|
|
775
783
|
error: err,
|
|
@@ -779,11 +787,13 @@ var FetchClient = class {
|
|
|
779
787
|
const delay = calculateRetryDelay(attempt, retryStrategy, baseBackoff);
|
|
780
788
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
781
789
|
if (this.hookRegistry.has("afterRetry")) {
|
|
790
|
+
const serializedBody = serializeBody(init.body, bodyContentType);
|
|
782
791
|
await this.hookRegistry.execute("afterRetry", {
|
|
783
792
|
url: url.toString(),
|
|
784
793
|
init: {
|
|
785
794
|
...init,
|
|
786
|
-
headers
|
|
795
|
+
headers,
|
|
796
|
+
body: serializedBody
|
|
787
797
|
},
|
|
788
798
|
attempt,
|
|
789
799
|
error: err,
|
|
@@ -802,7 +812,7 @@ var FetchClient = class {
|
|
|
802
812
|
* Make a streaming HTTP request
|
|
803
813
|
*/
|
|
804
814
|
async *requestStream(init) {
|
|
805
|
-
|
|
815
|
+
const url = buildUrl(this.cfg.baseURL || "", init.path, init.query);
|
|
806
816
|
const headers = new Headers(this.cfg.headers || {});
|
|
807
817
|
if (init.headers) {
|
|
808
818
|
if (init.headers instanceof Headers) {
|
|
@@ -876,7 +886,8 @@ var FetchClient = class {
|
|
|
876
886
|
}
|
|
877
887
|
if (!res.ok) {
|
|
878
888
|
const parsed = await parseResponse(res);
|
|
879
|
-
const
|
|
889
|
+
const message = parsed?.message;
|
|
890
|
+
const error = createFetchError(res.status, message || `HTTP ${res.status}`, parsed, res.headers);
|
|
880
891
|
if (this.hookRegistry.has("onError")) {
|
|
881
892
|
await this.hookRegistry.execute("onError", {
|
|
882
893
|
url: url.toString(),
|
|
@@ -898,7 +909,7 @@ var FetchClient = class {
|
|
|
898
909
|
const streamingFormat = init.streamingFormat || "chunked";
|
|
899
910
|
if (streamingFormat === "sse") {
|
|
900
911
|
for await (const chunk of parseSSEStream(res)) {
|
|
901
|
-
|
|
912
|
+
const transformedChunk = chunk;
|
|
902
913
|
if (this.hookRegistry.has("onStreamChunk")) {
|
|
903
914
|
await this.hookRegistry.execute("onStreamChunk", {
|
|
904
915
|
url: url.toString(),
|
|
@@ -911,7 +922,7 @@ var FetchClient = class {
|
|
|
911
922
|
}
|
|
912
923
|
} else if (streamingFormat === "ndjson") {
|
|
913
924
|
for await (const chunk of parseNDJSONStream(res)) {
|
|
914
|
-
|
|
925
|
+
const transformedChunk = chunk;
|
|
915
926
|
if (this.hookRegistry.has("onStreamChunk")) {
|
|
916
927
|
await this.hookRegistry.execute("onStreamChunk", {
|
|
917
928
|
url: url.toString(),
|
|
@@ -924,7 +935,7 @@ var FetchClient = class {
|
|
|
924
935
|
}
|
|
925
936
|
} else {
|
|
926
937
|
for await (const chunk of parseChunkedStream(res)) {
|
|
927
|
-
|
|
938
|
+
const transformedChunk = chunk;
|
|
928
939
|
if (this.hookRegistry.has("onStreamChunk")) {
|
|
929
940
|
await this.hookRegistry.execute("onStreamChunk", {
|
|
930
941
|
url: url.toString(),
|
|
@@ -1029,7 +1040,8 @@ var FetchClient = class {
|
|
|
1029
1040
|
});
|
|
1030
1041
|
}
|
|
1031
1042
|
if (!isSuccessResponse(res)) {
|
|
1032
|
-
const
|
|
1043
|
+
const message = parsed?.message;
|
|
1044
|
+
const error = createFetchError(res.status, message || `HTTP ${res.status}`, parsed, res.headers);
|
|
1033
1045
|
if (this.hookRegistry.has("onError")) {
|
|
1034
1046
|
await this.hookRegistry.execute("onError", {
|
|
1035
1047
|
url: url.toString(),
|
|
@@ -1072,10 +1084,10 @@ var FetchClient = class {
|
|
|
1072
1084
|
* Apply authentication strategies
|
|
1073
1085
|
*/
|
|
1074
1086
|
async applyAuthentication(headers, url) {
|
|
1075
|
-
if (!this.cfg.
|
|
1087
|
+
if (!this.cfg.authStrategies) {
|
|
1076
1088
|
return;
|
|
1077
1089
|
}
|
|
1078
|
-
for (const strategy of this.cfg.
|
|
1090
|
+
for (const strategy of this.cfg.authStrategies) {
|
|
1079
1091
|
await this.applyAuthStrategy(strategy, headers, url);
|
|
1080
1092
|
}
|
|
1081
1093
|
}
|
|
@@ -1136,50 +1148,46 @@ var FetchClient = class {
|
|
|
1136
1148
|
}
|
|
1137
1149
|
};
|
|
1138
1150
|
|
|
1139
|
-
// src/
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
authStrategies.push({
|
|
1148
|
-
type: "bearer",
|
|
1149
|
-
token: () => bearerValue
|
|
1150
|
-
});
|
|
1151
|
-
} else if (typeof bearerValue === "function") {
|
|
1152
|
-
authStrategies.push({
|
|
1153
|
-
type: "bearer",
|
|
1154
|
-
token: bearerValue
|
|
1155
|
-
});
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
const finalAuthStrategies = [
|
|
1159
|
-
..._existingAuth?.strategies || [],
|
|
1160
|
-
...authStrategies
|
|
1161
|
-
];
|
|
1162
|
-
const fetchConfig = {
|
|
1163
|
-
...restCfg,
|
|
1164
|
-
baseURL: cfg.baseURL ?? "https://api.blimu.dev",
|
|
1165
|
-
// Explicitly set auth after restCfg to ensure it's not overwritten
|
|
1166
|
-
// (restCfg might have an auth property that we want to replace)
|
|
1167
|
-
...finalAuthStrategies.length > 0 ? {
|
|
1168
|
-
auth: {
|
|
1169
|
-
strategies: finalAuthStrategies
|
|
1170
|
-
}
|
|
1171
|
-
} : {}
|
|
1172
|
-
// Hooks are passed through directly from FetchClientConfig (no mapping needed)
|
|
1173
|
-
};
|
|
1174
|
-
super(fetchConfig);
|
|
1175
|
-
}
|
|
1176
|
-
async request(init) {
|
|
1177
|
-
return await super.request(init);
|
|
1151
|
+
// src/auth-strategies.ts
|
|
1152
|
+
function buildAuthStrategies(cfg) {
|
|
1153
|
+
const authStrategies = [...cfg?.authStrategies ?? []];
|
|
1154
|
+
if (cfg.bearer) {
|
|
1155
|
+
authStrategies.push({
|
|
1156
|
+
type: "bearer",
|
|
1157
|
+
token: cfg.bearer
|
|
1158
|
+
});
|
|
1178
1159
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1160
|
+
return authStrategies;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// src/schema.ts
|
|
1164
|
+
var schema_exports = {};
|
|
1165
|
+
|
|
1166
|
+
// src/utils.ts
|
|
1167
|
+
async function* paginate(fetchPage, initialQuery = {}, pageSize = 100) {
|
|
1168
|
+
let offset = Number(initialQuery.offset ?? 0);
|
|
1169
|
+
const limit = Number(initialQuery.limit ?? pageSize);
|
|
1170
|
+
const baseQuery = { ...initialQuery };
|
|
1171
|
+
while (true) {
|
|
1172
|
+
const page = await fetchPage({ ...baseQuery, limit, offset });
|
|
1173
|
+
const items = page.data ?? [];
|
|
1174
|
+
for (const item of items) {
|
|
1175
|
+
yield item;
|
|
1176
|
+
}
|
|
1177
|
+
if (!page.hasMore || items.length < limit) break;
|
|
1178
|
+
offset += limit;
|
|
1181
1179
|
}
|
|
1182
|
-
}
|
|
1180
|
+
}
|
|
1181
|
+
async function listAll(fetchPage, query = {}, pageSize = 100) {
|
|
1182
|
+
const out = [];
|
|
1183
|
+
for await (const item of paginate(fetchPage, query, pageSize)) out.push(item);
|
|
1184
|
+
return out;
|
|
1185
|
+
}
|
|
1186
|
+
function isNotUndefined(arr) {
|
|
1187
|
+
return arr.filter(
|
|
1188
|
+
(item) => item !== void 0
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1183
1191
|
|
|
1184
1192
|
// src/services/auth.ts
|
|
1185
1193
|
var AuthService = class {
|
|
@@ -1193,7 +1201,7 @@ var AuthService = class {
|
|
|
1193
1201
|
return this.core.request({
|
|
1194
1202
|
method: "POST",
|
|
1195
1203
|
path: `/v1/auth/logout`,
|
|
1196
|
-
...init
|
|
1204
|
+
...init ?? {}
|
|
1197
1205
|
});
|
|
1198
1206
|
}
|
|
1199
1207
|
/**
|
|
@@ -1211,7 +1219,7 @@ var AuthService = class {
|
|
|
1211
1219
|
method: "POST",
|
|
1212
1220
|
path: `/v1/auth/refresh`,
|
|
1213
1221
|
query,
|
|
1214
|
-
...init
|
|
1222
|
+
...init ?? {}
|
|
1215
1223
|
});
|
|
1216
1224
|
}
|
|
1217
1225
|
/**
|
|
@@ -1219,7 +1227,8 @@ var AuthService = class {
|
|
|
1219
1227
|
* @returns ['v1/auth/refresh', query]
|
|
1220
1228
|
*/
|
|
1221
1229
|
refresh__queryKeys(query) {
|
|
1222
|
-
|
|
1230
|
+
const keys = ["v1/auth/refresh", query];
|
|
1231
|
+
return isNotUndefined(keys);
|
|
1223
1232
|
}
|
|
1224
1233
|
/**
|
|
1225
1234
|
* GET /v1/auth/session*
|
|
@@ -1228,7 +1237,7 @@ var AuthService = class {
|
|
|
1228
1237
|
return this.core.request({
|
|
1229
1238
|
method: "GET",
|
|
1230
1239
|
path: `/v1/auth/session`,
|
|
1231
|
-
...init
|
|
1240
|
+
...init ?? {}
|
|
1232
1241
|
});
|
|
1233
1242
|
}
|
|
1234
1243
|
/**
|
|
@@ -1253,7 +1262,7 @@ var EntitlementsService = class {
|
|
|
1253
1262
|
return this.core.request({
|
|
1254
1263
|
method: "GET",
|
|
1255
1264
|
path: `/v1/client/entitlements/list-for-tenant/${encodeURIComponent(tenantResourceId)}`,
|
|
1256
|
-
...init
|
|
1265
|
+
...init ?? {}
|
|
1257
1266
|
});
|
|
1258
1267
|
}
|
|
1259
1268
|
/**
|
|
@@ -1261,70 +1270,53 @@ var EntitlementsService = class {
|
|
|
1261
1270
|
* @returns ['v1/client/entitlements/list-for-tenant', tenantResourceId]
|
|
1262
1271
|
*/
|
|
1263
1272
|
listForTenant__queryKeys(tenantResourceId) {
|
|
1264
|
-
return [
|
|
1265
|
-
"v1/client/entitlements/list-for-tenant",
|
|
1266
|
-
tenantResourceId
|
|
1267
|
-
];
|
|
1273
|
+
return ["v1/client/entitlements/list-for-tenant", tenantResourceId];
|
|
1268
1274
|
}
|
|
1269
1275
|
};
|
|
1270
1276
|
|
|
1271
|
-
// src/
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1277
|
+
// src/client.ts
|
|
1278
|
+
var Blimu = class {
|
|
1279
|
+
auth;
|
|
1280
|
+
entitlements;
|
|
1281
|
+
constructor(options) {
|
|
1282
|
+
const restCfg = { ...options ?? {} };
|
|
1283
|
+
delete restCfg.bearer;
|
|
1284
|
+
const authStrategies = buildAuthStrategies(options ?? {});
|
|
1285
|
+
const core = new FetchClient({
|
|
1286
|
+
...restCfg,
|
|
1287
|
+
baseURL: options?.baseURL ?? "https://api.blimu.dev",
|
|
1288
|
+
...authStrategies.length > 0 ? { authStrategies } : {}
|
|
1289
|
+
});
|
|
1290
|
+
this.auth = new AuthService(core);
|
|
1291
|
+
this.entitlements = new EntitlementsService(core);
|
|
1284
1292
|
}
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
const out = [];
|
|
1288
|
-
for await (const item of paginate(fetchPage, query, pageSize))
|
|
1289
|
-
out.push(item);
|
|
1290
|
-
return out;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
// src/schema.ts
|
|
1294
|
-
var schema_exports = {};
|
|
1293
|
+
};
|
|
1294
|
+
var BlimuError = FetchError;
|
|
1295
1295
|
|
|
1296
1296
|
// src/schema.zod.ts
|
|
1297
1297
|
var schema_zod_exports = {};
|
|
1298
1298
|
__export(schema_zod_exports, {
|
|
1299
1299
|
AuthRefreshQuerySchema: () => AuthRefreshQuerySchema,
|
|
1300
|
-
EntitlementTypeSchema: () => EntitlementTypeSchema,
|
|
1301
1300
|
EntitlementsListResultSchema: () => EntitlementsListResultSchema,
|
|
1302
1301
|
RefreshResponseSchema: () => RefreshResponseSchema,
|
|
1303
|
-
ResourceTypeSchema: () => ResourceTypeSchema,
|
|
1304
1302
|
SessionResponseSchema: () => SessionResponseSchema
|
|
1305
1303
|
});
|
|
1306
1304
|
var import_zod = require("zod");
|
|
1307
|
-
var EntitlementTypeSchema = import_zod.z.string();
|
|
1308
|
-
var ResourceTypeSchema = import_zod.z.string();
|
|
1309
1305
|
var EntitlementsListResultSchema = import_zod.z.object({
|
|
1310
|
-
results: import_zod.z.
|
|
1311
|
-
import_zod.z.object({
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
resourceId: import_zod.z.string(),
|
|
1325
|
-
resourceType: ResourceTypeSchema
|
|
1326
|
-
})
|
|
1327
|
-
)
|
|
1306
|
+
results: import_zod.z.object({
|
|
1307
|
+
entitlements: import_zod.z.object({
|
|
1308
|
+
allowed: import_zod.z.boolean(),
|
|
1309
|
+
allowedByPlan: import_zod.z.boolean(),
|
|
1310
|
+
allowedByRole: import_zod.z.boolean(),
|
|
1311
|
+
allowedPlans: import_zod.z.string().array().optional(),
|
|
1312
|
+
allowedRoles: import_zod.z.string().array(),
|
|
1313
|
+
currentPlan: import_zod.z.string().optional(),
|
|
1314
|
+
currentRole: import_zod.z.string().optional(),
|
|
1315
|
+
entitlement: import_zod.z.string()
|
|
1316
|
+
}).array(),
|
|
1317
|
+
resourceId: import_zod.z.string(),
|
|
1318
|
+
resourceType: import_zod.z.string()
|
|
1319
|
+
}).array()
|
|
1328
1320
|
});
|
|
1329
1321
|
var RefreshResponseSchema = import_zod.z.object({ sessionToken: import_zod.z.string() });
|
|
1330
1322
|
var SessionResponseSchema = import_zod.z.object({
|
|
@@ -1340,18 +1332,6 @@ var SessionResponseSchema = import_zod.z.object({
|
|
|
1340
1332
|
var AuthRefreshQuerySchema = import_zod.z.object({
|
|
1341
1333
|
__lh_jwt: import_zod.z.string().optional()
|
|
1342
1334
|
});
|
|
1343
|
-
|
|
1344
|
-
// src/index.ts
|
|
1345
|
-
var Blimu = class {
|
|
1346
|
-
auth;
|
|
1347
|
-
entitlements;
|
|
1348
|
-
constructor(options) {
|
|
1349
|
-
const core = new CoreClient(options);
|
|
1350
|
-
this.auth = new AuthService(core);
|
|
1351
|
-
this.entitlements = new EntitlementsService(core);
|
|
1352
|
-
}
|
|
1353
|
-
};
|
|
1354
|
-
var BlimuError = FetchError;
|
|
1355
1335
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1356
1336
|
0 && (module.exports = {
|
|
1357
1337
|
AuthService,
|
|
@@ -1361,7 +1341,6 @@ var BlimuError = FetchError;
|
|
|
1361
1341
|
BlimuError,
|
|
1362
1342
|
ClientError,
|
|
1363
1343
|
ConflictError,
|
|
1364
|
-
CoreClient,
|
|
1365
1344
|
EntitlementsService,
|
|
1366
1345
|
FetchClient,
|
|
1367
1346
|
FetchError,
|
|
@@ -1390,6 +1369,7 @@ var BlimuError = FetchError;
|
|
|
1390
1369
|
isBrowser,
|
|
1391
1370
|
isFetchAvailable,
|
|
1392
1371
|
isNode,
|
|
1372
|
+
isNotUndefined,
|
|
1393
1373
|
isSuccessResponse,
|
|
1394
1374
|
linearStrategy,
|
|
1395
1375
|
listAll,
|
|
@@ -1401,4 +1381,4 @@ var BlimuError = FetchError;
|
|
|
1401
1381
|
serializeBody,
|
|
1402
1382
|
serializeQueryParams
|
|
1403
1383
|
});
|
|
1404
|
-
//# sourceMappingURL=index.
|
|
1384
|
+
//# sourceMappingURL=index.cjs.map
|