@novence/sdk 0.2.0 → 0.2.1

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.
@@ -103,6 +103,22 @@ export interface FormSubmission {
103
103
  payload: Record<string, unknown>;
104
104
  createdAt: string;
105
105
  }
106
+ export interface ApiKey {
107
+ id: string;
108
+ /** First 12 chars, e.g. nv_live_ab12. The key itself is never returned. */
109
+ keyPrefix: string;
110
+ /** "account", "project", or "member:{email}". */
111
+ name: string;
112
+ projectId: string | null;
113
+ /** Account keys have a null projectId. */
114
+ scope: "account" | "project";
115
+ permissions?: Record<string, boolean>;
116
+ lastUsedAt?: string | null;
117
+ revokedAt?: string | null;
118
+ createdAt?: string;
119
+ /** True for the key this client is authenticating with. */
120
+ current: boolean;
121
+ }
106
122
  export interface Quotas {
107
123
  projects: number;
108
124
  storageGb: number;
@@ -365,7 +381,26 @@ export declare class Novence {
365
381
  }>;
366
382
  };
367
383
  apiKeys: {
368
- revoke: (id: string) => Promise<{
384
+ /**
385
+ * List keys on the account. Never includes the key or its hash — match on
386
+ * `keyPrefix`, and check `current` before revoking.
387
+ */
388
+ list: (opts?: {
389
+ projectId?: string;
390
+ includeRevoked?: boolean;
391
+ }) => Promise<{
392
+ keys: ApiKey[];
393
+ }>;
394
+ /**
395
+ * Revoke a key. Idempotent.
396
+ *
397
+ * Rejects with 409 when `id` is the key this client authenticates with;
398
+ * pass `force` to override, after which recovery needs `reissueApiKey`
399
+ * with an email OTP.
400
+ */
401
+ revoke: (id: string, opts?: {
402
+ force?: boolean;
403
+ }) => Promise<{
369
404
  id: string;
370
405
  revoked: boolean;
371
406
  }>;
package/dist/cjs/index.js CHANGED
@@ -216,7 +216,27 @@ class Novence {
216
216
  revokeSession: () => this.request("DELETE", "/v1/account/sessions/current"),
217
217
  };
218
218
  apiKeys = {
219
- revoke: (id) => this.request("DELETE", `/v1/api-keys/${id}`),
219
+ /**
220
+ * List keys on the account. Never includes the key or its hash — match on
221
+ * `keyPrefix`, and check `current` before revoking.
222
+ */
223
+ list: (opts = {}) => {
224
+ const q = new URLSearchParams();
225
+ if (opts.projectId)
226
+ q.set("projectId", opts.projectId);
227
+ if (opts.includeRevoked)
228
+ q.set("includeRevoked", "true");
229
+ const qs = q.toString();
230
+ return this.request("GET", `/v1/api-keys${qs ? `?${qs}` : ""}`);
231
+ },
232
+ /**
233
+ * Revoke a key. Idempotent.
234
+ *
235
+ * Rejects with 409 when `id` is the key this client authenticates with;
236
+ * pass `force` to override, after which recovery needs `reissueApiKey`
237
+ * with an email OTP.
238
+ */
239
+ revoke: (id, opts = {}) => this.request("DELETE", `/v1/api-keys/${id}${opts.force ? "?force=true" : ""}`),
220
240
  };
221
241
  }
222
242
  exports.Novence = Novence;
@@ -103,6 +103,22 @@ export interface FormSubmission {
103
103
  payload: Record<string, unknown>;
104
104
  createdAt: string;
105
105
  }
106
+ export interface ApiKey {
107
+ id: string;
108
+ /** First 12 chars, e.g. nv_live_ab12. The key itself is never returned. */
109
+ keyPrefix: string;
110
+ /** "account", "project", or "member:{email}". */
111
+ name: string;
112
+ projectId: string | null;
113
+ /** Account keys have a null projectId. */
114
+ scope: "account" | "project";
115
+ permissions?: Record<string, boolean>;
116
+ lastUsedAt?: string | null;
117
+ revokedAt?: string | null;
118
+ createdAt?: string;
119
+ /** True for the key this client is authenticating with. */
120
+ current: boolean;
121
+ }
106
122
  export interface Quotas {
107
123
  projects: number;
108
124
  storageGb: number;
@@ -365,7 +381,26 @@ export declare class Novence {
365
381
  }>;
366
382
  };
367
383
  apiKeys: {
368
- revoke: (id: string) => Promise<{
384
+ /**
385
+ * List keys on the account. Never includes the key or its hash — match on
386
+ * `keyPrefix`, and check `current` before revoking.
387
+ */
388
+ list: (opts?: {
389
+ projectId?: string;
390
+ includeRevoked?: boolean;
391
+ }) => Promise<{
392
+ keys: ApiKey[];
393
+ }>;
394
+ /**
395
+ * Revoke a key. Idempotent.
396
+ *
397
+ * Rejects with 409 when `id` is the key this client authenticates with;
398
+ * pass `force` to override, after which recovery needs `reissueApiKey`
399
+ * with an email OTP.
400
+ */
401
+ revoke: (id: string, opts?: {
402
+ force?: boolean;
403
+ }) => Promise<{
369
404
  id: string;
370
405
  revoked: boolean;
371
406
  }>;
package/dist/esm/index.js CHANGED
@@ -208,7 +208,27 @@ export class Novence {
208
208
  revokeSession: () => this.request("DELETE", "/v1/account/sessions/current"),
209
209
  };
210
210
  apiKeys = {
211
- revoke: (id) => this.request("DELETE", `/v1/api-keys/${id}`),
211
+ /**
212
+ * List keys on the account. Never includes the key or its hash — match on
213
+ * `keyPrefix`, and check `current` before revoking.
214
+ */
215
+ list: (opts = {}) => {
216
+ const q = new URLSearchParams();
217
+ if (opts.projectId)
218
+ q.set("projectId", opts.projectId);
219
+ if (opts.includeRevoked)
220
+ q.set("includeRevoked", "true");
221
+ const qs = q.toString();
222
+ return this.request("GET", `/v1/api-keys${qs ? `?${qs}` : ""}`);
223
+ },
224
+ /**
225
+ * Revoke a key. Idempotent.
226
+ *
227
+ * Rejects with 409 when `id` is the key this client authenticates with;
228
+ * pass `force` to override, after which recovery needs `reissueApiKey`
229
+ * with an email OTP.
230
+ */
231
+ revoke: (id, opts = {}) => this.request("DELETE", `/v1/api-keys/${id}${opts.force ? "?force=true" : ""}`),
212
232
  };
213
233
  }
214
234
  export async function bootstrapAccount(email, baseUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novence/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Official TypeScript SDK for Novence \u2014 static site hosting for AI agents. Create projects, upload files, run quality checks, deploy to the edge.",
5
5
  "license": "MIT",
6
6
  "type": "module",