@qaecy/cue-sdk 0.0.1 → 0.0.3
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 +97 -4
- package/index-CV1OX3eG.js +20390 -0
- package/{src/index.d.ts → index.d.ts} +2 -2
- package/index.js +7 -0
- package/{src/lib → lib}/api.d.ts +7 -4
- package/{src/lib → lib}/auth.d.ts +6 -4
- package/lib/cue-node.d.ts +21 -0
- package/lib/cue.d.ts +26 -0
- package/lib/models.d.ts +111 -0
- package/lib/project.d.ts +21 -0
- package/lib/sync.d.ts +21 -0
- package/node.d.ts +3 -0
- package/node.js +6620 -0
- package/package.json +11 -39
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -4
- package/src/index.js.map +0 -1
- package/src/lib/api.d.ts.map +0 -1
- package/src/lib/api.js +0 -56
- package/src/lib/api.js.map +0 -1
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -48
- package/src/lib/auth.js.map +0 -1
- package/src/lib/cue.d.ts +0 -20
- package/src/lib/cue.d.ts.map +0 -1
- package/src/lib/cue.js +0 -39
- package/src/lib/cue.js.map +0 -1
- package/src/lib/models.d.ts +0 -39
- package/src/lib/models.d.ts.map +0 -1
- package/src/lib/models.js +0 -2
- package/src/lib/models.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @qaecy/cue-sdk
|
|
2
2
|
|
|
3
|
-
Headless JavaScript SDK for building apps on the QAECY platform. A framework-agnostic client that handles authentication and API access — the programmatic counterpart to the `@qaecy/cue-widget`.
|
|
3
|
+
Headless JavaScript SDK for building apps on the QAECY Cue platform. A framework-agnostic client that handles authentication, project management, and API access — the programmatic counterpart to the `@qaecy/cue-widget`.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -33,10 +33,13 @@ await cue.auth.signIn('microsoft');
|
|
|
33
33
|
// or
|
|
34
34
|
await cue.auth.signIn('password', { email: 'user@example.com', password: 'secret' });
|
|
35
35
|
|
|
36
|
+
// List projects
|
|
37
|
+
const projects = await cue.api.projects.listProjects();
|
|
38
|
+
|
|
36
39
|
// Search documents
|
|
37
40
|
const results = await cue.api.search({
|
|
38
41
|
term: 'What are the fire safety requirements?',
|
|
39
|
-
projectId:
|
|
42
|
+
projectId: projects[0].id,
|
|
40
43
|
});
|
|
41
44
|
|
|
42
45
|
console.log(results.response);
|
|
@@ -53,8 +56,8 @@ await cue.auth.signOut();
|
|
|
53
56
|
| `apiKey` | `string` | ✅ | Firebase API key |
|
|
54
57
|
| `appId` | `string` | ✅ | Firebase App ID |
|
|
55
58
|
| `measurementId` | `string` | ✅ | Firebase Measurement ID |
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
59
|
+
| `environment` | `'production' \| 'emulator'` | — | Target environment (default: `'production'`) |
|
|
60
|
+
| `endpoints` | `Partial<CueEndpoints>` | — | Override individual endpoint URLs (takes precedence over `environment`) |
|
|
58
61
|
|
|
59
62
|
## Auth
|
|
60
63
|
|
|
@@ -78,6 +81,14 @@ const user = await cue.auth.signIn('password', {
|
|
|
78
81
|
});
|
|
79
82
|
```
|
|
80
83
|
|
|
84
|
+
### `cue.auth.signInWithApiKey(cueApiKey, projectId)`
|
|
85
|
+
|
|
86
|
+
Sign in using a Cue API key. Intended for non-interactive/server-side use (e.g. via `CueNode`):
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const user = await cue.auth.signInWithApiKey('MY_CUE_API_KEY', 'my-project-id');
|
|
90
|
+
```
|
|
91
|
+
|
|
81
92
|
### `cue.auth.signOut()`
|
|
82
93
|
|
|
83
94
|
```typescript
|
|
@@ -139,6 +150,88 @@ const data = await cue.api.sparql(
|
|
|
139
150
|
);
|
|
140
151
|
```
|
|
141
152
|
|
|
153
|
+
## Projects
|
|
154
|
+
|
|
155
|
+
Manage Cue projects via `cue.api.projects` (`CueProjects`).
|
|
156
|
+
|
|
157
|
+
### `cue.api.projects.listProjects()`
|
|
158
|
+
|
|
159
|
+
List all projects where the authenticated user is a member, syncer, or admin:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
const projects = await cue.api.projects.listProjects();
|
|
163
|
+
projects.forEach((p) => console.log(p.id, p.name));
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### `cue.api.projects.getProject(projectId)`
|
|
167
|
+
|
|
168
|
+
Fetch a single project by ID. Returns `null` if not found:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
const project = await cue.api.projects.getProject('my-project-id');
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### `cue.api.projects.createProject(options)`
|
|
175
|
+
|
|
176
|
+
Create a new project. The authenticated user is automatically set as admin, syncer, and member:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
const project = await cue.api.projects.createProject({
|
|
180
|
+
name: 'My Project',
|
|
181
|
+
organizationID: 'my-org-id',
|
|
182
|
+
id: 'optional-custom-id', // defaults to a new UUID
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Node.js — file sync
|
|
187
|
+
|
|
188
|
+
For server-side or CLI use with file-sync capabilities, import from `@qaecy/cue-sdk/node`:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { CueNode } from '@qaecy/cue-sdk/node';
|
|
192
|
+
|
|
193
|
+
const cue = new CueNode({
|
|
194
|
+
apiKey: 'YOUR_FIREBASE_API_KEY',
|
|
195
|
+
appId: 'YOUR_FIREBASE_APP_ID',
|
|
196
|
+
measurementId: 'YOUR_MEASUREMENT_ID',
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Use an API key for non-interactive sign-in
|
|
200
|
+
await cue.auth.signInWithApiKey('MY_CUE_API_KEY', 'my-project-id');
|
|
201
|
+
|
|
202
|
+
// Sync local files into a project
|
|
203
|
+
const result = await cue.api.sync.sync(localFiles, {
|
|
204
|
+
spaceId: 'my-project-id',
|
|
205
|
+
providerId: 'my-provider',
|
|
206
|
+
userId: cue.auth.currentUser!.uid,
|
|
207
|
+
verbose: true,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
console.log(`Synced ${result.syncCount} files (${result.failedUploads} failed)`);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### `cue.api.sync.sync(localFiles, options)`
|
|
214
|
+
|
|
215
|
+
Compares local files against the remote project and uploads any that are missing or changed.
|
|
216
|
+
|
|
217
|
+
| Option | Type | Description |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| `spaceId` | `string` | Project ID to sync into |
|
|
220
|
+
| `providerId` | `string` | Identifier for the file source (e.g. `'local'`) |
|
|
221
|
+
| `userId` | `string` | Authenticated user ID |
|
|
222
|
+
| `verbose` | `boolean` | Enable progress logging (default: `false`) |
|
|
223
|
+
|
|
224
|
+
Returns a `SyncResult`:
|
|
225
|
+
|
|
226
|
+
| Field | Type | Description |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| `syncCount` | `number` | Files successfully synced |
|
|
229
|
+
| `syncSize` | `number` | Bytes synced |
|
|
230
|
+
| `failedUploads` | `number` | Files that failed to upload |
|
|
231
|
+
| `totalCount` | `number` | Total file count (local + remote) |
|
|
232
|
+
| `totalSize` | `number` | Total size across all files |
|
|
233
|
+
| `rdfWritten` | `boolean` | Whether any RDF metadata was written |
|
|
234
|
+
|
|
142
235
|
## Advanced
|
|
143
236
|
|
|
144
237
|
Access the raw Firebase `Auth` instance for advanced use cases:
|