@gigadrive/sdk 0.2.0 → 0.3.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.
- package/dist/index.d.mts +130 -1
- package/dist/index.d.ts +130 -1
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -725,6 +725,39 @@ var AiGatewayResource = class extends BaseResource {
|
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
|
|
728
|
+
// src/resources/api-keys.ts
|
|
729
|
+
var ApiKeysResource = class extends BaseResource {
|
|
730
|
+
/**
|
|
731
|
+
* Provision a new application-scoped API key. The plaintext secret is returned
|
|
732
|
+
* exactly once — store it immediately.
|
|
733
|
+
*
|
|
734
|
+
* @param data - The key name, target application, and optional scopes/expiry.
|
|
735
|
+
* @returns The created key including its one-time plaintext secret.
|
|
736
|
+
*/
|
|
737
|
+
async create(data) {
|
|
738
|
+
return this.httpClient.post("/api-keys", data);
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* List the API keys scoped to an application. Secrets are never returned.
|
|
742
|
+
*
|
|
743
|
+
* @param query - The application whose keys should be listed.
|
|
744
|
+
* @returns A paginated list of API key metadata.
|
|
745
|
+
*/
|
|
746
|
+
async list(query) {
|
|
747
|
+
return this.httpClient.get("/api-keys", {
|
|
748
|
+
query
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Permanently revoke an API key.
|
|
753
|
+
*
|
|
754
|
+
* @param apiKeyId - The API key ID (UUID).
|
|
755
|
+
*/
|
|
756
|
+
async delete(apiKeyId) {
|
|
757
|
+
return this.httpClient.delete(`/api-keys/${apiKeyId}`);
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
|
|
728
761
|
// src/resources/application-env-vars.ts
|
|
729
762
|
var ApplicationEnvVarsResource = class extends BaseResource {
|
|
730
763
|
/**
|
|
@@ -746,6 +779,27 @@ var ApplicationEnvVarsResource = class extends BaseResource {
|
|
|
746
779
|
query
|
|
747
780
|
});
|
|
748
781
|
}
|
|
782
|
+
/**
|
|
783
|
+
* Pull the environment variables that apply to an application for local
|
|
784
|
+
* development. Merges organization-wide, application-wide, and (optionally)
|
|
785
|
+
* environment-specific overrides, returning only non-sensitive values — ready
|
|
786
|
+
* to write to a local `.env` file.
|
|
787
|
+
*
|
|
788
|
+
* @param applicationId - The application ID (UUID).
|
|
789
|
+
* @param query - Optional environment targeting.
|
|
790
|
+
* @returns The resolved non-sensitive variables plus the count of omitted secrets.
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* ```ts
|
|
794
|
+
* const { items } = await client.applications.envVars.pull('app-id');
|
|
795
|
+
* const dotenv = items.map((v) => `${v.key}=${v.value}`).join('\n');
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
async pull(applicationId, query) {
|
|
799
|
+
return this.httpClient.get(`/applications/${applicationId}/env-vars/pull`, {
|
|
800
|
+
query
|
|
801
|
+
});
|
|
802
|
+
}
|
|
749
803
|
/**
|
|
750
804
|
* Create a new environment variable for an application.
|
|
751
805
|
*
|
|
@@ -2038,6 +2092,8 @@ var GigadriveClient = class {
|
|
|
2038
2092
|
deployments;
|
|
2039
2093
|
/** AI Gateway — OpenAI-compatible chat completions and model listing. */
|
|
2040
2094
|
aiGateway;
|
|
2095
|
+
/** Application-scoped API key management (create, list, revoke). */
|
|
2096
|
+
apiKeys;
|
|
2041
2097
|
constructor(config = {}) {
|
|
2042
2098
|
const baseUrl = config.baseUrl ?? readEnv("GIGADRIVE_API_BASE_URL") ?? DEFAULT_BASE_URL2;
|
|
2043
2099
|
const fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
@@ -2048,6 +2104,7 @@ var GigadriveClient = class {
|
|
|
2048
2104
|
this.applications = new ApplicationsResource(httpClient);
|
|
2049
2105
|
this.deployments = new DeploymentsResource(httpClient);
|
|
2050
2106
|
this.aiGateway = new AiGatewayResource(httpClient);
|
|
2107
|
+
this.apiKeys = new ApiKeysResource(httpClient);
|
|
2051
2108
|
}
|
|
2052
2109
|
};
|
|
2053
2110
|
|
|
@@ -2070,6 +2127,7 @@ export {
|
|
|
2070
2127
|
AiGatewayUsageResource,
|
|
2071
2128
|
AiGatewayVideosResource,
|
|
2072
2129
|
ApiError,
|
|
2130
|
+
ApiKeysResource,
|
|
2073
2131
|
ApplicationEnvVarsResource,
|
|
2074
2132
|
ApplicationRequestsResource,
|
|
2075
2133
|
ApplicationStorageResource,
|