needle-cloud 2.10.0 → 2.11.0

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/dist/cli.esm.js CHANGED
@@ -1 +1 @@
1
- import"node-fetch";import"@web-std/file";import"node:crypto";export{p as program}from"./cli-ff9cbc77.js";import"fs";import"dotenv";import"ora";import"commander";import"child_process";import"open";import"path";import"node:fs";import"node:fs/promises";import"node:os";import"node:path";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:console";import"node:readline/promises";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"node:child_process";import"minimatch";import"node:url";import"node:util";import"body-parser";import"node:timers/promises";
1
+ import"node-fetch";import"@web-std/file";import"node:crypto";export{p as program}from"./cli-05c1463b.js";import"fs";import"dotenv";import"ora";import"commander";import"child_process";import"open";import"path";import"node:fs";import"node:fs/promises";import"node:os";import"node:path";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:console";import"node:readline/promises";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"node:child_process";import"minimatch";import"node:url";import"node:util";import"body-parser";import"node:timers/promises";
@@ -1 +1 @@
1
- import{existsSync as o,readdirSync as t,statSync as r}from"node:fs";import{dirname as i,join as e}from"node:path";import{g as n}from"./cli-ff9cbc77.js";import"node-fetch";import"@web-std/file";import"node:crypto";import"commander";import"fs";import"child_process";import"open";import"path";import"ora";import"node:fs/promises";import"node:os";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:console";import"node:readline/promises";import"dotenv";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"node:child_process";import"minimatch";import"node:url";import"node:util";import"body-parser";import"node:timers/promises";function p(){var p;let m;try{m=n()}catch{return null}const s=null==(p=m)||null==(p=p.entries)?void 0:p[0];if(!s)return null;if(!s.log_location)return null;if("unity"!==s.editor&&"blender"!==s.editor)return null;if(!o(s.log_location))return null;const l=s.log_location,d=function(o,i){const n=new Set([i]);try{for(const i of t(o)){if(!i.toLowerCase().endsWith(".log"))continue;const t=e(o,i);try{if(!r(t).isFile())continue}catch{continue}n.add(t)}}catch{}return[...n]}(i(l),l);return{editor:s.editor,path:l,paths:d}}export{p as findActiveEditorLog};
1
+ import{existsSync as o,readdirSync as t,statSync as r}from"node:fs";import{dirname as i,join as e}from"node:path";import{g as n}from"./cli-05c1463b.js";import"node-fetch";import"@web-std/file";import"node:crypto";import"commander";import"fs";import"child_process";import"open";import"path";import"ora";import"node:fs/promises";import"node:os";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:console";import"node:readline/promises";import"dotenv";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"node:child_process";import"minimatch";import"node:url";import"node:util";import"body-parser";import"node:timers/promises";function p(){var p;let m;try{m=n()}catch{return null}const s=null==(p=m)||null==(p=p.entries)?void 0:p[0];if(!s)return null;if(!s.log_location)return null;if("unity"!==s.editor&&"blender"!==s.editor)return null;if(!o(s.log_location))return null;const l=s.log_location,d=function(o,i){const n=new Set([i]);try{for(const i of t(o)){if(!i.toLowerCase().endsWith(".log"))continue;const t=e(o,i);try{if(!r(t).isFile())continue}catch{continue}n.add(t)}}catch{}return[...n]}(i(l),l);return{editor:s.editor,path:l,paths:d}}export{p as findActiveEditorLog};
package/dist/index.d.ts CHANGED
@@ -715,6 +715,163 @@ type ChatSessionSendOptions$1 = {
715
715
  context?: ClientContext[],
716
716
  }
717
717
 
718
+ /**
719
+ * @internal Needle editor cloud projects — versioned revisions of OPAQUE
720
+ * project documents (needle-cloud plans/cloud-projects-api.md). Editor-only,
721
+ * NO stability guarantee, deliberately not in the public OpenAPI docs.
722
+ *
723
+ * The server never parses a document: it stores blobs plus a revision graph.
724
+ * These types ARE the wire contract the editor's IProjectRemote adapter
725
+ * aligns to.
726
+ */
727
+
728
+ /** derived server-side from timestamps; deleted outranks archived.
729
+ * "deleted" lists the BIN (bounded to the restore window). */
730
+ type ProjectState = "active" | "archived" | "deleted";
731
+
732
+ interface ProjectInfo {
733
+ /** public project handle (projects.identifier) */
734
+ id: string;
735
+ name: string;
736
+ /** product discriminator, e.g. "web-project" (the editor) — opaque to the server */
737
+ kind?: string;
738
+ created_at?: string | null;
739
+ updated_at?: string | null;
740
+ /** set = the project is ARCHIVED (read-only; pushes return 409) */
741
+ archived_at?: string | null;
742
+ /** set = the project is in the BIN (only on ?state=deleted listings) */
743
+ deleted_at?: string | null;
744
+ /** user-editable metadata — opaque to the server */
745
+ description?: string | null;
746
+ tags?: string[] | null;
747
+ /** newest revision's actor id — null for a project with no pushes */
748
+ updated_by?: string | null;
749
+ /** resolved display name of updated_by (cached lookup) — null when unresolvable */
750
+ updated_by_name?: string | null;
751
+ }
752
+
753
+ interface ProjectRevisionInfo {
754
+ /** resolved display name of the actor (server-side cached Logto lookup);
755
+ * null when unresolvable — the actor ID stays the stored truth.
756
+ * Present on the revisions LISTING only. */
757
+ actorName?: string | null;
758
+ /** 1-based, strictly increasing per project */
759
+ revision: number;
760
+ /** the revision this push was built on (0 for the first) */
761
+ baseRevision: number;
762
+ /** sha-256 hex of the full document bytes */
763
+ hash: string;
764
+ /** token identity of the pusher — never client-supplied */
765
+ actor: string;
766
+ /** ISO timestamp */
767
+ timestamp: string | null;
768
+ /** hash of the revision's `.needle/thumbnail.jpg` manifest entry — fetch
769
+ * via blobs/download for a per-revision preview; null when the revision
770
+ * carried no thumbnail */
771
+ thumbnail?: string | null;
772
+ /** byte length of the document blob — revisions LISTING only (null when
773
+ * the blob is unexpectedly absent) */
774
+ size?: number | null;
775
+ /** total bytes of the folder files riding this revision (manifest sum;
776
+ * blobs are shared/deduped — footprint, not storage cost) */
777
+ filesSize?: number | null;
778
+ /** short human handle ("client-review") — user-editable via revisions/update */
779
+ label?: string | null;
780
+ /** what changed in this revision — user-written (a generated default may
781
+ * fill it later; user text wins by being set) */
782
+ description?: string | null;
783
+ }
784
+
785
+ /** PARTIAL revision metadata update: absent = keep, null = clear */
786
+ interface UpdateProjectRevisionRequest {
787
+ /** project id (public handle) */
788
+ project: string;
789
+ revision: number;
790
+ /** 1-64 characters, or null to clear */
791
+ label?: string | null;
792
+ /** max 4000 characters, or null to clear */
793
+ description?: string | null;
794
+ }
795
+
796
+ interface CreateProjectResponse {
797
+ id: string;
798
+ name: string;
799
+ kind?: string;
800
+ }
801
+
802
+ interface ListProjectsResponse {
803
+ projects: ProjectInfo[];
804
+ }
805
+
806
+ /** PARTIAL update: absent = keep, null = clear */
807
+ interface UpdateProjectRequest {
808
+ name?: string;
809
+ description?: string | null;
810
+ /** max 20 tags, 1-64 characters each (deduped server-side) */
811
+ tags?: string[] | null;
812
+ }
813
+
814
+ interface UpdateProjectResponse {
815
+ id: string;
816
+ name: string;
817
+ description: string | null;
818
+ tags: string[] | null;
819
+ }
820
+
821
+ interface CloneProjectResponse {
822
+ /** the COPY's public handle */
823
+ id: string;
824
+ name: string;
825
+ kind?: string;
826
+ /** the source project's handle */
827
+ sourceId: string;
828
+ }
829
+
830
+ interface ProjectHeadResponse {
831
+ head: ProjectRevisionInfo | null;
832
+ }
833
+
834
+ interface PushProjectRequest {
835
+ /** project id (public handle) */
836
+ project: string;
837
+ /** optimistic-concurrency token: the revision the client built on */
838
+ baseRevision: number;
839
+ /** sha-256 hex of the decoded bytes — verified server-side */
840
+ hash: string;
841
+ /** base64 document bytes */
842
+ bytes: string;
843
+ }
844
+
845
+ interface PushProjectResponse {
846
+ /** ok = revision minted; unchanged = identical to head, nothing minted;
847
+ * stale = head moved past the base — pull, merge client-side, retry */
848
+ status: "ok" | "unchanged" | "stale";
849
+ head: ProjectRevisionInfo;
850
+ }
851
+
852
+ interface PullProjectResponse {
853
+ info: ProjectRevisionInfo;
854
+ /** base64 document bytes */
855
+ bytes: string;
856
+ }
857
+
858
+ /** Deployment attempts are returned newest first. URLs identify exact deployed versions. */
859
+ interface ProjectDeploymentsResponse {
860
+ contentId: string | null;
861
+ url: string | null;
862
+ attempts: Array<{
863
+ revision: number | null;
864
+ contentId: string;
865
+ jobId: string;
866
+ /** ISO timestamp, or null when unavailable for an older attempt. */
867
+ createdAt: string | null;
868
+ actor: string;
869
+ status: JobStatus | null;
870
+ error: string | null;
871
+ url: string | null;
872
+ }>;
873
+ }
874
+
718
875
  // #region Tone mapping
719
876
 
720
877
  /**
@@ -918,8 +1075,17 @@ type ContentFormat = typeof CONTENT_FORMATS[number];
918
1075
  // change. Public is intentionally a slimmer subset (no internal IDs, no per-file
919
1076
  // enumeration).
920
1077
 
921
- /** Response for GET /v1/content/:identifier */
1078
+ /** A library item can be uploaded content or a saved web project. */
1079
+ type ContentItemType = "content" | "editor-project";
1080
+ type ContentListType = ContentType | "editor-project";
1081
+
1082
+ /** Select an item namespace when an upload and a project share an identifier. */
1083
+ type GetContentRequestQuery = { item?: ContentItemType };
1084
+
1085
+ /** Response for an uploaded item from GET /v1/content/:identifier */
922
1086
  type GetContentDetailResponse = {
1087
+ /** Uploaded content; omitted by older servers. */
1088
+ item_type?: "content",
923
1089
  /** Unique content identifier */
924
1090
  identifier: string,
925
1091
  /** ISO 8601 timestamp */
@@ -1095,6 +1261,16 @@ type ContentProcessingState =
1095
1261
  progress?: undefined,
1096
1262
  error?: undefined,
1097
1263
  }
1264
+
1265
+ /** Response from GET /v1/content/:identifier — alias for GetContentDetailResponse */
1266
+ /** Saved project detail. Revisions describe saved documents, not upload jobs. */
1267
+ type GetProjectContentDetailResponse = Omit<GetContentDetailResponse, "item_type" | "content_type" | "versions"> & {
1268
+ item_type: "editor-project";
1269
+ content_type: "editor-project";
1270
+ versions: [];
1271
+ editorProject: { info: ProjectInfo; revisions: ProjectRevisionInfo[]; deployments: ProjectDeploymentsResponse };
1272
+ };
1273
+ type GetContentResponse = GetContentDetailResponse | GetProjectContentDetailResponse;
1098
1274
  // #endregion
1099
1275
 
1100
1276
 
@@ -1103,7 +1279,9 @@ type ContentProcessingState =
1103
1279
  /** Query parameters for GET /v1/content */
1104
1280
  type ListContentRequestQuery = {
1105
1281
  /** Filter by content type (e.g. "material", "3d-asset") */
1106
- content_type?: ContentType;
1282
+ content_type?: ContentListType;
1283
+ /** Include saved web projects alongside uploaded content (default false). */
1284
+ include_projects?: boolean;
1107
1285
  /** Filter by output content format (e.g. "glb", "textures"). When set, only
1108
1286
  * items with a matching output are returned, and artifact data comes from
1109
1287
  * that output. Matches against `content_format` on job_outputs. */
@@ -1132,6 +1310,10 @@ type ListContentRequestQuery = {
1132
1310
  * A single item in the GET /v1/content list response.
1133
1311
  */
1134
1312
  type ContentListItem = {
1313
+ /** Distinguishes saved projects from uploaded content. */
1314
+ item_type?: ContentItemType;
1315
+ /** Saved project metadata, present only for editor-project items. */
1316
+ editorProject?: ProjectInfo;
1135
1317
  identifier: string;
1136
1318
  title: string | null;
1137
1319
  description: string | null;
@@ -1145,7 +1327,7 @@ type ContentListItem = {
1145
1327
  * upload's URL. Null when no completed job/output is available. */
1146
1328
  url: string | null;
1147
1329
  /** Semantic content type derived from job_outputs (e.g. "3d-asset", "material") */
1148
- content_type: ContentType | null;
1330
+ content_type: ContentListType | null;
1149
1331
  /** Available content formats for this content item (e.g. ["glb", "textures"]) */
1150
1332
  content_formats: ContentFormat[];
1151
1333
  /** Page for editing this item in the cloud UI. Present for everything the
@@ -1155,7 +1337,7 @@ type ContentListItem = {
1155
1337
  /** Standalone viewer page. Null for deployments (they ARE a website — use
1156
1338
  * `url`) and for items with no artifact to view yet. */
1157
1339
  view_url?: string | null;
1158
- /** Number of top-level versions (matches the versions[] array in the detail response) */
1340
+ /** Number of upload versions, or the latest saved project revision number. */
1159
1341
  version_count: number;
1160
1342
  /** Whether the content is password-protected (requires commercial license) */
1161
1343
  password_protected: boolean;
@@ -2010,8 +2192,8 @@ declare function listContent(opts?: {
2010
2192
  * See {@link listContent} for auth behavior.
2011
2193
  *
2012
2194
  * @param {string} identifier
2013
- * @param {{ org?: string, authToken?: string }} [opts]
2014
- * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.content").GetContentDetailResponse>}
2195
+ * @param {{ org?: string, authToken?: string } & import("@needle-tools/cloud-sdk/types/api.content").GetContentRequestQuery} [opts]
2196
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.content").GetContentResponse>}
2015
2197
  *
2016
2198
  * @example
2017
2199
  * import { getContent } from "needle-cloud";
@@ -2021,7 +2203,7 @@ declare function listContent(opts?: {
2021
2203
  declare function getContent(identifier: string, opts?: {
2022
2204
  org?: string;
2023
2205
  authToken?: string;
2024
- }): Promise<GetContentDetailResponse>;
2206
+ } & GetContentRequestQuery): Promise<GetContentResponse>;
2025
2207
  /**
2026
2208
  * Update a content item's metadata, and optionally set its thumbnail.
2027
2209
  *
@@ -2118,162 +2300,6 @@ declare function generate3dAsset(opts: Ai3dAssetRequestParameters & Generate3dAs
2118
2300
  filename?: string;
2119
2301
  }>;
2120
2302
 
2121
- /**
2122
- * @internal Needle editor cloud projects — versioned revisions of OPAQUE
2123
- * project documents (needle-cloud plans/cloud-projects-api.md). Editor-only,
2124
- * NO stability guarantee, deliberately not in the public OpenAPI docs.
2125
- *
2126
- * The server never parses a document: it stores blobs plus a revision graph.
2127
- * These types ARE the wire contract the editor's IProjectRemote adapter
2128
- * aligns to.
2129
- */
2130
-
2131
- /** derived server-side from timestamps; deleted outranks archived.
2132
- * "deleted" lists the BIN (bounded to the restore window). */
2133
- type ProjectState = "active" | "archived" | "deleted";
2134
-
2135
- interface ProjectInfo {
2136
- /** public project handle (projects.identifier) */
2137
- id: string;
2138
- name: string;
2139
- /** product discriminator, e.g. "web-project" (the editor) — opaque to the server */
2140
- kind?: string;
2141
- created_at?: string | null;
2142
- updated_at?: string | null;
2143
- /** set = the project is ARCHIVED (read-only; pushes return 409) */
2144
- archived_at?: string | null;
2145
- /** set = the project is in the BIN (only on ?state=deleted listings) */
2146
- deleted_at?: string | null;
2147
- /** user-editable metadata — opaque to the server */
2148
- description?: string | null;
2149
- tags?: string[] | null;
2150
- /** newest revision's actor id — null for a project with no pushes */
2151
- updated_by?: string | null;
2152
- /** resolved display name of updated_by (cached lookup) — null when unresolvable */
2153
- updated_by_name?: string | null;
2154
- }
2155
-
2156
- interface ProjectRevisionInfo {
2157
- /** resolved display name of the actor (server-side cached Logto lookup);
2158
- * null when unresolvable — the actor ID stays the stored truth.
2159
- * Present on the revisions LISTING only. */
2160
- actorName?: string | null;
2161
- /** 1-based, strictly increasing per project */
2162
- revision: number;
2163
- /** the revision this push was built on (0 for the first) */
2164
- baseRevision: number;
2165
- /** sha-256 hex of the full document bytes */
2166
- hash: string;
2167
- /** token identity of the pusher — never client-supplied */
2168
- actor: string;
2169
- /** ISO timestamp */
2170
- timestamp: string | null;
2171
- /** hash of the revision's `.needle/thumbnail.jpg` manifest entry — fetch
2172
- * via blobs/download for a per-revision preview; null when the revision
2173
- * carried no thumbnail */
2174
- thumbnail?: string | null;
2175
- /** byte length of the document blob — revisions LISTING only (null when
2176
- * the blob is unexpectedly absent) */
2177
- size?: number | null;
2178
- /** total bytes of the folder files riding this revision (manifest sum;
2179
- * blobs are shared/deduped — footprint, not storage cost) */
2180
- filesSize?: number | null;
2181
- /** short human handle ("client-review") — user-editable via revisions/update */
2182
- label?: string | null;
2183
- /** what changed in this revision — user-written (a generated default may
2184
- * fill it later; user text wins by being set) */
2185
- description?: string | null;
2186
- }
2187
-
2188
- /** PARTIAL revision metadata update: absent = keep, null = clear */
2189
- interface UpdateProjectRevisionRequest {
2190
- /** project id (public handle) */
2191
- project: string;
2192
- revision: number;
2193
- /** 1-64 characters, or null to clear */
2194
- label?: string | null;
2195
- /** max 4000 characters, or null to clear */
2196
- description?: string | null;
2197
- }
2198
-
2199
- interface CreateProjectResponse {
2200
- id: string;
2201
- name: string;
2202
- kind?: string;
2203
- }
2204
-
2205
- interface ListProjectsResponse {
2206
- projects: ProjectInfo[];
2207
- }
2208
-
2209
- /** PARTIAL update: absent = keep, null = clear */
2210
- interface UpdateProjectRequest {
2211
- name?: string;
2212
- description?: string | null;
2213
- /** max 20 tags, 1-64 characters each (deduped server-side) */
2214
- tags?: string[] | null;
2215
- }
2216
-
2217
- interface UpdateProjectResponse {
2218
- id: string;
2219
- name: string;
2220
- description: string | null;
2221
- tags: string[] | null;
2222
- }
2223
-
2224
- interface CloneProjectResponse {
2225
- /** the COPY's public handle */
2226
- id: string;
2227
- name: string;
2228
- kind?: string;
2229
- /** the source project's handle */
2230
- sourceId: string;
2231
- }
2232
-
2233
- interface ProjectHeadResponse {
2234
- head: ProjectRevisionInfo | null;
2235
- }
2236
-
2237
- interface PushProjectRequest {
2238
- /** project id (public handle) */
2239
- project: string;
2240
- /** optimistic-concurrency token: the revision the client built on */
2241
- baseRevision: number;
2242
- /** sha-256 hex of the decoded bytes — verified server-side */
2243
- hash: string;
2244
- /** base64 document bytes */
2245
- bytes: string;
2246
- }
2247
-
2248
- interface PushProjectResponse {
2249
- /** ok = revision minted; unchanged = identical to head, nothing minted;
2250
- * stale = head moved past the base — pull, merge client-side, retry */
2251
- status: "ok" | "unchanged" | "stale";
2252
- head: ProjectRevisionInfo;
2253
- }
2254
-
2255
- interface PullProjectResponse {
2256
- info: ProjectRevisionInfo;
2257
- /** base64 document bytes */
2258
- bytes: string;
2259
- }
2260
-
2261
- /** Deployment attempts are returned newest first. URLs identify exact deployed versions. */
2262
- interface ProjectDeploymentsResponse {
2263
- contentId: string | null;
2264
- url: string | null;
2265
- attempts: Array<{
2266
- revision: number | null;
2267
- contentId: string;
2268
- jobId: string;
2269
- createdAt: string;
2270
- actor: string;
2271
- status: JobStatus | null;
2272
- error: string | null;
2273
- url: string | null;
2274
- }>;
2275
- }
2276
-
2277
2303
  /**
2278
2304
  * @internal Needle editor cloud projects — versioned revisions of OPAQUE
2279
2305
  * project documents. Editor-only, NO stability guarantee (needle-cloud