@eduzz/miau-client 0.0.20 → 0.0.21
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/.turbo/turbo-build$colon$types.log +1 -1
- package/.turbo/turbo-prepublish.log +1 -1
- package/dist/MiauClient.d.ts +1 -2
- package/dist/index.js +36 -14
- package/dist/index.js.map +3 -3
- package/dist/miau-types/index.d.ts +1 -0
- package/dist/miau-types/index.d.ts.map +1 -1
- package/dist/miau-types/index.js +177 -0
- package/dist/miau-types/index.js.map +7 -0
- package/dist/miau-types/types/Environments.d.ts +6 -5
- package/dist/miau-types/types/Environments.d.ts.map +1 -1
- package/dist/miau-types/types/User.d.ts +22 -0
- package/dist/miau-types/types/User.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/MiauClient.ts +15 -9
package/dist/MiauClient.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11716,11 +11716,13 @@ __export(index_exports, {
|
|
|
11716
11716
|
HttpMethods: () => HttpMethods,
|
|
11717
11717
|
MiauClient: () => MiauClient,
|
|
11718
11718
|
ResourceProtocols: () => ResourceProtocols,
|
|
11719
|
+
SecretEnvValues: () => SecretEnvValues,
|
|
11720
|
+
UserPermissions: () => UserPermissions,
|
|
11719
11721
|
envMap: () => envMap,
|
|
11720
|
-
envs: () => envs,
|
|
11721
11722
|
expirationOptions: () => expirationOptions,
|
|
11722
11723
|
expirationOptionsValues: () => expirationOptionsValues,
|
|
11723
|
-
expirationTimeToDate: () => expirationTimeToDate
|
|
11724
|
+
expirationTimeToDate: () => expirationTimeToDate,
|
|
11725
|
+
networks: () => networks
|
|
11724
11726
|
});
|
|
11725
11727
|
module.exports = __toCommonJS(index_exports);
|
|
11726
11728
|
|
|
@@ -11831,17 +11833,30 @@ var expirationTimeToDate = (option) => {
|
|
|
11831
11833
|
};
|
|
11832
11834
|
|
|
11833
11835
|
// ../types/src/types/Environments.ts
|
|
11834
|
-
var
|
|
11835
|
-
development: "
|
|
11836
|
-
test: "
|
|
11837
|
-
production: "
|
|
11836
|
+
var networks = {
|
|
11837
|
+
development: "10.11.0.0/16",
|
|
11838
|
+
test: "10.201.0.0/16",
|
|
11839
|
+
production: "10.150.0.0/16"
|
|
11838
11840
|
};
|
|
11841
|
+
var SecretEnvValues = ["development", "test", "production"];
|
|
11839
11842
|
var envMap = {
|
|
11840
11843
|
development: "d",
|
|
11841
11844
|
test: "q",
|
|
11842
11845
|
production: "p"
|
|
11843
11846
|
};
|
|
11844
11847
|
|
|
11848
|
+
// ../types/src/types/User.ts
|
|
11849
|
+
var UserPermissions = {
|
|
11850
|
+
admin: "Administrator",
|
|
11851
|
+
manageApplications: "Manage Applications",
|
|
11852
|
+
deleteApplications: "Delete Applications",
|
|
11853
|
+
managePermissions: "Manage Permissions",
|
|
11854
|
+
manageResources: "Manage Resources",
|
|
11855
|
+
manageMetadata: "Manage Metadata",
|
|
11856
|
+
createSecrets: "Create Secrets",
|
|
11857
|
+
deleteSecrets: "Delete Secrets"
|
|
11858
|
+
};
|
|
11859
|
+
|
|
11845
11860
|
// src/MiauClient.ts
|
|
11846
11861
|
var import_node_crypto = __toESM(require("node:crypto"));
|
|
11847
11862
|
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken());
|
|
@@ -11934,22 +11949,27 @@ var MiauClient = class {
|
|
|
11934
11949
|
this.permissionsCache = /* @__PURE__ */ new Map();
|
|
11935
11950
|
this.permissionsRequests = /* @__PURE__ */ new Map();
|
|
11936
11951
|
this.getApiJwtUrl = () => {
|
|
11937
|
-
return `${this.apiUrl}/v1/jwt`;
|
|
11952
|
+
return `${this.config.apiUrl}/v1/jwt`;
|
|
11938
11953
|
};
|
|
11939
11954
|
this.getPermissionsUrl = () => {
|
|
11940
|
-
return `${this.apiUrl}/v1/permissions`;
|
|
11955
|
+
return `${this.config.apiUrl}/v1/permissions`;
|
|
11941
11956
|
};
|
|
11942
11957
|
this.getJwksUrl = () => {
|
|
11943
|
-
return `${this.apiUrl}/v1/jwks.json`;
|
|
11958
|
+
return `${this.config.apiUrl}/v1/jwks.json`;
|
|
11944
11959
|
};
|
|
11945
|
-
|
|
11946
|
-
|
|
11960
|
+
if (!config.apiUrl || !config.appSecret || !config.environment) {
|
|
11961
|
+
throw new Error("Invalid MiauClient configuration. Please provide apiUrl, appSecret, and environment.");
|
|
11962
|
+
}
|
|
11963
|
+
if (!SecretEnvValues.includes(config.environment)) {
|
|
11964
|
+
throw new Error(`Invalid environment: ${config.environment}. Must be one of ${SecretEnvValues.join(", ")}`);
|
|
11965
|
+
}
|
|
11966
|
+
this.config = config;
|
|
11947
11967
|
const apiKey = config.appSecret.substring(7, 32);
|
|
11948
11968
|
const hashedSecret = import_node_crypto.default.createHash("sha256").update(config.appSecret).digest("hex");
|
|
11949
11969
|
this.basicAuthToken = Buffer.from(`${apiKey}:${hashedSecret}`).toString("base64");
|
|
11950
11970
|
}
|
|
11951
11971
|
getEnvironment() {
|
|
11952
|
-
return this.environment;
|
|
11972
|
+
return this.config.environment;
|
|
11953
11973
|
}
|
|
11954
11974
|
async getPublicKey(kid) {
|
|
11955
11975
|
if (!this.jwksClient) {
|
|
@@ -12018,11 +12038,13 @@ var MiauClient = class {
|
|
|
12018
12038
|
HttpMethods,
|
|
12019
12039
|
MiauClient,
|
|
12020
12040
|
ResourceProtocols,
|
|
12041
|
+
SecretEnvValues,
|
|
12042
|
+
UserPermissions,
|
|
12021
12043
|
envMap,
|
|
12022
|
-
envs,
|
|
12023
12044
|
expirationOptions,
|
|
12024
12045
|
expirationOptionsValues,
|
|
12025
|
-
expirationTimeToDate
|
|
12046
|
+
expirationTimeToDate,
|
|
12047
|
+
networks
|
|
12026
12048
|
});
|
|
12027
12049
|
/*! Bundled license information:
|
|
12028
12050
|
|