@centrali-io/centrali-sdk 4.2.4 → 4.3.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/dist/index.js +9 -12
- package/index.ts +30 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
@@ -987,6 +987,21 @@ export interface OrchestrationDecisionCase {
|
|
|
987
987
|
nextStepId: string;
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Encrypted parameter for a compute step. To encrypt a new value, set encrypt=true and value=plaintext.
|
|
992
|
+
* Stored values have encrypted=true and value is masked in API responses.
|
|
993
|
+
*/
|
|
994
|
+
export interface StepEncryptedParam {
|
|
995
|
+
/** The parameter value (plaintext on create, masked as "********" on read) */
|
|
996
|
+
value: string;
|
|
997
|
+
/** True when the value is encrypted at rest */
|
|
998
|
+
encrypted?: boolean;
|
|
999
|
+
/** Encryption key version (for key rotation support) */
|
|
1000
|
+
keyVersion?: number;
|
|
1001
|
+
/** Client flag: set to true to encrypt this plaintext value */
|
|
1002
|
+
encrypt?: boolean;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
990
1005
|
/**
|
|
991
1006
|
* Orchestration step definition.
|
|
992
1007
|
*/
|
|
@@ -1009,6 +1024,8 @@ export interface OrchestrationStep {
|
|
|
1009
1024
|
onSuccess?: OrchestrationOnSuccess;
|
|
1010
1025
|
/** On failure handler (for compute steps) */
|
|
1011
1026
|
onFailure?: OrchestrationOnFailure;
|
|
1027
|
+
/** Encrypted parameters for compute steps. Secrets are encrypted at rest and decrypted at execution time. */
|
|
1028
|
+
encryptedParams?: Record<string, StepEncryptedParam>;
|
|
1012
1029
|
|
|
1013
1030
|
// Decision step fields
|
|
1014
1031
|
/** Decision cases (for decision steps) */
|
|
@@ -1707,10 +1724,9 @@ export interface ComputeFunction {
|
|
|
1707
1724
|
*/
|
|
1708
1725
|
export interface CreateComputeFunctionInput {
|
|
1709
1726
|
name: string;
|
|
1710
|
-
slug: string;
|
|
1711
1727
|
code: string;
|
|
1712
1728
|
description?: string;
|
|
1713
|
-
|
|
1729
|
+
timeoutMs?: number;
|
|
1714
1730
|
}
|
|
1715
1731
|
|
|
1716
1732
|
/**
|
|
@@ -1720,7 +1736,7 @@ export interface UpdateComputeFunctionInput {
|
|
|
1720
1736
|
name?: string;
|
|
1721
1737
|
description?: string;
|
|
1722
1738
|
code?: string;
|
|
1723
|
-
|
|
1739
|
+
timeoutMs?: number;
|
|
1724
1740
|
}
|
|
1725
1741
|
|
|
1726
1742
|
/**
|
|
@@ -1738,7 +1754,8 @@ export interface ListComputeFunctionsOptions {
|
|
|
1738
1754
|
*/
|
|
1739
1755
|
export interface TestComputeFunctionInput {
|
|
1740
1756
|
code: string;
|
|
1741
|
-
|
|
1757
|
+
params?: Record<string, any>;
|
|
1758
|
+
timeoutMs?: number;
|
|
1742
1759
|
}
|
|
1743
1760
|
|
|
1744
1761
|
/**
|
|
@@ -4598,14 +4615,13 @@ export class CollectionsManager {
|
|
|
4598
4615
|
* // Create a new function
|
|
4599
4616
|
* const fn = await client.functions.create({
|
|
4600
4617
|
* name: 'Process Order',
|
|
4601
|
-
* slug: 'process-order',
|
|
4602
4618
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }'
|
|
4603
4619
|
* });
|
|
4604
4620
|
*
|
|
4605
4621
|
* // Test execute code without saving
|
|
4606
4622
|
* const result = await client.functions.testExecute({
|
|
4607
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
4608
|
-
*
|
|
4623
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
4624
|
+
* params: { orderId: '123' }
|
|
4609
4625
|
* });
|
|
4610
4626
|
* ```
|
|
4611
4627
|
*/
|
|
@@ -4665,10 +4681,9 @@ export class ComputeFunctionsManager {
|
|
|
4665
4681
|
* ```ts
|
|
4666
4682
|
* const fn = await client.functions.create({
|
|
4667
4683
|
* name: 'Process Order',
|
|
4668
|
-
* slug: 'process-order',
|
|
4669
4684
|
* code: 'module.exports = async (ctx) => { return { processed: true }; }',
|
|
4670
4685
|
* description: 'Processes incoming orders',
|
|
4671
|
-
*
|
|
4686
|
+
* timeoutMs: 60000
|
|
4672
4687
|
* });
|
|
4673
4688
|
* ```
|
|
4674
4689
|
*/
|
|
@@ -4688,7 +4703,7 @@ export class ComputeFunctionsManager {
|
|
|
4688
4703
|
* ```ts
|
|
4689
4704
|
* const updated = await client.functions.update('function-uuid', {
|
|
4690
4705
|
* code: 'module.exports = async (ctx) => { return { v2: true }; }',
|
|
4691
|
-
*
|
|
4706
|
+
* timeoutMs: 120000
|
|
4692
4707
|
* });
|
|
4693
4708
|
* ```
|
|
4694
4709
|
*/
|
|
@@ -4722,8 +4737,8 @@ export class ComputeFunctionsManager {
|
|
|
4722
4737
|
* @example
|
|
4723
4738
|
* ```ts
|
|
4724
4739
|
* const result = await client.functions.testExecute({
|
|
4725
|
-
* code: 'module.exports = async (ctx) => { return { sum: ctx.
|
|
4726
|
-
*
|
|
4740
|
+
* code: 'module.exports = async (ctx) => { return { sum: ctx.executionParams.a + ctx.executionParams.b }; }',
|
|
4741
|
+
* params: { a: 1, b: 2 }
|
|
4727
4742
|
* });
|
|
4728
4743
|
* console.log('Output:', result.data.output); // { sum: 3 }
|
|
4729
4744
|
* console.log('Duration:', result.data.duration_ms, 'ms');
|
|
@@ -5153,14 +5168,13 @@ export class CentraliSDK {
|
|
|
5153
5168
|
* // Create a function
|
|
5154
5169
|
* const fn = await client.functions.create({
|
|
5155
5170
|
* name: 'Process Order',
|
|
5156
|
-
|
|
5157
|
-
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
5171
|
+
* code: 'module.exports = async (ctx) => { return { ok: true }; }'
|
|
5158
5172
|
* });
|
|
5159
5173
|
*
|
|
5160
5174
|
* // Test execute without saving
|
|
5161
5175
|
* const result = await client.functions.testExecute({
|
|
5162
|
-
* code: 'module.exports = async (ctx) => { return ctx.
|
|
5163
|
-
*
|
|
5176
|
+
* code: 'module.exports = async (ctx) => { return ctx.executionParams; }',
|
|
5177
|
+
* params: { test: true }
|
|
5164
5178
|
* });
|
|
5165
5179
|
* ```
|
|
5166
5180
|
*/
|