needle-cloud 2.1.0 → 2.2.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/CHANGELOG.md +32 -0
- package/dist/cli.esm.js +1 -1
- package/dist/index.d.ts +162 -2
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -335,7 +335,21 @@ type ChatSessionHandle$1 = {
|
|
|
335
335
|
readonly chatUrl: string | null,
|
|
336
336
|
/** Whether the WebSocket tool connection is active. Always false if no tools were provided. */
|
|
337
337
|
readonly toolsConnected: boolean,
|
|
338
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Stable identity of the underlying tool connection. `null` when the
|
|
340
|
+
* session has no tools (HTTP-only). Used by the server to route tool
|
|
341
|
+
* requests back to this specific session.
|
|
342
|
+
*/
|
|
343
|
+
readonly instanceId: string | null,
|
|
344
|
+
/**
|
|
345
|
+
* Close the session (WebSocket + cleanup).
|
|
346
|
+
*
|
|
347
|
+
* **Node / CLI consumers MUST call this before exit** when the
|
|
348
|
+
* session was created with tools (i.e. holds an open WebSocket) —
|
|
349
|
+
* otherwise the open socket keeps Node's event loop alive and the
|
|
350
|
+
* process will hang. See `ToolConnectionHandle.close()` for the
|
|
351
|
+
* full lifecycle notes. Browsers handle this automatically.
|
|
352
|
+
*/
|
|
339
353
|
close(): void,
|
|
340
354
|
}
|
|
341
355
|
|
|
@@ -537,6 +551,152 @@ type ChatSessionHandle = ChatSessionHandle$1;
|
|
|
537
551
|
type ChatSessionSendOptions = ChatSessionSendOptions$1;
|
|
538
552
|
type ToolDefinition = ToolDefinition$1;
|
|
539
553
|
|
|
554
|
+
// #region Content type / format constants
|
|
555
|
+
/** All known content types. Runtime array for validation. */
|
|
556
|
+
declare const CONTENT_TYPES: readonly ["3d-asset", "material", "deployment", "hdri"];
|
|
557
|
+
/** Semantic content type — what kind of asset this is (3D model, material, deployed website, HDRI environment). */
|
|
558
|
+
type ContentType = typeof CONTENT_TYPES[number];
|
|
559
|
+
|
|
560
|
+
/** All known content formats. Runtime array for validation. */
|
|
561
|
+
declare const CONTENT_FORMATS: readonly ["glb", "gltf", "usd", "usda", "usdz", "obj", "fbx", "vrm", "stl", "textures", "html", "exr", "pmrem"];
|
|
562
|
+
/** File format — e.g. `glb`, `usdz`, `gltf`, `exr` (HDRI source), `pmrem` (engine-ready HDRI KTX2). */
|
|
563
|
+
type ContentFormat = typeof CONTENT_FORMATS[number];
|
|
564
|
+
// #endregion
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
// #region Public content — GET /v1/public/content
|
|
568
|
+
// Phase 3.1d. Anonymous, no auth. Only items with is_public=true.
|
|
569
|
+
|
|
570
|
+
// NOTE: PublicContentItem / PublicContentDetail / PublicContentVersion are the
|
|
571
|
+
// *anonymous* counterpart to the auth-required types above (ContentListItem,
|
|
572
|
+
// GetContentDetailResponse, ContentVersion). Keep them aligned: when fields
|
|
573
|
+
// change on one side, decide whether the other side needs the same change.
|
|
574
|
+
// Public is intentionally slimmer — no internal IDs (user, updated_by, etc.),
|
|
575
|
+
// no per-file enumeration, no labels/variants/processing-state.
|
|
576
|
+
|
|
577
|
+
/** One version of a public content item.
|
|
578
|
+
* Each version exposes a single entrypoint URL — relative file references
|
|
579
|
+
* (e.g. `./model.bin`) are resolved automatically when fetched. */
|
|
580
|
+
type PublicContentVersion = {
|
|
581
|
+
/** Stable identifier for this version. */
|
|
582
|
+
identifier: string;
|
|
583
|
+
/** ISO 8601 timestamp. */
|
|
584
|
+
created_at: string;
|
|
585
|
+
/** ISO 8601 timestamp — last time this version was touched. */
|
|
586
|
+
updated_at: string;
|
|
587
|
+
/** Filename of the main entrypoint within the version. */
|
|
588
|
+
entrypoint: string;
|
|
589
|
+
/** URL to the entrypoint file — what consumers should load. */
|
|
590
|
+
url: string;
|
|
591
|
+
/** Total size of the version in bytes. */
|
|
592
|
+
size: number | null;
|
|
593
|
+
/** Base64-encoded MD5 of the entrypoint file. Use for integrity / cache keys. */
|
|
594
|
+
md5: string | null;
|
|
595
|
+
/** Semantic content type for this version (may differ from the item-level type for derived variants). */
|
|
596
|
+
content_type: ContentType | null;
|
|
597
|
+
/** File format (e.g. `glb`, `gltf`). */
|
|
598
|
+
content_format: ContentFormat | null;
|
|
599
|
+
/** Pixel width for image content (HDRI / PNG / JPEG / WebP / KTX2). Null otherwise. */
|
|
600
|
+
width: number | null;
|
|
601
|
+
/** Pixel height. See `width`. */
|
|
602
|
+
height: number | null;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* A single content item in a public discovery listing.
|
|
607
|
+
*/
|
|
608
|
+
type PublicContentItem = {
|
|
609
|
+
identifier: string;
|
|
610
|
+
/** Display name. */
|
|
611
|
+
title: string;
|
|
612
|
+
description: string | null;
|
|
613
|
+
tags: string[] | null;
|
|
614
|
+
/** Semantic content type (e.g. `material`, `3d-asset`, `deployment`). */
|
|
615
|
+
content_type: ContentType | null;
|
|
616
|
+
/** All formats available across versions (e.g. `["glb"]` or `["glb", "textures"]`). */
|
|
617
|
+
content_formats: ContentFormat[];
|
|
618
|
+
/** URL for the thumbnail image, when one is available. */
|
|
619
|
+
thumbnail_url: string | null;
|
|
620
|
+
/** ISO 8601 timestamp. */
|
|
621
|
+
created_at: string;
|
|
622
|
+
/** ISO 8601 timestamp. */
|
|
623
|
+
updated_at: string;
|
|
624
|
+
/** Whether this content requires a password to be viewed. */
|
|
625
|
+
is_password_protected: boolean;
|
|
626
|
+
/** Linkable URL for this content. For deployments this is the live website URL;
|
|
627
|
+
* for other content types it points at the asset's entrypoint file.
|
|
628
|
+
* This is the URL to *reference* / link to. It is NOT a "download the whole asset"
|
|
629
|
+
* URL — progressive formats (glTF, USD, …) only fetch the entrypoint here;
|
|
630
|
+
* dependent files are resolved relatively by the consuming runtime. */
|
|
631
|
+
url: string | null;
|
|
632
|
+
/** Standalone viewer URL. Open in a browser to view the asset interactively.
|
|
633
|
+
* Omitted for `content_type === "deployment"` (use `url` instead). */
|
|
634
|
+
view_url?: string | null;
|
|
635
|
+
/** Iframe-friendly embed URL. Drop into an `<iframe src="…">` to embed the asset
|
|
636
|
+
* on a page. Omitted for `content_type === "deployment"` (use `url` instead). */
|
|
637
|
+
embed_url?: string | null;
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
/** Full detail for a public content item — adds version information to the list shape. */
|
|
641
|
+
type PublicContentDetail = PublicContentItem & {
|
|
642
|
+
versions: PublicContentVersion[];
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/** Query parameters for GET /v1/public/content */
|
|
646
|
+
type ListPublicContentQuery = {
|
|
647
|
+
/** Filter by content type */
|
|
648
|
+
content_type?: ContentType;
|
|
649
|
+
/** Filter by content format */
|
|
650
|
+
content_format?: ContentFormat;
|
|
651
|
+
/** Filter to content owned by a single Needle Cloud team. The team id
|
|
652
|
+
* is shown on the team's details page at `https://cloud.needle.tools/team/<id>`. */
|
|
653
|
+
org_id?: string;
|
|
654
|
+
/** Substring match against identifier, title, description, and tags. */
|
|
655
|
+
search?: string;
|
|
656
|
+
/** Page size (default 20, max 100) */
|
|
657
|
+
limit?: number;
|
|
658
|
+
/** Opaque cursor from a previous response. When omitted, returns the first page. */
|
|
659
|
+
cursor?: string;
|
|
660
|
+
/** Include password-protected items in the listing. Default: false (excluded).
|
|
661
|
+
* Opt-in for the niche "teaser" pattern where the owner wants the metadata
|
|
662
|
+
* publicly discoverable but viewing requires a password. */
|
|
663
|
+
include_protected?: boolean;
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
/** Response from GET /v1/public/content */
|
|
667
|
+
type ListPublicContentResponse = {
|
|
668
|
+
items: PublicContentItem[];
|
|
669
|
+
/** Cursor to fetch the next page; omitted when there are no more items. */
|
|
670
|
+
next_cursor?: string;
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* List publicly discoverable content items on Needle Cloud.
|
|
675
|
+
*
|
|
676
|
+
* Anonymous — no auth required. The production endpoint is baked into the
|
|
677
|
+
* build so callers don't need to know about `baseUrl`.
|
|
678
|
+
*
|
|
679
|
+
* @param {import("@needle-tools/cloud-sdk/types/api.content").ListPublicContentQuery} [query]
|
|
680
|
+
* @returns {Promise<import("@needle-tools/cloud-sdk/types/api.content").ListPublicContentResponse>}
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* import { listPublicContent } from "needle-cloud";
|
|
684
|
+
* const { items, next_cursor } = await listPublicContent({ content_type: "material", limit: 20 });
|
|
685
|
+
*/
|
|
686
|
+
declare function listPublicContent(query?: ListPublicContentQuery): Promise<ListPublicContentResponse>;
|
|
687
|
+
/**
|
|
688
|
+
* Fetch the full detail (versions, urls, ...) of a single publicly discoverable
|
|
689
|
+
* content item by its identifier. Anonymous — no auth required.
|
|
690
|
+
*
|
|
691
|
+
* @param {string} identifier
|
|
692
|
+
* @returns {Promise<import("@needle-tools/cloud-sdk/types/api.content").PublicContentDetail>}
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* import { getPublicContent } from "needle-cloud";
|
|
696
|
+
* const item = await getPublicContent("a1b2c3");
|
|
697
|
+
*/
|
|
698
|
+
declare function getPublicContent(identifier: string): Promise<PublicContentDetail>;
|
|
699
|
+
|
|
540
700
|
/**
|
|
541
701
|
* Start the checkout process
|
|
542
702
|
* @param {{ price_id:string }} args
|
|
@@ -554,5 +714,5 @@ declare namespace AuthScopes {
|
|
|
554
714
|
let All: string[];
|
|
555
715
|
}
|
|
556
716
|
|
|
557
|
-
export { Auth, AuthScopes, NeedleLoginButton, createChatSession, getDeployments, getUserLicenses, listChats, ownsProduct, startCheckoutSession, uploadFiles };
|
|
717
|
+
export { Auth, AuthScopes, NeedleLoginButton, createChatSession, getDeployments, getPublicContent, getUserLicenses, listChats, listPublicContent, ownsProduct, startCheckoutSession, uploadFiles };
|
|
558
718
|
export type { AuthData, AuthInitOpts, ChatAuthOpts, ChatSessionHandle, ChatSessionOptions, ChatSessionSendOptions, Deployment, Filelike, LogtoUserCustomData, RecentChatsResponse, ResourceUrl, ToolDefinition, UserInfoResponse };
|