@novence/sdk 0.2.5 → 0.2.6
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 +1 -1
- package/dist/cjs/index.d.ts +74 -3
- package/dist/cjs/index.js +42 -7
- package/dist/esm/index.d.ts +74 -3
- package/dist/esm/index.js +42 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ call at a different control plane — useful when running the API locally.
|
|
|
118
118
|
|
|
119
119
|
| Namespace | Methods |
|
|
120
120
|
| --- | --- |
|
|
121
|
-
| `client.projects` | `create` · `list` · `get` · `update` · `usage` · `analytics` |
|
|
121
|
+
| `client.projects` | `create` · `list` · `get` · `update` · `usage` · `analytics` · `brief` · `putBrief` · `events` |
|
|
122
122
|
| `client.files` | `uploadDir` · `uploadBuffer` · `getUploadUrl` · `getUploadUrlsBatch` · `confirm` · `confirmBatch` |
|
|
123
123
|
| `client.deployments` | `create` · `latest` |
|
|
124
124
|
| `client.domains` | `configure` · `status` |
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ export interface Project {
|
|
|
32
32
|
customDomain?: string | null;
|
|
33
33
|
customDomainStatus?: string;
|
|
34
34
|
analyticsEnabled?: boolean;
|
|
35
|
+
shareGateEmails?: string[];
|
|
36
|
+
siteMcp?: "off" | "read" | "forms";
|
|
37
|
+
dataEditEmails?: string[];
|
|
38
|
+
dataEditNames?: string[];
|
|
39
|
+
dataEditPath?: string;
|
|
35
40
|
createdAt?: string;
|
|
36
41
|
updatedAt?: string;
|
|
37
42
|
}
|
|
@@ -180,6 +185,14 @@ export interface Analytics {
|
|
|
180
185
|
pageviews: number;
|
|
181
186
|
}>;
|
|
182
187
|
}
|
|
188
|
+
export interface SiteDataResult {
|
|
189
|
+
name: string;
|
|
190
|
+
path: string;
|
|
191
|
+
bytes: number;
|
|
192
|
+
json?: unknown;
|
|
193
|
+
url: string;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
183
196
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
184
197
|
export interface DomainConfigureResult {
|
|
185
198
|
hosts?: string[];
|
|
@@ -191,6 +204,7 @@ export interface DomainConfigureResult {
|
|
|
191
204
|
maxRecords?: number;
|
|
192
205
|
cnameTarget?: string;
|
|
193
206
|
records?: Array<Record<string, unknown>>;
|
|
207
|
+
apexOptions?: Array<Record<string, unknown>>;
|
|
194
208
|
[key: string]: unknown;
|
|
195
209
|
};
|
|
196
210
|
[key: string]: unknown;
|
|
@@ -198,7 +212,14 @@ export interface DomainConfigureResult {
|
|
|
198
212
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
199
213
|
export interface DomainStatus {
|
|
200
214
|
hostname?: string | null;
|
|
215
|
+
customDomain?: string | null;
|
|
216
|
+
customDomainStatus?: string;
|
|
201
217
|
status?: string;
|
|
218
|
+
dns?: {
|
|
219
|
+
www?: "ok" | "missing" | "skipped";
|
|
220
|
+
apex?: "present" | "missing" | "skipped";
|
|
221
|
+
next?: string | null;
|
|
222
|
+
};
|
|
202
223
|
[key: string]: unknown;
|
|
203
224
|
}
|
|
204
225
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
@@ -247,6 +268,11 @@ export declare class Novence {
|
|
|
247
268
|
description?: string;
|
|
248
269
|
checkThresholds?: Record<string, unknown>;
|
|
249
270
|
analyticsEnabled?: boolean;
|
|
271
|
+
shareGateEmails?: string[];
|
|
272
|
+
siteMcp?: "off" | "read" | "forms";
|
|
273
|
+
dataEditEmails?: string[];
|
|
274
|
+
dataEditNames?: string[];
|
|
275
|
+
dataEditPath?: string;
|
|
250
276
|
}) => Promise<{
|
|
251
277
|
project: Project;
|
|
252
278
|
}>;
|
|
@@ -263,6 +289,30 @@ export declare class Novence {
|
|
|
263
289
|
from?: string;
|
|
264
290
|
to?: string;
|
|
265
291
|
}) => Promise<Analytics>;
|
|
292
|
+
brief: (id: string) => Promise<{
|
|
293
|
+
projectId: string;
|
|
294
|
+
brief: string | null;
|
|
295
|
+
updatedAt: string | null;
|
|
296
|
+
}>;
|
|
297
|
+
putBrief: (id: string, brief: string) => Promise<{
|
|
298
|
+
projectId: string;
|
|
299
|
+
brief: string | null;
|
|
300
|
+
updatedAt: string | null;
|
|
301
|
+
}>;
|
|
302
|
+
events: (id: string, opts?: {
|
|
303
|
+
since?: string;
|
|
304
|
+
limit?: number;
|
|
305
|
+
}) => Promise<{
|
|
306
|
+
projectId: string;
|
|
307
|
+
since: string;
|
|
308
|
+
limit: number;
|
|
309
|
+
events: Array<{
|
|
310
|
+
id: string;
|
|
311
|
+
type: string;
|
|
312
|
+
payload: Record<string, unknown>;
|
|
313
|
+
createdAt: string;
|
|
314
|
+
}>;
|
|
315
|
+
}>;
|
|
266
316
|
};
|
|
267
317
|
files: {
|
|
268
318
|
getUploadUrl: (projectId: string, path: string, contentType?: string) => Promise<UploadPresign>;
|
|
@@ -313,9 +363,16 @@ export declare class Novence {
|
|
|
313
363
|
force?: boolean;
|
|
314
364
|
}): Promise<PublishHtmlResult>;
|
|
315
365
|
domains: {
|
|
316
|
-
configure: (projectId: string, hostname: string
|
|
366
|
+
configure: (projectId: string, hostname: string, input?: {
|
|
367
|
+
primary?: "www" | "apex";
|
|
368
|
+
redirect?: boolean;
|
|
369
|
+
}) => Promise<DomainConfigureResult>;
|
|
317
370
|
status: (projectId: string) => Promise<DomainStatus>;
|
|
318
371
|
};
|
|
372
|
+
data: {
|
|
373
|
+
put: (projectId: string, name: string, json: unknown) => Promise<SiteDataResult>;
|
|
374
|
+
get: (projectId: string, name: string) => Promise<SiteDataResult>;
|
|
375
|
+
};
|
|
319
376
|
forms: {
|
|
320
377
|
create: (projectId: string, input: {
|
|
321
378
|
name: string;
|
|
@@ -436,14 +493,28 @@ export declare class Novence {
|
|
|
436
493
|
}>;
|
|
437
494
|
};
|
|
438
495
|
}
|
|
439
|
-
export
|
|
496
|
+
export interface SignupAttributionInput {
|
|
497
|
+
method?: "web" | "mcp" | "cli" | "sdk" | "api";
|
|
498
|
+
client?: string;
|
|
499
|
+
source?: string;
|
|
500
|
+
medium?: string;
|
|
501
|
+
campaign?: string;
|
|
502
|
+
content?: string;
|
|
503
|
+
term?: string;
|
|
504
|
+
gclid?: string;
|
|
505
|
+
referrer?: string;
|
|
506
|
+
landing?: string;
|
|
507
|
+
gaClientId?: string;
|
|
508
|
+
gaSessionId?: string;
|
|
509
|
+
}
|
|
510
|
+
export declare function bootstrapAccount(email: string, baseUrl?: string, attribution?: SignupAttributionInput): Promise<{
|
|
440
511
|
accountId: string;
|
|
441
512
|
apiKey: string;
|
|
442
513
|
plan: string;
|
|
443
514
|
emailVerificationRequired?: boolean;
|
|
444
515
|
verificationCode?: string;
|
|
445
516
|
}>;
|
|
446
|
-
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
517
|
+
export declare function createDemoAccount(baseUrl?: string, attribution?: SignupAttributionInput): Promise<{
|
|
447
518
|
accountId: string;
|
|
448
519
|
apiKey: string;
|
|
449
520
|
plan: string;
|
package/dist/cjs/index.js
CHANGED
|
@@ -116,6 +116,17 @@ class Novence {
|
|
|
116
116
|
const qs = q.toString();
|
|
117
117
|
return this.request("GET", `/v1/projects/${id}/analytics${qs ? `?${qs}` : ""}`);
|
|
118
118
|
},
|
|
119
|
+
brief: (id) => this.request("GET", `/v1/projects/${id}/brief`),
|
|
120
|
+
putBrief: (id, brief) => this.request("PUT", `/v1/projects/${id}/brief`, { brief }),
|
|
121
|
+
events: (id, opts) => {
|
|
122
|
+
const q = new URLSearchParams();
|
|
123
|
+
if (opts?.since)
|
|
124
|
+
q.set("since", opts.since);
|
|
125
|
+
if (opts?.limit !== undefined)
|
|
126
|
+
q.set("limit", String(opts.limit));
|
|
127
|
+
const qs = q.toString();
|
|
128
|
+
return this.request("GET", `/v1/projects/${id}/events${qs ? `?${qs}` : ""}`);
|
|
129
|
+
},
|
|
119
130
|
};
|
|
120
131
|
files = {
|
|
121
132
|
getUploadUrl: (projectId, path, contentType) => this.request("POST", `/v1/projects/${projectId}/uploads`, {
|
|
@@ -192,11 +203,16 @@ class Novence {
|
|
|
192
203
|
});
|
|
193
204
|
}
|
|
194
205
|
domains = {
|
|
195
|
-
configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
206
|
+
configure: (projectId, hostname, input) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
196
207
|
hostname,
|
|
208
|
+
...input,
|
|
197
209
|
}),
|
|
198
210
|
status: (projectId) => this.request("GET", `/v1/projects/${projectId}/domains`),
|
|
199
211
|
};
|
|
212
|
+
data = {
|
|
213
|
+
put: (projectId, name, json) => this.request("PUT", `/v1/projects/${projectId}/data/${encodeURIComponent(name)}`, json),
|
|
214
|
+
get: (projectId, name) => this.request("GET", `/v1/projects/${projectId}/data/${encodeURIComponent(name)}`),
|
|
215
|
+
};
|
|
200
216
|
forms = {
|
|
201
217
|
create: (projectId, input) => this.request("POST", `/v1/projects/${projectId}/forms`, input),
|
|
202
218
|
list: (projectId) => this.request("GET", `/v1/projects/${projectId}/forms`),
|
|
@@ -272,24 +288,43 @@ class Novence {
|
|
|
272
288
|
};
|
|
273
289
|
}
|
|
274
290
|
exports.Novence = Novence;
|
|
275
|
-
|
|
291
|
+
function withMethod(attribution, method) {
|
|
292
|
+
return { ...attribution, method: attribution?.method ?? method };
|
|
293
|
+
}
|
|
294
|
+
/** Gateway 502s are HTML. Parsing them as JSON hides the status. */
|
|
295
|
+
async function readErrorBody(res) {
|
|
296
|
+
const text = await res.text();
|
|
297
|
+
if (!text)
|
|
298
|
+
return {};
|
|
299
|
+
try {
|
|
300
|
+
const parsed = JSON.parse(text);
|
|
301
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
302
|
+
return parsed;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
return {};
|
|
307
|
+
}
|
|
308
|
+
return {};
|
|
309
|
+
}
|
|
310
|
+
async function bootstrapAccount(email, baseUrl, attribution) {
|
|
276
311
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/bootstrap`, {
|
|
277
312
|
method: "POST",
|
|
278
313
|
headers: { "Content-Type": "application/json" },
|
|
279
|
-
body: JSON.stringify({ email }),
|
|
314
|
+
body: JSON.stringify({ email, attribution: withMethod(attribution, "sdk") }),
|
|
280
315
|
});
|
|
281
|
-
const data = (await res
|
|
316
|
+
const data = (await readErrorBody(res));
|
|
282
317
|
if (!res.ok)
|
|
283
318
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
284
319
|
return data;
|
|
285
320
|
}
|
|
286
|
-
async function createDemoAccount(baseUrl) {
|
|
321
|
+
async function createDemoAccount(baseUrl, attribution) {
|
|
287
322
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
288
323
|
method: "POST",
|
|
289
324
|
headers: { "Content-Type": "application/json" },
|
|
290
|
-
body: JSON.stringify({}),
|
|
325
|
+
body: JSON.stringify({ attribution: withMethod(attribution, "sdk") }),
|
|
291
326
|
});
|
|
292
|
-
const data = (await res
|
|
327
|
+
const data = (await readErrorBody(res));
|
|
293
328
|
if (!res.ok)
|
|
294
329
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
295
330
|
return data;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ export interface Project {
|
|
|
32
32
|
customDomain?: string | null;
|
|
33
33
|
customDomainStatus?: string;
|
|
34
34
|
analyticsEnabled?: boolean;
|
|
35
|
+
shareGateEmails?: string[];
|
|
36
|
+
siteMcp?: "off" | "read" | "forms";
|
|
37
|
+
dataEditEmails?: string[];
|
|
38
|
+
dataEditNames?: string[];
|
|
39
|
+
dataEditPath?: string;
|
|
35
40
|
createdAt?: string;
|
|
36
41
|
updatedAt?: string;
|
|
37
42
|
}
|
|
@@ -180,6 +185,14 @@ export interface Analytics {
|
|
|
180
185
|
pageviews: number;
|
|
181
186
|
}>;
|
|
182
187
|
}
|
|
188
|
+
export interface SiteDataResult {
|
|
189
|
+
name: string;
|
|
190
|
+
path: string;
|
|
191
|
+
bytes: number;
|
|
192
|
+
json?: unknown;
|
|
193
|
+
url: string;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
183
196
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
184
197
|
export interface DomainConfigureResult {
|
|
185
198
|
hosts?: string[];
|
|
@@ -191,6 +204,7 @@ export interface DomainConfigureResult {
|
|
|
191
204
|
maxRecords?: number;
|
|
192
205
|
cnameTarget?: string;
|
|
193
206
|
records?: Array<Record<string, unknown>>;
|
|
207
|
+
apexOptions?: Array<Record<string, unknown>>;
|
|
194
208
|
[key: string]: unknown;
|
|
195
209
|
};
|
|
196
210
|
[key: string]: unknown;
|
|
@@ -198,7 +212,14 @@ export interface DomainConfigureResult {
|
|
|
198
212
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
199
213
|
export interface DomainStatus {
|
|
200
214
|
hostname?: string | null;
|
|
215
|
+
customDomain?: string | null;
|
|
216
|
+
customDomainStatus?: string;
|
|
201
217
|
status?: string;
|
|
218
|
+
dns?: {
|
|
219
|
+
www?: "ok" | "missing" | "skipped";
|
|
220
|
+
apex?: "present" | "missing" | "skipped";
|
|
221
|
+
next?: string | null;
|
|
222
|
+
};
|
|
202
223
|
[key: string]: unknown;
|
|
203
224
|
}
|
|
204
225
|
/** Not schematised in openapi.yaml — known fields only. */
|
|
@@ -247,6 +268,11 @@ export declare class Novence {
|
|
|
247
268
|
description?: string;
|
|
248
269
|
checkThresholds?: Record<string, unknown>;
|
|
249
270
|
analyticsEnabled?: boolean;
|
|
271
|
+
shareGateEmails?: string[];
|
|
272
|
+
siteMcp?: "off" | "read" | "forms";
|
|
273
|
+
dataEditEmails?: string[];
|
|
274
|
+
dataEditNames?: string[];
|
|
275
|
+
dataEditPath?: string;
|
|
250
276
|
}) => Promise<{
|
|
251
277
|
project: Project;
|
|
252
278
|
}>;
|
|
@@ -263,6 +289,30 @@ export declare class Novence {
|
|
|
263
289
|
from?: string;
|
|
264
290
|
to?: string;
|
|
265
291
|
}) => Promise<Analytics>;
|
|
292
|
+
brief: (id: string) => Promise<{
|
|
293
|
+
projectId: string;
|
|
294
|
+
brief: string | null;
|
|
295
|
+
updatedAt: string | null;
|
|
296
|
+
}>;
|
|
297
|
+
putBrief: (id: string, brief: string) => Promise<{
|
|
298
|
+
projectId: string;
|
|
299
|
+
brief: string | null;
|
|
300
|
+
updatedAt: string | null;
|
|
301
|
+
}>;
|
|
302
|
+
events: (id: string, opts?: {
|
|
303
|
+
since?: string;
|
|
304
|
+
limit?: number;
|
|
305
|
+
}) => Promise<{
|
|
306
|
+
projectId: string;
|
|
307
|
+
since: string;
|
|
308
|
+
limit: number;
|
|
309
|
+
events: Array<{
|
|
310
|
+
id: string;
|
|
311
|
+
type: string;
|
|
312
|
+
payload: Record<string, unknown>;
|
|
313
|
+
createdAt: string;
|
|
314
|
+
}>;
|
|
315
|
+
}>;
|
|
266
316
|
};
|
|
267
317
|
files: {
|
|
268
318
|
getUploadUrl: (projectId: string, path: string, contentType?: string) => Promise<UploadPresign>;
|
|
@@ -313,9 +363,16 @@ export declare class Novence {
|
|
|
313
363
|
force?: boolean;
|
|
314
364
|
}): Promise<PublishHtmlResult>;
|
|
315
365
|
domains: {
|
|
316
|
-
configure: (projectId: string, hostname: string
|
|
366
|
+
configure: (projectId: string, hostname: string, input?: {
|
|
367
|
+
primary?: "www" | "apex";
|
|
368
|
+
redirect?: boolean;
|
|
369
|
+
}) => Promise<DomainConfigureResult>;
|
|
317
370
|
status: (projectId: string) => Promise<DomainStatus>;
|
|
318
371
|
};
|
|
372
|
+
data: {
|
|
373
|
+
put: (projectId: string, name: string, json: unknown) => Promise<SiteDataResult>;
|
|
374
|
+
get: (projectId: string, name: string) => Promise<SiteDataResult>;
|
|
375
|
+
};
|
|
319
376
|
forms: {
|
|
320
377
|
create: (projectId: string, input: {
|
|
321
378
|
name: string;
|
|
@@ -436,14 +493,28 @@ export declare class Novence {
|
|
|
436
493
|
}>;
|
|
437
494
|
};
|
|
438
495
|
}
|
|
439
|
-
export
|
|
496
|
+
export interface SignupAttributionInput {
|
|
497
|
+
method?: "web" | "mcp" | "cli" | "sdk" | "api";
|
|
498
|
+
client?: string;
|
|
499
|
+
source?: string;
|
|
500
|
+
medium?: string;
|
|
501
|
+
campaign?: string;
|
|
502
|
+
content?: string;
|
|
503
|
+
term?: string;
|
|
504
|
+
gclid?: string;
|
|
505
|
+
referrer?: string;
|
|
506
|
+
landing?: string;
|
|
507
|
+
gaClientId?: string;
|
|
508
|
+
gaSessionId?: string;
|
|
509
|
+
}
|
|
510
|
+
export declare function bootstrapAccount(email: string, baseUrl?: string, attribution?: SignupAttributionInput): Promise<{
|
|
440
511
|
accountId: string;
|
|
441
512
|
apiKey: string;
|
|
442
513
|
plan: string;
|
|
443
514
|
emailVerificationRequired?: boolean;
|
|
444
515
|
verificationCode?: string;
|
|
445
516
|
}>;
|
|
446
|
-
export declare function createDemoAccount(baseUrl?: string): Promise<{
|
|
517
|
+
export declare function createDemoAccount(baseUrl?: string, attribution?: SignupAttributionInput): Promise<{
|
|
447
518
|
accountId: string;
|
|
448
519
|
apiKey: string;
|
|
449
520
|
plan: string;
|
package/dist/esm/index.js
CHANGED
|
@@ -105,6 +105,17 @@ export class Novence {
|
|
|
105
105
|
const qs = q.toString();
|
|
106
106
|
return this.request("GET", `/v1/projects/${id}/analytics${qs ? `?${qs}` : ""}`);
|
|
107
107
|
},
|
|
108
|
+
brief: (id) => this.request("GET", `/v1/projects/${id}/brief`),
|
|
109
|
+
putBrief: (id, brief) => this.request("PUT", `/v1/projects/${id}/brief`, { brief }),
|
|
110
|
+
events: (id, opts) => {
|
|
111
|
+
const q = new URLSearchParams();
|
|
112
|
+
if (opts?.since)
|
|
113
|
+
q.set("since", opts.since);
|
|
114
|
+
if (opts?.limit !== undefined)
|
|
115
|
+
q.set("limit", String(opts.limit));
|
|
116
|
+
const qs = q.toString();
|
|
117
|
+
return this.request("GET", `/v1/projects/${id}/events${qs ? `?${qs}` : ""}`);
|
|
118
|
+
},
|
|
108
119
|
};
|
|
109
120
|
files = {
|
|
110
121
|
getUploadUrl: (projectId, path, contentType) => this.request("POST", `/v1/projects/${projectId}/uploads`, {
|
|
@@ -181,11 +192,16 @@ export class Novence {
|
|
|
181
192
|
});
|
|
182
193
|
}
|
|
183
194
|
domains = {
|
|
184
|
-
configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
195
|
+
configure: (projectId, hostname, input) => this.request("POST", `/v1/projects/${projectId}/domains`, {
|
|
185
196
|
hostname,
|
|
197
|
+
...input,
|
|
186
198
|
}),
|
|
187
199
|
status: (projectId) => this.request("GET", `/v1/projects/${projectId}/domains`),
|
|
188
200
|
};
|
|
201
|
+
data = {
|
|
202
|
+
put: (projectId, name, json) => this.request("PUT", `/v1/projects/${projectId}/data/${encodeURIComponent(name)}`, json),
|
|
203
|
+
get: (projectId, name) => this.request("GET", `/v1/projects/${projectId}/data/${encodeURIComponent(name)}`),
|
|
204
|
+
};
|
|
189
205
|
forms = {
|
|
190
206
|
create: (projectId, input) => this.request("POST", `/v1/projects/${projectId}/forms`, input),
|
|
191
207
|
list: (projectId) => this.request("GET", `/v1/projects/${projectId}/forms`),
|
|
@@ -260,24 +276,43 @@ export class Novence {
|
|
|
260
276
|
revoke: (id, opts = {}) => this.request("DELETE", `/v1/api-keys/${id}${opts.force ? "?force=true" : ""}`),
|
|
261
277
|
};
|
|
262
278
|
}
|
|
263
|
-
|
|
279
|
+
function withMethod(attribution, method) {
|
|
280
|
+
return { ...attribution, method: attribution?.method ?? method };
|
|
281
|
+
}
|
|
282
|
+
/** Gateway 502s are HTML. Parsing them as JSON hides the status. */
|
|
283
|
+
async function readErrorBody(res) {
|
|
284
|
+
const text = await res.text();
|
|
285
|
+
if (!text)
|
|
286
|
+
return {};
|
|
287
|
+
try {
|
|
288
|
+
const parsed = JSON.parse(text);
|
|
289
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
290
|
+
return parsed;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return {};
|
|
295
|
+
}
|
|
296
|
+
return {};
|
|
297
|
+
}
|
|
298
|
+
export async function bootstrapAccount(email, baseUrl, attribution) {
|
|
264
299
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/bootstrap`, {
|
|
265
300
|
method: "POST",
|
|
266
301
|
headers: { "Content-Type": "application/json" },
|
|
267
|
-
body: JSON.stringify({ email }),
|
|
302
|
+
body: JSON.stringify({ email, attribution: withMethod(attribution, "sdk") }),
|
|
268
303
|
});
|
|
269
|
-
const data = (await res
|
|
304
|
+
const data = (await readErrorBody(res));
|
|
270
305
|
if (!res.ok)
|
|
271
306
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
272
307
|
return data;
|
|
273
308
|
}
|
|
274
|
-
export async function createDemoAccount(baseUrl) {
|
|
309
|
+
export async function createDemoAccount(baseUrl, attribution) {
|
|
275
310
|
const res = await fetch(`${resolveBaseUrl(baseUrl)}/v1/demo`, {
|
|
276
311
|
method: "POST",
|
|
277
312
|
headers: { "Content-Type": "application/json" },
|
|
278
|
-
body: JSON.stringify({}),
|
|
313
|
+
body: JSON.stringify({ attribution: withMethod(attribution, "sdk") }),
|
|
279
314
|
});
|
|
280
|
-
const data = (await res
|
|
315
|
+
const data = (await readErrorBody(res));
|
|
281
316
|
if (!res.ok)
|
|
282
317
|
throw new NovenceError(data.error ?? `HTTP ${res.status}`, res.status);
|
|
283
318
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novence/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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",
|