@novence/sdk 0.2.2 → 0.2.3
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 +30 -3
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.js +27 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.js +25 -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,21 @@ 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
|
+
### Bootstrap + verify (email path)
|
|
42
|
+
|
|
43
|
+
When you need a key from email OTP instead of the CLI:
|
|
44
|
+
|
|
21
45
|
```ts
|
|
22
46
|
import { Novence, bootstrapAccount, verifyEmail } from "@novence/sdk";
|
|
23
47
|
|
|
@@ -36,6 +60,9 @@ await client.deployments.create(project.id);
|
|
|
36
60
|
console.log(url); // https://{suffix}.novence.ai
|
|
37
61
|
```
|
|
38
62
|
|
|
63
|
+
Or deploy anonymously from the SDK, then claim:
|
|
64
|
+
`createDemoAccount()` → ship → `claimAccount(apiKey, "you@example.com")`.
|
|
65
|
+
|
|
39
66
|
Deploys are asynchronous. Poll `deployments.latest` until it settles:
|
|
40
67
|
|
|
41
68
|
```ts
|
|
@@ -98,8 +125,8 @@ call at a different control plane — useful when running the API locally.
|
|
|
98
125
|
| `client.account` | `get` · `consoleKit` · `createSession` · `revokeSession` |
|
|
99
126
|
| `client.apiKeys` | `revoke` |
|
|
100
127
|
|
|
101
|
-
Standalone helpers for the pre-auth flow: `
|
|
102
|
-
`resendVerification`, `reissueApiKey`.
|
|
128
|
+
Standalone helpers for the pre-auth flow: `createDemoAccount`, `claimAccount`,
|
|
129
|
+
`bootstrapAccount`, `verifyEmail`, `resendVerification`, `reissueApiKey`.
|
|
103
130
|
|
|
104
131
|
## Identity checks
|
|
105
132
|
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -421,6 +421,22 @@ export declare function bootstrapAccount(email: string, baseUrl?: string): Promi
|
|
|
421
421
|
emailVerificationRequired?: boolean;
|
|
422
422
|
verificationCode?: string;
|
|
423
423
|
}>;
|
|
424
|
+
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
425
|
+
accountId: string;
|
|
426
|
+
apiKey: string;
|
|
427
|
+
plan: string;
|
|
428
|
+
anonymous: true;
|
|
429
|
+
emailVerificationRequired: true;
|
|
430
|
+
claim: string;
|
|
431
|
+
}>;
|
|
432
|
+
export declare function claimAccount(apiKey: string, email: string, baseUrl?: string): Promise<{
|
|
433
|
+
accountId: string;
|
|
434
|
+
email: string;
|
|
435
|
+
sent?: boolean;
|
|
436
|
+
emailVerificationRequired?: boolean;
|
|
437
|
+
alreadyVerified?: boolean;
|
|
438
|
+
verificationCode?: string;
|
|
439
|
+
}>;
|
|
424
440
|
export declare function verifyEmail(email: string, code: string, baseUrl?: string): Promise<{
|
|
425
441
|
accountId: string;
|
|
426
442
|
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;
|
|
@@ -264,6 +266,31 @@ async function bootstrapAccount(email, baseUrl) {
|
|
|
264
266
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
265
267
|
return data;
|
|
266
268
|
}
|
|
269
|
+
async function createDemoAccount(baseUrl) {
|
|
270
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
271
|
+
method: "POST",
|
|
272
|
+
headers: { "Content-Type": "application/json" },
|
|
273
|
+
body: JSON.stringify({}),
|
|
274
|
+
});
|
|
275
|
+
const data = (await res.json());
|
|
276
|
+
if (!res.ok)
|
|
277
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
278
|
+
return data;
|
|
279
|
+
}
|
|
280
|
+
async function claimAccount(apiKey, email, baseUrl) {
|
|
281
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/claim`, {
|
|
282
|
+
method: "POST",
|
|
283
|
+
headers: {
|
|
284
|
+
"Content-Type": "application/json",
|
|
285
|
+
Authorization: `Bearer ${apiKey}`,
|
|
286
|
+
},
|
|
287
|
+
body: JSON.stringify({ email }),
|
|
288
|
+
});
|
|
289
|
+
const data = (await res.json());
|
|
290
|
+
if (!res.ok)
|
|
291
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
292
|
+
return data;
|
|
293
|
+
}
|
|
267
294
|
async function verifyEmail(email, code, baseUrl) {
|
|
268
295
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/verify-email`, {
|
|
269
296
|
method: "POST",
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -421,6 +421,22 @@ export declare function bootstrapAccount(email: string, baseUrl?: string): Promi
|
|
|
421
421
|
emailVerificationRequired?: boolean;
|
|
422
422
|
verificationCode?: string;
|
|
423
423
|
}>;
|
|
424
|
+
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
425
|
+
accountId: string;
|
|
426
|
+
apiKey: string;
|
|
427
|
+
plan: string;
|
|
428
|
+
anonymous: true;
|
|
429
|
+
emailVerificationRequired: true;
|
|
430
|
+
claim: string;
|
|
431
|
+
}>;
|
|
432
|
+
export declare function claimAccount(apiKey: string, email: string, baseUrl?: string): Promise<{
|
|
433
|
+
accountId: string;
|
|
434
|
+
email: string;
|
|
435
|
+
sent?: boolean;
|
|
436
|
+
emailVerificationRequired?: boolean;
|
|
437
|
+
alreadyVerified?: boolean;
|
|
438
|
+
verificationCode?: string;
|
|
439
|
+
}>;
|
|
424
440
|
export declare function verifyEmail(email: string, code: string, baseUrl?: string): Promise<{
|
|
425
441
|
accountId: string;
|
|
426
442
|
emailVerified: boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -254,6 +254,31 @@ export async function bootstrapAccount(email, baseUrl) {
|
|
|
254
254
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
255
255
|
return data;
|
|
256
256
|
}
|
|
257
|
+
export async function createDemoAccount(baseUrl) {
|
|
258
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
259
|
+
method: "POST",
|
|
260
|
+
headers: { "Content-Type": "application/json" },
|
|
261
|
+
body: JSON.stringify({}),
|
|
262
|
+
});
|
|
263
|
+
const data = (await res.json());
|
|
264
|
+
if (!res.ok)
|
|
265
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
266
|
+
return data;
|
|
267
|
+
}
|
|
268
|
+
export async function claimAccount(apiKey, email, baseUrl) {
|
|
269
|
+
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/claim`, {
|
|
270
|
+
method: "POST",
|
|
271
|
+
headers: {
|
|
272
|
+
"Content-Type": "application/json",
|
|
273
|
+
Authorization: `Bearer ${apiKey}`,
|
|
274
|
+
},
|
|
275
|
+
body: JSON.stringify({ email }),
|
|
276
|
+
});
|
|
277
|
+
const data = (await res.json());
|
|
278
|
+
if (!res.ok)
|
|
279
|
+
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
280
|
+
return data;
|
|
281
|
+
}
|
|
257
282
|
export async function verifyEmail(email, code, baseUrl) {
|
|
258
283
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/auth/verify-email`, {
|
|
259
284
|
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.3",
|
|
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
|
+
}
|