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