@novence/sdk 0.2.2 → 0.2.4
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 +32 -3
- package/dist/cjs/index.d.ts +38 -0
- package/dist/cjs/index.js +42 -0
- package/dist/esm/index.d.ts +38 -0
- package/dist/esm/index.js +40 -0
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for [Novence](https://novence.ai) — static site hosting built for AI agents and the developers who wire them up.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Prefer the CLI for a first publish — no email until you claim:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx novence deploy ./dist
|
|
9
|
+
novence claim --email you@example.com
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This SDK is for app and script code **after** you have an `nv_` key. Create a
|
|
13
|
+
project, upload HTML/CSS/JS, run quality checks, and publish to the edge at
|
|
14
|
+
`https://{suffix}.novence.ai/`.
|
|
6
15
|
|
|
7
16
|
```bash
|
|
8
17
|
npm install @novence/sdk
|
|
@@ -18,6 +27,23 @@ const { Novence } = require("@novence/sdk"); // CommonJS
|
|
|
18
27
|
|
|
19
28
|
## Quick start
|
|
20
29
|
|
|
30
|
+
```ts
|
|
31
|
+
import { Novence } from "@novence/sdk";
|
|
32
|
+
|
|
33
|
+
const client = new Novence({ apiKey: process.env.NOVENCE_API_KEY! });
|
|
34
|
+
const { project, url } = await client.projects.create({ name: "launch" });
|
|
35
|
+
await client.files.uploadDir(project.id, "./site");
|
|
36
|
+
await client.deployments.create(project.id);
|
|
37
|
+
|
|
38
|
+
console.log(url); // https://{suffix}.novence.ai
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
One HTML document (report, dashboard, artifact): `client.publishHtml({ html, title })` then poll `deployments.latest`. CLI: `npx novence deploy report.html`.
|
|
42
|
+
|
|
43
|
+
### Bootstrap + verify (email path)
|
|
44
|
+
|
|
45
|
+
When you need a key from email OTP instead of the CLI:
|
|
46
|
+
|
|
21
47
|
```ts
|
|
22
48
|
import { Novence, bootstrapAccount, verifyEmail } from "@novence/sdk";
|
|
23
49
|
|
|
@@ -36,6 +62,9 @@ await client.deployments.create(project.id);
|
|
|
36
62
|
console.log(url); // https://{suffix}.novence.ai
|
|
37
63
|
```
|
|
38
64
|
|
|
65
|
+
Or deploy anonymously from the SDK, then claim:
|
|
66
|
+
`createDemoAccount()` → ship → `claimAccount(apiKey, "you@example.com")`.
|
|
67
|
+
|
|
39
68
|
Deploys are asynchronous. Poll `deployments.latest` until it settles:
|
|
40
69
|
|
|
41
70
|
```ts
|
|
@@ -98,8 +127,8 @@ call at a different control plane — useful when running the API locally.
|
|
|
98
127
|
| `client.account` | `get` · `consoleKit` · `createSession` · `revokeSession` |
|
|
99
128
|
| `client.apiKeys` | `revoke` |
|
|
100
129
|
|
|
101
|
-
Standalone helpers for the pre-auth flow: `
|
|
102
|
-
`resendVerification`, `reissueApiKey`.
|
|
130
|
+
Standalone helpers for the pre-auth flow: `createDemoAccount`, `claimAccount`,
|
|
131
|
+
`bootstrapAccount`, `verifyEmail`, `resendVerification`, `reissueApiKey`.
|
|
103
132
|
|
|
104
133
|
## Identity checks
|
|
105
134
|
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -80,6 +80,13 @@ export interface ConfirmBatchResponse {
|
|
|
80
80
|
error: string;
|
|
81
81
|
}>;
|
|
82
82
|
}
|
|
83
|
+
export interface PublishHtmlResult {
|
|
84
|
+
url: string;
|
|
85
|
+
projectId: string;
|
|
86
|
+
project: Project | null;
|
|
87
|
+
deployment: Deployment;
|
|
88
|
+
created: boolean;
|
|
89
|
+
}
|
|
83
90
|
export type FormFieldType = "text" | "email" | "tel" | "url" | "textarea" | "number" | "select" | "checkbox" | "hidden";
|
|
84
91
|
export interface FormField {
|
|
85
92
|
name: string;
|
|
@@ -289,7 +296,22 @@ export declare class Novence {
|
|
|
289
296
|
latest: (projectId: string) => Promise<{
|
|
290
297
|
deployment: Deployment;
|
|
291
298
|
}>;
|
|
299
|
+
rollback: (projectId: string, opts?: {
|
|
300
|
+
deploymentId?: string;
|
|
301
|
+
}) => Promise<{
|
|
302
|
+
deployment: Deployment;
|
|
303
|
+
}>;
|
|
292
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* Write `/index.html` and deploy in one call. Omit `projectId` to create a
|
|
307
|
+
* project. Poll `deployments.latest` until live or failed.
|
|
308
|
+
*/
|
|
309
|
+
publishHtml(input: {
|
|
310
|
+
html: string;
|
|
311
|
+
title?: string;
|
|
312
|
+
projectId?: string;
|
|
313
|
+
force?: boolean;
|
|
314
|
+
}): Promise<PublishHtmlResult>;
|
|
293
315
|
domains: {
|
|
294
316
|
configure: (projectId: string, hostname: string) => Promise<DomainConfigureResult>;
|
|
295
317
|
status: (projectId: string) => Promise<DomainStatus>;
|
|
@@ -421,6 +443,22 @@ export declare function bootstrapAccount(email: string, baseUrl?: string): Promi
|
|
|
421
443
|
emailVerificationRequired?: boolean;
|
|
422
444
|
verificationCode?: string;
|
|
423
445
|
}>;
|
|
446
|
+
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
447
|
+
accountId: string;
|
|
448
|
+
apiKey: string;
|
|
449
|
+
plan: string;
|
|
450
|
+
anonymous: true;
|
|
451
|
+
emailVerificationRequired: true;
|
|
452
|
+
claim: string;
|
|
453
|
+
}>;
|
|
454
|
+
export declare function claimAccount(apiKey: string, email: string, baseUrl?: string): Promise<{
|
|
455
|
+
accountId: string;
|
|
456
|
+
email: string;
|
|
457
|
+
sent?: boolean;
|
|
458
|
+
emailVerificationRequired?: boolean;
|
|
459
|
+
alreadyVerified?: boolean;
|
|
460
|
+
verificationCode?: string;
|
|
461
|
+
}>;
|
|
424
462
|
export declare function verifyEmail(email: string, code: string, baseUrl?: string): Promise<{
|
|
425
463
|
accountId: string;
|
|
426
464
|
emailVerified: boolean;
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Novence = exports.NovenceError = exports.DEFAULT_BASE_URL = void 0;
|
|
4
4
|
exports.isNovenceClient = isNovenceClient;
|
|
5
5
|
exports.bootstrapAccount = bootstrapAccount;
|
|
6
|
+
exports.createDemoAccount = createDemoAccount;
|
|
7
|
+
exports.claimAccount = claimAccount;
|
|
6
8
|
exports.verifyEmail = verifyEmail;
|
|
7
9
|
exports.resendVerification = resendVerification;
|
|
8
10
|
exports.reissueApiKey = reissueApiKey;
|
|
@@ -171,7 +173,22 @@ class Novence {
|
|
|
171
173
|
deployments = {
|
|
172
174
|
create: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/deployments`, opts ?? {}),
|
|
173
175
|
latest: (projectId) => this.request("GET", `/v1/projects/${projectId}/deployments/latest`),
|
|
176
|
+
rollback: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/rollback`, opts ?? {}),
|
|
174
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* Write `/index.html` and deploy in one call. Omit `projectId` to create a
|
|
180
|
+
* project. Poll `deployments.latest` until live or failed.
|
|
181
|
+
*/
|
|
182
|
+
publishHtml(input) {
|
|
183
|
+
if (input.projectId) {
|
|
184
|
+
return this.request("POST", `/v1/projects/${input.projectId}/publish-html`, { html: input.html, title: input.title, force: input.force });
|
|
185
|
+
}
|
|
186
|
+
return this.request("POST", "/v1/publish-html", {
|
|
187
|
+
html: input.html,
|
|
188
|
+
title: input.title,
|
|
189
|
+
force: input.force,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
175
192
|
domains = {
|
|
176
193
|
configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
177
194
|
hostname,
|
|
@@ -264,6 +281,31 @@ async function bootstrapAccount(email, baseUrl) {
|
|
|
264
281
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
265
282
|
return data;
|
|
266
283
|
}
|
|
284
|
+
async function createDemoAccount(baseUrl) {
|
|
285
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
286
|
+
method: "POST",
|
|
287
|
+
headers: { "Content-Type": "application/json" },
|
|
288
|
+
body: JSON.stringify({}),
|
|
289
|
+
});
|
|
290
|
+
const data = (await res.json());
|
|
291
|
+
if (!res.ok)
|
|
292
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
293
|
+
return data;
|
|
294
|
+
}
|
|
295
|
+
async function claimAccount(apiKey, email, baseUrl) {
|
|
296
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/claim`, {
|
|
297
|
+
method: "POST",
|
|
298
|
+
headers: {
|
|
299
|
+
"Content-Type": "application/json",
|
|
300
|
+
Authorization: `Bearer ${apiKey}`,
|
|
301
|
+
},
|
|
302
|
+
body: JSON.stringify({ email }),
|
|
303
|
+
});
|
|
304
|
+
const data = (await res.json());
|
|
305
|
+
if (!res.ok)
|
|
306
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
307
|
+
return data;
|
|
308
|
+
}
|
|
267
309
|
async function verifyEmail(email, code, baseUrl) {
|
|
268
310
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/verify-email`, {
|
|
269
311
|
method: "POST",
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -80,6 +80,13 @@ export interface ConfirmBatchResponse {
|
|
|
80
80
|
error: string;
|
|
81
81
|
}>;
|
|
82
82
|
}
|
|
83
|
+
export interface PublishHtmlResult {
|
|
84
|
+
url: string;
|
|
85
|
+
projectId: string;
|
|
86
|
+
project: Project | null;
|
|
87
|
+
deployment: Deployment;
|
|
88
|
+
created: boolean;
|
|
89
|
+
}
|
|
83
90
|
export type FormFieldType = "text" | "email" | "tel" | "url" | "textarea" | "number" | "select" | "checkbox" | "hidden";
|
|
84
91
|
export interface FormField {
|
|
85
92
|
name: string;
|
|
@@ -289,7 +296,22 @@ export declare class Novence {
|
|
|
289
296
|
latest: (projectId: string) => Promise<{
|
|
290
297
|
deployment: Deployment;
|
|
291
298
|
}>;
|
|
299
|
+
rollback: (projectId: string, opts?: {
|
|
300
|
+
deploymentId?: string;
|
|
301
|
+
}) => Promise<{
|
|
302
|
+
deployment: Deployment;
|
|
303
|
+
}>;
|
|
292
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* Write `/index.html` and deploy in one call. Omit `projectId` to create a
|
|
307
|
+
* project. Poll `deployments.latest` until live or failed.
|
|
308
|
+
*/
|
|
309
|
+
publishHtml(input: {
|
|
310
|
+
html: string;
|
|
311
|
+
title?: string;
|
|
312
|
+
projectId?: string;
|
|
313
|
+
force?: boolean;
|
|
314
|
+
}): Promise<PublishHtmlResult>;
|
|
293
315
|
domains: {
|
|
294
316
|
configure: (projectId: string, hostname: string) => Promise<DomainConfigureResult>;
|
|
295
317
|
status: (projectId: string) => Promise<DomainStatus>;
|
|
@@ -421,6 +443,22 @@ export declare function bootstrapAccount(email: string, baseUrl?: string): Promi
|
|
|
421
443
|
emailVerificationRequired?: boolean;
|
|
422
444
|
verificationCode?: string;
|
|
423
445
|
}>;
|
|
446
|
+
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
447
|
+
accountId: string;
|
|
448
|
+
apiKey: string;
|
|
449
|
+
plan: string;
|
|
450
|
+
anonymous: true;
|
|
451
|
+
emailVerificationRequired: true;
|
|
452
|
+
claim: string;
|
|
453
|
+
}>;
|
|
454
|
+
export declare function claimAccount(apiKey: string, email: string, baseUrl?: string): Promise<{
|
|
455
|
+
accountId: string;
|
|
456
|
+
email: string;
|
|
457
|
+
sent?: boolean;
|
|
458
|
+
emailVerificationRequired?: boolean;
|
|
459
|
+
alreadyVerified?: boolean;
|
|
460
|
+
verificationCode?: string;
|
|
461
|
+
}>;
|
|
424
462
|
export declare function verifyEmail(email: string, code: string, baseUrl?: string): Promise<{
|
|
425
463
|
accountId: string;
|
|
426
464
|
emailVerified: boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -162,7 +162,22 @@ export class Novence {
|
|
|
162
162
|
deployments = {
|
|
163
163
|
create: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/deployments`, opts ?? {}),
|
|
164
164
|
latest: (projectId) => this.request("GET", `/v1/projects/${projectId}/deployments/latest`),
|
|
165
|
+
rollback: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/rollback`, opts ?? {}),
|
|
165
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Write `/index.html` and deploy in one call. Omit `projectId` to create a
|
|
169
|
+
* project. Poll `deployments.latest` until live or failed.
|
|
170
|
+
*/
|
|
171
|
+
publishHtml(input) {
|
|
172
|
+
if (input.projectId) {
|
|
173
|
+
return this.request("POST", `/v1/projects/${input.projectId}/publish-html`, { html: input.html, title: input.title, force: input.force });
|
|
174
|
+
}
|
|
175
|
+
return this.request("POST", "/v1/publish-html", {
|
|
176
|
+
html: input.html,
|
|
177
|
+
title: input.title,
|
|
178
|
+
force: input.force,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
166
181
|
domains = {
|
|
167
182
|
configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
168
183
|
hostname,
|
|
@@ -254,6 +269,31 @@ export async function bootstrapAccount(email, baseUrl) {
|
|
|
254
269
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
255
270
|
return data;
|
|
256
271
|
}
|
|
272
|
+
export async function createDemoAccount(baseUrl) {
|
|
273
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
274
|
+
method: "POST",
|
|
275
|
+
headers: { "Content-Type": "application/json" },
|
|
276
|
+
body: JSON.stringify({}),
|
|
277
|
+
});
|
|
278
|
+
const data = (await res.json());
|
|
279
|
+
if (!res.ok)
|
|
280
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
281
|
+
return data;
|
|
282
|
+
}
|
|
283
|
+
export async function claimAccount(apiKey, email, baseUrl) {
|
|
284
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/claim`, {
|
|
285
|
+
method: "POST",
|
|
286
|
+
headers: {
|
|
287
|
+
"Content-Type": "application/json",
|
|
288
|
+
Authorization: `Bearer ${apiKey}`,
|
|
289
|
+
},
|
|
290
|
+
body: JSON.stringify({ email }),
|
|
291
|
+
});
|
|
292
|
+
const data = (await res.json());
|
|
293
|
+
if (!res.ok)
|
|
294
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
295
|
+
return data;
|
|
296
|
+
}
|
|
257
297
|
export async function verifyEmail(email, code, baseUrl) {
|
|
258
298
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/verify-email`, {
|
|
259
299
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novence/sdk",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Official TypeScript SDK for Novence
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Official TypeScript SDK for Novence — 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",
|
|
7
7
|
"main": "./dist/cjs/index.js",
|
|
@@ -36,20 +36,24 @@
|
|
|
36
36
|
"edge",
|
|
37
37
|
"mcp",
|
|
38
38
|
"ai-agents",
|
|
39
|
+
"claude",
|
|
40
|
+
"cursor",
|
|
41
|
+
"mcp-server",
|
|
42
|
+
"static-hosting",
|
|
43
|
+
"netlify-alternative",
|
|
39
44
|
"lighthouse",
|
|
40
45
|
"axe"
|
|
41
46
|
],
|
|
42
47
|
"publishConfig": {
|
|
43
48
|
"access": "public"
|
|
44
49
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/fixup.mjs",
|
|
47
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
48
|
-
"prepublishOnly": "pnpm run build"
|
|
49
|
-
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.10.2",
|
|
52
52
|
"typescript": "^5.7.2"
|
|
53
53
|
},
|
|
54
|
-
"module": "./dist/esm/index.js"
|
|
55
|
-
|
|
54
|
+
"module": "./dist/esm/index.js",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/fixup.mjs",
|
|
57
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
58
|
+
}
|
|
59
|
+
}
|