Finishing touches

This commit is contained in:
Daniel Hougaard
2024-08-29 03:43:28 +04:00
parent 358508dc4f
commit f2f4785a6d
7 changed files with 86 additions and 305 deletions

3
.gitignore vendored
View File

@@ -129,4 +129,5 @@ dist
.yarn/install-state.gz
.pnp.*
/src/api/infisical/model/*.ts
/src/api/infisical/model/*.ts
/lib

47
package-lock.json generated
View File

@@ -13,10 +13,13 @@
"@aws-sdk/credential-provider-node": "^3.637.0",
"@aws-sdk/credential-providers": "^3.637.0",
"@aws-sdk/signature-v4": "^3.374.0",
"axios": "^1.7.5"
"axios": "^1.7.5",
"typescript": "^5.5.4"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.13.5"
"@openapitools/openapi-generator-cli": "^2.13.5",
"@types/node": "^22.5.1",
"tsc": "^2.0.4"
}
},
"node_modules/@aws-crypto/crc32": {
@@ -1703,6 +1706,16 @@
"node": ">=14.0.0"
}
},
"node_modules/@types/node": {
"version": "22.5.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.1.tgz",
"integrity": "sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/agent-base": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
@@ -2895,6 +2908,16 @@
"tree-kill": "cli.js"
}
},
"node_modules/tsc": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/tsc/-/tsc-2.0.4.tgz",
"integrity": "sha512-fzoSieZI5KKJVBYGvwbVZs/J5za84f2lSTLPYf6AGiIf43tZ3GNrI1QzTLcjtyDDP4aLxd46RTZq1nQxe7+k5Q==",
"dev": true,
"license": "MIT",
"bin": {
"tsc": "bin/tsc"
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
@@ -2914,6 +2937,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/typescript": {
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/uid": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
@@ -2927,6 +2963,13 @@
"node": ">=8"
}
},
"node_modules/undici-types": {
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"dev": true,
"license": "MIT"
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",

View File

@@ -3,20 +3,24 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"generate-api:infisical": "openapi-generator-cli generate -i https://app.infisical.com/api/docs/json -g typescript-axios -o ./src/api/infisical/ --skip-validate-spec --additional-properties=useSingleRequestParameter=true"
"generate-api:infisical": "openapi-generator-cli generate -i https://app.infisical.com/api/docs/json -g typescript-axios -o ./src/api/infisical/ --skip-validate-spec --additional-properties=useSingleRequestParameter=true",
"build": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.13.5"
"@openapitools/openapi-generator-cli": "^2.13.5",
"@types/node": "^22.5.1",
"tsc": "^2.0.4"
},
"dependencies": {
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/credential-provider-node": "^3.637.0",
"@aws-sdk/credential-providers": "^3.637.0",
"@aws-sdk/signature-v4": "^3.374.0",
"axios": "^1.7.5"
"axios": "^1.7.5",
"typescript": "^5.5.4"
}
}

View File

@@ -1,292 +0,0 @@
{
"openapi": "3.0.3",
"info": {
"title": "Infisical API",
"description": "List of all available APIs that can be consumed",
"version": "0.0.1"
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"description": "An access token in Infisical"
}
},
"schemas": {}
},
"paths": {
"/api/v1/identities": {
"get": {
"description": "List identities",
"parameters": [
{
"schema": {
"type": "string"
},
"in": "query",
"name": "orgId",
"required": true,
"description": "The ID of the organization to list identities."
}
],
"security": [
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"identities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"role": {
"type": "string"
},
"roleId": {
"type": "string",
"format": "uuid",
"nullable": true
},
"orgId": {
"type": "string",
"format": "uuid"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"identityId": {
"type": "string",
"format": "uuid"
},
"customRole": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
},
"permissions": {},
"description": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"name",
"slug"
],
"additionalProperties": false
},
"identity": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid"
},
"authMethod": {
"type": "string",
"nullable": true
}
},
"required": [
"name",
"id"
],
"additionalProperties": false
}
},
"required": [
"id",
"role",
"orgId",
"createdAt",
"updatedAt",
"identityId",
"identity"
],
"additionalProperties": false
}
}
},
"required": [
"identities"
],
"additionalProperties": false
}
}
}
}
}
}
},
"/api/v1/identities/{identityId}": {
"get": {
"description": "Get an identity by id",
"parameters": [
{
"schema": {
"type": "string"
},
"in": "path",
"name": "identityId",
"required": true,
"description": "The ID of the identity to get details."
}
],
"security": [
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"identity": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"role": {
"type": "string"
},
"roleId": {
"type": "string",
"format": "uuid",
"nullable": true
},
"orgId": {
"type": "string",
"format": "uuid"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"identityId": {
"type": "string",
"format": "uuid"
},
"customRole": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
},
"permissions": {},
"description": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"name",
"slug"
],
"additionalProperties": false
},
"identity": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid"
},
"authMethod": {
"type": "string",
"nullable": true
}
},
"required": [
"name",
"id"
],
"additionalProperties": false
}
},
"required": [
"id",
"role",
"orgId",
"createdAt",
"updatedAt",
"identityId",
"identity"
],
"additionalProperties": false
}
},
"required": [
"identity"
],
"additionalProperties": false
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://app.infisical.com",
"description": "Production server"
},
{
"url": "http://localhost:8080",
"description": "Local server"
}
]
}

17
test/index.js Normal file
View File

@@ -0,0 +1,17 @@
const { InfisicalSDK } = require("../lib");
(async () => {
const client = new InfisicalSDK();
await client.auth().universalAuth.login({
clientId: "CLIENT_ID",
clientSecret: "CLIENT_SECRET"
});
const secrets = await client.secrets().listSecrets({
environment: "dev",
workspaceId: "PROJECT_ID"
});
console.log(secrets.secrets);
})();

View File

@@ -1,7 +0,0 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.8.0"
}
}

15
tsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"rootDir": "./src",
"outDir": "./lib",
"strict": true,
"resolveJsonModule": true,
"removeComments": true,
"esModuleInterop": true
},
"include": [".", "src"],
"exclude": ["examples", "node_modules", "lib", "test"]
}