Skip to content

Commit aeac704

Browse files
DaniAkashCopilot
andauthored
fix: package compatibility with ESM and CJS environments (#29)
Release-As: 0.1.1 * fix: upgrade parcer version and config * fix: rewrite the import statements for third party packages * fix: import statements for cjs compatibility * fix: import statements for cjs compatibility * fix: import statements for cjs compatibility * fix: import statements for cjs compatibility * fix: import statements for cjs compatibility * docs: updated api reference docs * feat: support custom deployments (#30) * feat: added custom deployment support for models * feat: test for custom deployment id * fix: added runner to duplex support * fix: verify userid before applying it to runner config * Update src/client/model.ts Co-authored-by: Copilot <[email protected]> * fix: minor issue with assigning runners * test: increase timeout for generate stream with image input * chore: updated grpc package --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 7406d2b commit aeac704

38 files changed

+2827
-2187
lines changed

docs/README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
clarifai-nodejs / [Exports](modules.md)
22

3-
<h1 align="center">
4-
<a href="https://www.clarifai.com/"><img alt="Clarifai" title="Clarifai" src="https://upload.wikimedia.org/wikipedia/commons/b/bc/Clarifai_Logo_FC_Web.png"></a>
5-
</h1>
3+
![image](https://github.com/user-attachments/assets/3721189c-01c0-4936-a73c-13dcbf808542)
64

7-
<h2 align="center">
8-
Clarifai Node.js SDK</a>
9-
</h2>
5+
<h2 align="center">Clarifai Node.js SDK</h2>
106

117
[![npm](https://img.shields.io/npm/v/clarifai-nodejs)](https://www.npmjs.com/package/clarifai-nodejs)
128
[![Build](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml/badge.svg)](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml)
@@ -45,6 +41,20 @@ module.exports = nextConfig
4541

4642
## Usage
4743

44+
Clarifai uses **Personal Access Tokens(PATs)** to validate requests. You can create and manage PATs under your Clarifai account security settings.
45+
46+
* 🔗 [Create PAT:](https://docs.clarifai.com/clarifai-basics/authentication/personal-access-tokens/) ***Log into Portal &rarr; Profile Icon &rarr; Security Settings &rarr; Create Personal Access Token &rarr; Set the scopes &rarr; Confirm***
47+
48+
Export your PAT as an environment variable. Then, import and initialize the API Client.
49+
50+
Set PAT as environment variable through terminal:
51+
52+
```cmd
53+
export CLARIFAI_PAT={your personal access token}
54+
```
55+
56+
or use [dotenv](https://www.npmjs.com/package/dotenv) to load environment variables via a `.env` file
57+
4858
### Using Models
4959

5060
Using the celebrity face recognition model to predict the celebrity in a given picture. For list of all available models visit [clarifai models page](https://clarifai.com/explore/models).
@@ -140,4 +150,4 @@ const apps = list.value;
140150
console.log(apps);
141151
```
142152

143-
For full usage details, checkout our [API Reference docs](https://docs.clarifai.com/nodejs-sdk/api-reference)
153+
For full usage details, checkout our [API Reference docs](https://docs.clarifai.com/nodejs-sdk/installation-guide/modules)

docs/classes/App.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ App is a class that provides access to Clarifai API endpoints related to App inf
1919
### Properties
2020

2121
- [appInfo](App.md#appinfo)
22+
- [info](App.md#info)
2223

2324
### Methods
2425

@@ -78,7 +79,7 @@ Lister.constructor
7879

7980
#### Defined in
8081

81-
[client/app.ts:98](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L98)
82+
[src/client/app.ts:102](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L102)
8283

8384
## Properties
8485

@@ -88,7 +89,17 @@ Lister.constructor
8889

8990
#### Defined in
9091

91-
[client/app.ts:83](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L83)
92+
[src/client/app.ts:86](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L86)
93+
94+
___
95+
96+
### info
97+
98+
**info**: `AsObject`
99+
100+
#### Defined in
101+
102+
[src/client/app.ts:87](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L87)
92103

93104
## Methods
94105

@@ -160,7 +171,7 @@ A Dataset object for the specified dataset ID.
160171

161172
#### Defined in
162173

163-
[client/app.ts:420](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L420)
174+
[src/client/app.ts:429](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L429)
164175

165176
___
166177

@@ -177,7 +188,7 @@ import {
177188
ModelVersion,
178189
OutputInfo,
179190
} from "clarifai-nodejs-grpc/proto/clarifai/api/resources_pb";
180-
import { Struct } from "google-protobuf/google/protobuf/struct_pb";
191+
import { Struct } from "google-protobuf/google/protobuf/struct_pb.js";
181192

182193
const app = new App({
183194
authConfig: {
@@ -237,7 +248,7 @@ A Model object for the specified model ID.
237248

238249
#### Defined in
239250

240-
[client/app.ts:462](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L462)
251+
[src/client/app.ts:471](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L471)
241252

242253
___
243254

@@ -283,7 +294,7 @@ A Module object for the specified module ID.
283294

284295
#### Defined in
285296

286-
[client/app.ts:501](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L501)
297+
[src/client/app.ts:510](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L510)
287298

288299
___
289300

@@ -356,7 +367,7 @@ A Workflow object for the specified workflow config.
356367

357368
#### Defined in
358369

359-
[client/app.ts:537](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L537)
370+
[src/client/app.ts:546](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L546)
360371

361372
___
362373

@@ -398,7 +409,7 @@ A Dataset object for the existing dataset ID.
398409

399410
#### Defined in
400411

401-
[client/app.ts:727](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L727)
412+
[src/client/app.ts:759](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L759)
402413

403414
___
404415

@@ -436,7 +447,7 @@ await app.deleteDataset({ datasetId: "dataset-id" });
436447

437448
#### Defined in
438449

439-
[client/app.ts:754](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L754)
450+
[src/client/app.ts:786](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L786)
440451

441452
___
442453

@@ -474,7 +485,7 @@ await app.deleteModel({ modelId: "modelId" });
474485

475486
#### Defined in
476487

477-
[client/app.ts:777](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L777)
488+
[src/client/app.ts:809](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L809)
478489

479490
___
480491

@@ -512,7 +523,7 @@ await app.deleteModule({ moduleId: "moduleId" });
512523

513524
#### Defined in
514525

515-
[client/app.ts:823](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L823)
526+
[src/client/app.ts:855](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L855)
516527

517528
___
518529

@@ -550,7 +561,7 @@ await app.deleteWorkflow({ workflowId: "workflowId" });
550561

551562
#### Defined in
552563

553-
[client/app.ts:800](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L800)
564+
[src/client/app.ts:832](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L832)
554565

555566
___
556567

@@ -594,7 +605,7 @@ Concepts in the app.
594605

595606
#### Defined in
596607

597-
[client/app.ts:382](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L382)
608+
[src/client/app.ts:391](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L391)
598609

599610
___
600611

@@ -643,7 +654,7 @@ Defaults to 16 per page
643654

644655
#### Defined in
645656

646-
[client/app.ts:131](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L131)
657+
[src/client/app.ts:136](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L136)
647658

648659
___
649660

@@ -692,7 +703,7 @@ Defaults to 16 per page
692703

693704
#### Defined in
694705

695-
[client/app.ts:337](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L337)
706+
[src/client/app.ts:342](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L342)
696707

697708
___
698709

@@ -738,7 +749,7 @@ Defaults to 16 per page
738749

739750
#### Defined in
740751

741-
[client/app.ts:175](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L175)
752+
[src/client/app.ts:180](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L180)
742753

743754
___
744755

@@ -788,7 +799,7 @@ Defaults to 16 per page
788799

789800
#### Defined in
790801

791-
[client/app.ts:286](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L286)
802+
[src/client/app.ts:291](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L291)
792803

793804
___
794805

@@ -802,7 +813,7 @@ ___
802813

803814
#### Defined in
804815

805-
[client/app.ts:406](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L406)
816+
[src/client/app.ts:415](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L415)
806817

807818
___
808819

@@ -852,7 +863,7 @@ Defaults to 16 per page
852863

853864
#### Defined in
854865

855-
[client/app.ts:233](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L233)
866+
[src/client/app.ts:238](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L238)
856867

857868
___
858869

@@ -886,6 +897,9 @@ console.log(model);
886897
| :------ | :------ |
887898
| `«destructured»` | `Object` |
888899
| › `modelId` | `string` |
900+
| › `modelUserAppId?` | `Object` |
901+
| › `modelUserAppId.appId` | `string` |
902+
| › `modelUserAppId.userId` | `string` |
889903
| › `modelVersionId?` | `string` |
890904

891905
#### Returns
@@ -896,7 +910,7 @@ A model object for the specified model ID.
896910

897911
#### Defined in
898912

899-
[client/app.ts:666](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L666)
913+
[src/client/app.ts:685](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L685)
900914

901915
___
902916

@@ -937,4 +951,4 @@ A workflow object for the specified workflow ID.
937951

938952
#### Defined in
939953

940-
[client/app.ts:699](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L699)
954+
[src/client/app.ts:731](https://github.com/Clarifai/clarifai-nodejs/blob/caa21f4/src/client/app.ts#L731)

0 commit comments

Comments
 (0)