@centrali-io/centrali-sdk 4.2.3 → 4.2.5
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/index.js +12 -15
- package/index.ts +17 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2217,7 +2217,7 @@ exports.StructuresManager = StructuresManager;
|
|
|
2217
2217
|
* // Create a new collection
|
|
2218
2218
|
* const collection = await client.collections.create({
|
|
2219
2219
|
* name: 'Orders',
|
|
2220
|
-
*
|
|
2220
|
+
* recordSlug: 'orders',
|
|
2221
2221
|
* properties: [
|
|
2222
2222
|
* { name: 'title', type: 'string', required: true },
|
|
2223
2223
|
* { name: 'amount', type: 'number', minimum: 0 }
|
|
@@ -2225,7 +2225,7 @@ exports.StructuresManager = StructuresManager;
|
|
|
2225
2225
|
* });
|
|
2226
2226
|
*
|
|
2227
2227
|
* // Validate before creating
|
|
2228
|
-
* const validation = await client.collections.validate({
|
|
2228
|
+
* const validation = await client.collections.validate({ recordSlug: 'orders' });
|
|
2229
2229
|
* ```
|
|
2230
2230
|
*/
|
|
2231
2231
|
class CollectionsManager {
|
|
@@ -2291,7 +2291,7 @@ class CollectionsManager {
|
|
|
2291
2291
|
* ```ts
|
|
2292
2292
|
* const collection = await client.collections.create({
|
|
2293
2293
|
* name: 'Orders',
|
|
2294
|
-
*
|
|
2294
|
+
* recordSlug: 'orders',
|
|
2295
2295
|
* description: 'Customer orders',
|
|
2296
2296
|
* properties: [
|
|
2297
2297
|
* { name: 'title', type: 'string', required: true },
|
|
@@ -2382,14 +2382,13 @@ exports.CollectionsManager = CollectionsManager;
|
|
|
2382
2382
|
* // Create a new function
|
|
2383
2383
|
* const fn = await client.functions.create({
|
|
2384
2384
|
* name: 'Process Order',
|
|
2385
|
-
* slug: 'process-order',
|
|
2386
2385
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }'
|
|
2387
2386
|
* });
|
|
2388
2387
|
*
|
|
2389
2388
|
* // Test execute code without saving
|
|
2390
2389
|
* const result = await client.functions.testExecute({
|
|
2391
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
2392
|
-
*
|
|
2390
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
2391
|
+
* params: { orderId: '123' }
|
|
2393
2392
|
* });
|
|
2394
2393
|
* ```
|
|
2395
2394
|
*/
|
|
@@ -2440,10 +2439,9 @@ class ComputeFunctionsManager {
|
|
|
2440
2439
|
* ```ts
|
|
2441
2440
|
* const fn = await client.functions.create({
|
|
2442
2441
|
* name: 'Process Order',
|
|
2443
|
-
* slug: 'process-order',
|
|
2444
2442
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }',
|
|
2445
2443
|
* description: 'Processes incoming orders',
|
|
2446
|
-
*
|
|
2444
|
+
* timeoutMs: 60000
|
|
2447
2445
|
* });
|
|
2448
2446
|
* ```
|
|
2449
2447
|
*/
|
|
@@ -2462,7 +2460,7 @@ class ComputeFunctionsManager {
|
|
|
2462
2460
|
* ```ts
|
|
2463
2461
|
* const updated = await client.functions.update('function-uuid', {
|
|
2464
2462
|
* code: 'module.exports = async (ctx) => { return { v2: true }; }',
|
|
2465
|
-
*
|
|
2463
|
+
* timeoutMs: 120000
|
|
2466
2464
|
* });
|
|
2467
2465
|
* ```
|
|
2468
2466
|
*/
|
|
@@ -2494,8 +2492,8 @@ class ComputeFunctionsManager {
|
|
|
2494
2492
|
* @example
|
|
2495
2493
|
* ```ts
|
|
2496
2494
|
* const result = await client.functions.testExecute({
|
|
2497
|
-
* code: 'module.exports = async (ctx) => { return { sum: ctx.
|
|
2498
|
-
*
|
|
2495
|
+
* code: 'module.exports = async (ctx) => { return { sum: ctx.executionParams.a + ctx.executionParams.b }; }',
|
|
2496
|
+
* params: { a: 1, b: 2 }
|
|
2499
2497
|
* });
|
|
2500
2498
|
* console.log('Output:', result.data.output); // { sum: 3 }
|
|
2501
2499
|
* console.log('Duration:', result.data.duration_ms, 'ms');
|
|
@@ -2857,14 +2855,13 @@ class CentraliSDK {
|
|
|
2857
2855
|
* // Create a function
|
|
2858
2856
|
* const fn = await client.functions.create({
|
|
2859
2857
|
* name: 'Process Order',
|
|
2860
|
-
|
|
2861
|
-
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
2858
|
+
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
2862
2859
|
* });
|
|
2863
2860
|
*
|
|
2864
2861
|
* // Test execute without saving
|
|
2865
2862
|
* const result = await client.functions.testExecute({
|
|
2866
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
2867
|
-
*
|
|
2863
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
2864
|
+
* params: { test: true }
|
|
2868
2865
|
* });
|
|
2869
2866
|
* ```
|
|
2870
2867
|
*/
|
package/index.ts
CHANGED
|
@@ -1639,7 +1639,7 @@ export interface Structure {
|
|
|
1639
1639
|
*/
|
|
1640
1640
|
export interface CreateStructureInput {
|
|
1641
1641
|
name: string;
|
|
1642
|
-
|
|
1642
|
+
recordSlug: string;
|
|
1643
1643
|
description?: string;
|
|
1644
1644
|
properties?: PropertyDefinition[];
|
|
1645
1645
|
enableVersioning?: boolean;
|
|
@@ -1707,10 +1707,9 @@ export interface ComputeFunction {
|
|
|
1707
1707
|
*/
|
|
1708
1708
|
export interface CreateComputeFunctionInput {
|
|
1709
1709
|
name: string;
|
|
1710
|
-
slug: string;
|
|
1711
1710
|
code: string;
|
|
1712
1711
|
description?: string;
|
|
1713
|
-
|
|
1712
|
+
timeoutMs?: number;
|
|
1714
1713
|
}
|
|
1715
1714
|
|
|
1716
1715
|
/**
|
|
@@ -1720,7 +1719,7 @@ export interface UpdateComputeFunctionInput {
|
|
|
1720
1719
|
name?: string;
|
|
1721
1720
|
description?: string;
|
|
1722
1721
|
code?: string;
|
|
1723
|
-
|
|
1722
|
+
timeoutMs?: number;
|
|
1724
1723
|
}
|
|
1725
1724
|
|
|
1726
1725
|
/**
|
|
@@ -1738,7 +1737,8 @@ export interface ListComputeFunctionsOptions {
|
|
|
1738
1737
|
*/
|
|
1739
1738
|
export interface TestComputeFunctionInput {
|
|
1740
1739
|
code: string;
|
|
1741
|
-
|
|
1740
|
+
params?: Record<string, any>;
|
|
1741
|
+
timeoutMs?: number;
|
|
1742
1742
|
}
|
|
1743
1743
|
|
|
1744
1744
|
/**
|
|
@@ -4419,7 +4419,7 @@ export class StructuresManager {
|
|
|
4419
4419
|
* // Create a new collection
|
|
4420
4420
|
* const collection = await client.collections.create({
|
|
4421
4421
|
* name: 'Orders',
|
|
4422
|
-
*
|
|
4422
|
+
* recordSlug: 'orders',
|
|
4423
4423
|
* properties: [
|
|
4424
4424
|
* { name: 'title', type: 'string', required: true },
|
|
4425
4425
|
* { name: 'amount', type: 'number', minimum: 0 }
|
|
@@ -4427,7 +4427,7 @@ export class StructuresManager {
|
|
|
4427
4427
|
* });
|
|
4428
4428
|
*
|
|
4429
4429
|
* // Validate before creating
|
|
4430
|
-
* const validation = await client.collections.validate({
|
|
4430
|
+
* const validation = await client.collections.validate({ recordSlug: 'orders' });
|
|
4431
4431
|
* ```
|
|
4432
4432
|
*/
|
|
4433
4433
|
export class CollectionsManager {
|
|
@@ -4503,7 +4503,7 @@ export class CollectionsManager {
|
|
|
4503
4503
|
* ```ts
|
|
4504
4504
|
* const collection = await client.collections.create({
|
|
4505
4505
|
* name: 'Orders',
|
|
4506
|
-
*
|
|
4506
|
+
* recordSlug: 'orders',
|
|
4507
4507
|
* description: 'Customer orders',
|
|
4508
4508
|
* properties: [
|
|
4509
4509
|
* { name: 'title', type: 'string', required: true },
|
|
@@ -4598,14 +4598,13 @@ export class CollectionsManager {
|
|
|
4598
4598
|
* // Create a new function
|
|
4599
4599
|
* const fn = await client.functions.create({
|
|
4600
4600
|
* name: 'Process Order',
|
|
4601
|
-
* slug: 'process-order',
|
|
4602
4601
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }'
|
|
4603
4602
|
* });
|
|
4604
4603
|
*
|
|
4605
4604
|
* // Test execute code without saving
|
|
4606
4605
|
* const result = await client.functions.testExecute({
|
|
4607
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
4608
|
-
*
|
|
4606
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
4607
|
+
* params: { orderId: '123' }
|
|
4609
4608
|
* });
|
|
4610
4609
|
* ```
|
|
4611
4610
|
*/
|
|
@@ -4665,10 +4664,9 @@ export class ComputeFunctionsManager {
|
|
|
4665
4664
|
* ```ts
|
|
4666
4665
|
* const fn = await client.functions.create({
|
|
4667
4666
|
* name: 'Process Order',
|
|
4668
|
-
* slug: 'process-order',
|
|
4669
4667
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }',
|
|
4670
4668
|
* description: 'Processes incoming orders',
|
|
4671
|
-
*
|
|
4669
|
+
* timeoutMs: 60000
|
|
4672
4670
|
* });
|
|
4673
4671
|
* ```
|
|
4674
4672
|
*/
|
|
@@ -4688,7 +4686,7 @@ export class ComputeFunctionsManager {
|
|
|
4688
4686
|
* ```ts
|
|
4689
4687
|
* const updated = await client.functions.update('function-uuid', {
|
|
4690
4688
|
* code: 'module.exports = async (ctx) => { return { v2: true }; }',
|
|
4691
|
-
*
|
|
4689
|
+
* timeoutMs: 120000
|
|
4692
4690
|
* });
|
|
4693
4691
|
* ```
|
|
4694
4692
|
*/
|
|
@@ -4722,8 +4720,8 @@ export class ComputeFunctionsManager {
|
|
|
4722
4720
|
* @example
|
|
4723
4721
|
* ```ts
|
|
4724
4722
|
* const result = await client.functions.testExecute({
|
|
4725
|
-
* code: 'module.exports = async (ctx) => { return { sum: ctx.
|
|
4726
|
-
*
|
|
4723
|
+
* code: 'module.exports = async (ctx) => { return { sum: ctx.executionParams.a + ctx.executionParams.b }; }',
|
|
4724
|
+
* params: { a: 1, b: 2 }
|
|
4727
4725
|
* });
|
|
4728
4726
|
* console.log('Output:', result.data.output); // { sum: 3 }
|
|
4729
4727
|
* console.log('Duration:', result.data.duration_ms, 'ms');
|
|
@@ -5153,14 +5151,13 @@ export class CentraliSDK {
|
|
|
5153
5151
|
* // Create a function
|
|
5154
5152
|
* const fn = await client.functions.create({
|
|
5155
5153
|
* name: 'Process Order',
|
|
5156
|
-
|
|
5157
|
-
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
5154
|
+
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
5158
5155
|
* });
|
|
5159
5156
|
*
|
|
5160
5157
|
* // Test execute without saving
|
|
5161
5158
|
* const result = await client.functions.testExecute({
|
|
5162
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
5163
|
-
*
|
|
5159
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
5160
|
+
* params: { test: true }
|
|
5164
5161
|
* });
|
|
5165
5162
|
* ```
|
|
5166
5163
|
*/
|