@raisindb/functions-types 0.2.4 → 0.2.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/raisin.d.ts +79 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raisindb/functions-types",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "TypeScript type definitions for the RaisinDB server-side function runtime (QuickJS)",
5
5
  "license": "MIT",
6
6
  "types": "raisin.d.ts",
package/raisin.d.ts CHANGED
@@ -158,6 +158,20 @@ interface RaisinNode {
158
158
  * @param data - Resource (from resize()), or { base64, mimeType, name }
159
159
  */
160
160
  addResource(propertyPath: string, data: Resource | ResourceUploadData | string): Promise<any>;
161
+
162
+ /**
163
+ * True if this node carries the given mixin (type-declared, transitively).
164
+ * Backed by the server-materialized effective-mixin set.
165
+ * @param mixinName - e.g., "app:SEO"
166
+ */
167
+ hasMixin(mixinName: string): boolean;
168
+
169
+ /**
170
+ * True if this node "is a" given type — its node_type, any `extends` ancestor,
171
+ * or any effective mixin.
172
+ * @param typeName - e.g., "app:Folder"
173
+ */
174
+ isNodeType(typeName: string): boolean;
161
175
  }
162
176
 
163
177
  interface ResourceUploadData {
@@ -166,6 +180,22 @@ interface ResourceUploadData {
166
180
  name?: string;
167
181
  }
168
182
 
183
+ /**
184
+ * A single entry in a node's revision history (newest first), returned by
185
+ * raisin.nodes.history(). Use `revision` with an at-revision read to fetch the
186
+ * full snapshot of that historical version.
187
+ */
188
+ interface RaisinRevisionEntry {
189
+ /** HLC revision string ("timestamp-counter"). */
190
+ revision: string;
191
+ /** When this revision was written (ISO 8601 string). */
192
+ updated_at?: string;
193
+ /** User ID who authored this revision. */
194
+ updated_by?: string;
195
+ /** True when the node was deleted at this revision (tombstone). */
196
+ deleted: boolean;
197
+ }
198
+
169
199
  interface NodeCreateData {
170
200
  name?: string;
171
201
  path?: string;
@@ -247,8 +277,15 @@ declare namespace raisin {
247
277
  function embed(request: any): Promise<any>;
248
278
  }
249
279
 
280
+ namespace branches {
281
+ function diff(branch: string, baseBranch: string): Promise<any>;
282
+ function compare(branch: string, baseBranch: string): Promise<any>;
283
+ function copyNodes(sourceBranch: string, targetBranch: string, opts: any): Promise<any>;
284
+ }
285
+
250
286
  namespace crypto {
251
287
  function uuid(): Promise<string>;
288
+ function verifyJwt(token: string, opts?: any | null): Promise<any>;
252
289
  }
253
290
 
254
291
  namespace date {
@@ -265,6 +302,10 @@ declare namespace raisin {
265
302
  function emit(eventType: string, data: any): Promise<void>;
266
303
  }
267
304
 
305
+ namespace flows {
306
+ function run(flowPath: string, input: any): Promise<any>;
307
+ }
308
+
268
309
  namespace functions {
269
310
  function execute(functionPath: string, arguments: any, context: any): Promise<any>;
270
311
  function call(functionPath: string, arguments: any): Promise<any>;
@@ -285,9 +326,31 @@ declare namespace raisin {
285
326
  function delete(url: string, options?: HttpOptions): Promise<HttpResponse>;
286
327
  }
287
328
 
329
+ namespace imap {
330
+ function fetchSince(conn: any, sinceUid: number, opts?: any | null): Promise<any>;
331
+ function listMailboxes(conn: any): Promise<any>;
332
+ function fetchMessage(conn: any, uid: number, opts?: any | null): Promise<any>;
333
+ }
334
+
335
+ namespace integrations {
336
+ function syncNow(mountId: string, mode?: string | null): Promise<any>;
337
+ }
338
+
339
+ namespace inventory {
340
+ function claim(pool: string, n: number, capacity: number): Promise<any>;
341
+ function release(pool: string, n: number): Promise<number>;
342
+ }
343
+
344
+ namespace locks {
345
+ function acquire(key: string, ttlMs: number, owner?: string | null): Promise<any>;
346
+ function release(key: string, token: number): Promise<boolean>;
347
+ function renew(key: string, token: number, ttlMs: number): Promise<boolean>;
348
+ }
349
+
288
350
  namespace nodes {
289
351
  function get(workspace: string, path: string): Promise<RaisinNode | null>;
290
352
  function getById(workspace: string, id: string): Promise<RaisinNode | null>;
353
+ function history(workspace: string, id: string, limit?: number | null): Promise<RaisinRevisionEntry[]>;
291
354
  function create(workspace: string, parentPath: string, data: any): Promise<RaisinNode>;
292
355
  function update(workspace: string, path: string, data: any): Promise<RaisinNode>;
293
356
  function delete(workspace: string, path: string): Promise<void>;
@@ -295,7 +358,16 @@ declare namespace raisin {
295
358
  function move(workspace: string, nodePath: string, newParentPath: string): Promise<RaisinNode>;
296
359
  function query(workspace: string, query: any): Promise<RaisinNode[]>;
297
360
  function getChildren(workspace: string, parentPath: string, limit?: number | null): Promise<RaisinNode[]>;
361
+ function applyChildOrder(workspace: string, parentPath: string, sourceBranch: string, targetBranch: string): Promise<void>;
298
362
  function addResource(workspace: string, nodePath: string, propertyPath: string, uploadData: any): Promise<any>;
363
+ /**
364
+ * Create a node under parentPath, auto-creating any missing ancestor folders.
365
+ */
366
+ function createDeep(workspace: string, parentPath: string, data: any, parentNodeType?: string): Promise<RaisinNode>;
367
+ /**
368
+ * Upsert a node by path (create-or-update), auto-creating any missing ancestor folders.
369
+ */
370
+ function upsertDeep(workspace: string, data: any, parentNodeType?: string): Promise<void>;
299
371
  /**
300
372
  * Start a transaction for atomic multi-node operations.
301
373
  * @example
@@ -314,6 +386,13 @@ declare namespace raisin {
314
386
  function getBinary(storageKey: string): Promise<string>;
315
387
  }
316
388
 
389
+ namespace scheduler {
390
+ function schedule(request: any): Promise<any>;
391
+ function cancel(jobIdOrKey: string): Promise<any>;
392
+ function list(filter?: any | null): Promise<any>;
393
+ function get(jobIdOrKey: string): Promise<any>;
394
+ }
395
+
317
396
  namespace sql {
318
397
  function query(sql: string, params: any[]): Promise<any>;
319
398
  function execute(sql: string, params: any[]): Promise<number>;