@novence/sdk 0.2.3 → 0.2.5

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 CHANGED
@@ -38,6 +38,8 @@ await client.deployments.create(project.id);
38
38
  console.log(url); // https://{suffix}.novence.ai
39
39
  ```
40
40
 
41
+ One HTML document (report, dashboard, artifact): `client.publishHtml({ html, title })` then poll `deployments.latest`. CLI: `npx novence deploy report.html`.
42
+
41
43
  ### Bootstrap + verify (email path)
42
44
 
43
45
  When you need a key from email OTP instead of the CLI:
@@ -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>;
package/dist/cjs/index.js CHANGED
@@ -160,7 +160,9 @@ class Novence {
160
160
  const uploaded = [];
161
161
  for (const full of walk(dir)) {
162
162
  const rel = "/" + (0, node_path_1.relative)(dir, full).split("\\").join("/");
163
- const contentType = MIME_BY_EXT[(0, node_path_1.extname)(full).toLowerCase()];
163
+ const contentType = rel === "/_redirects" || rel === "/_redirects.txt"
164
+ ? "text/plain; charset=utf-8"
165
+ : MIME_BY_EXT[(0, node_path_1.extname)(full).toLowerCase()];
164
166
  if (!contentType)
165
167
  continue;
166
168
  const body = (0, node_fs_1.readFileSync)(full);
@@ -173,7 +175,22 @@ class Novence {
173
175
  deployments = {
174
176
  create: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/deployments`, opts ?? {}),
175
177
  latest: (projectId) => this.request("GET", `/v1/projects/${projectId}/deployments/latest`),
178
+ rollback: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/rollback`, opts ?? {}),
176
179
  };
180
+ /**
181
+ * Write `/index.html` and deploy in one call. Omit `projectId` to create a
182
+ * project. Poll `deployments.latest` until live or failed.
183
+ */
184
+ publishHtml(input) {
185
+ if (input.projectId) {
186
+ return this.request("POST", `/v1/projects/${input.projectId}/publish-html`, { html: input.html, title: input.title, force: input.force });
187
+ }
188
+ return this.request("POST", "/v1/publish-html", {
189
+ html: input.html,
190
+ title: input.title,
191
+ force: input.force,
192
+ });
193
+ }
177
194
  domains = {
178
195
  configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
179
196
  hostname,
@@ -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>;
package/dist/esm/index.js CHANGED
@@ -149,7 +149,9 @@ export class Novence {
149
149
  const uploaded = [];
150
150
  for (const full of walk(dir)) {
151
151
  const rel = "/" + relative(dir, full).split("\\").join("/");
152
- const contentType = MIME_BY_EXT[extname(full).toLowerCase()];
152
+ const contentType = rel === "/_redirects" || rel === "/_redirects.txt"
153
+ ? "text/plain; charset=utf-8"
154
+ : MIME_BY_EXT[extname(full).toLowerCase()];
153
155
  if (!contentType)
154
156
  continue;
155
157
  const body = readFileSync(full);
@@ -162,7 +164,22 @@ export class Novence {
162
164
  deployments = {
163
165
  create: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/deployments`, opts ?? {}),
164
166
  latest: (projectId) => this.request("GET", `/v1/projects/${projectId}/deployments/latest`),
167
+ rollback: (projectId, opts) => this.request("POST", `/v1/projects/${projectId}/rollback`, opts ?? {}),
165
168
  };
169
+ /**
170
+ * Write `/index.html` and deploy in one call. Omit `projectId` to create a
171
+ * project. Poll `deployments.latest` until live or failed.
172
+ */
173
+ publishHtml(input) {
174
+ if (input.projectId) {
175
+ return this.request("POST", `/v1/projects/${input.projectId}/publish-html`, { html: input.html, title: input.title, force: input.force });
176
+ }
177
+ return this.request("POST", "/v1/publish-html", {
178
+ html: input.html,
179
+ title: input.title,
180
+ force: input.force,
181
+ });
182
+ }
166
183
  domains = {
167
184
  configure: (projectId, hostname) => this.request("POST", `/v1/projects/${projectId}/domains`, {
168
185
  hostname,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novence/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
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",