zinkee 0.1.15 → 0.1.17
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 +811 -1303
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli-examples.ts +3 -58
- package/src/cli-runner.ts +1 -5
- package/src/index.test.ts +1 -8
- package/src/utils/examples.test.ts +22 -1
- package/src/utils/examples.ts +6 -549
- package/src/utils/schema-fields.ts +1 -1
- package/.claude/settings.local.json +0 -44
package/src/utils/examples.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { AutomationsApi } from "../api/automations.js";
|
|
2
|
-
import { SchemasApi, type ApiSchema, type ApiSchemaField } from "../api/schemas.js";
|
|
3
|
-
import { ApiClient } from "../client.js";
|
|
4
|
-
import { defaultConfigPath, readRuntimeConfig } from "../config.js";
|
|
5
|
-
import type { NormalizedUuidOrSlug } from "../parsers/selectors.js";
|
|
6
|
-
import { resolveRuntimeContext } from "../runtime-context.js";
|
|
7
|
-
import type { RuntimeOverrides } from "../types.js";
|
|
8
1
|
import {
|
|
9
2
|
getSchemaFieldTypeDefinitions,
|
|
10
3
|
resolveSchemaFieldType,
|
|
@@ -17,12 +10,6 @@ export interface CommandExample {
|
|
|
17
10
|
response?: string;
|
|
18
11
|
}
|
|
19
12
|
|
|
20
|
-
export interface ExampleContextOptions {
|
|
21
|
-
enabled?: boolean;
|
|
22
|
-
configPath?: string;
|
|
23
|
-
overrides?: RuntimeOverrides;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
13
|
export function buildCommandExample(example: CommandExample): CommandExample {
|
|
27
14
|
return {
|
|
28
15
|
command: example.command,
|
|
@@ -623,9 +610,9 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
623
610
|
},
|
|
624
611
|
{
|
|
625
612
|
description:
|
|
626
|
-
"Create a record mixing text, option, number, date and
|
|
613
|
+
"Create a record mixing text, option, number, date, reference and member fields. ReferenceField values must match the target's current targetDisplayField (read it from the target record before writing).",
|
|
627
614
|
command:
|
|
628
|
-
`zinkee --json records create contacts --set contact-name="Grace Hopper" --set contact-email=grace@example.com --set
|
|
615
|
+
`zinkee --json records create contacts --set contact-name="Grace Hopper" --set contact-email=grace@example.com --set status=2 --set amount=1999.99 --set due-date=2026-06-01T09:00:00Z --set customer-ref="CUST-12" --set owner=6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d`,
|
|
629
616
|
raw: `{
|
|
630
617
|
"values": {
|
|
631
618
|
"contact-name": "Grace Hopper",
|
|
@@ -633,7 +620,7 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
633
620
|
"status": 2,
|
|
634
621
|
"amount": 1999.99,
|
|
635
622
|
"due-date": "2026-06-01T09:00:00Z",
|
|
636
|
-
"customer-ref": "
|
|
623
|
+
"customer-ref": "CUST-12",
|
|
637
624
|
"owner": "6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d"
|
|
638
625
|
}
|
|
639
626
|
}`,
|
|
@@ -664,7 +651,7 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
664
651
|
{
|
|
665
652
|
description: "Patch multiple typed values at once.",
|
|
666
653
|
command:
|
|
667
|
-
'zinkee --json records update contacts 550e8400-e29b-41d4-a716-446655440000 --set
|
|
654
|
+
'zinkee --json records update contacts 550e8400-e29b-41d4-a716-446655440000 --set status=3 --set amount=2500.00 --set due-date=2026-07-01T09:00:00Z --set owner=6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d',
|
|
668
655
|
raw: `{
|
|
669
656
|
"set": {
|
|
670
657
|
"status": 3,
|
|
@@ -3705,539 +3692,9 @@ export function getCommandExamples(
|
|
|
3705
3692
|
return specificExamples[commandName] ?? fallbackExamples(commandName);
|
|
3706
3693
|
}
|
|
3707
3694
|
|
|
3708
|
-
|
|
3709
|
-
automationsApi: AutomationsApi;
|
|
3710
|
-
schemasApi: SchemasApi;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
interface SchemaFieldReference {
|
|
3714
|
-
schemaId: string;
|
|
3715
|
-
schemaRef: string;
|
|
3716
|
-
fieldId: string;
|
|
3717
|
-
fieldRef: string;
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
interface AutomationActionReference {
|
|
3721
|
-
automationId: string;
|
|
3722
|
-
actionId: string;
|
|
3723
|
-
}
|
|
3724
|
-
|
|
3725
|
-
function selector(value: string): NormalizedUuidOrSlug {
|
|
3726
|
-
return {
|
|
3727
|
-
kind: "uuid",
|
|
3728
|
-
value,
|
|
3729
|
-
};
|
|
3730
|
-
}
|
|
3731
|
-
|
|
3732
|
-
async function createExampleAutomationContext(
|
|
3733
|
-
options: ExampleContextOptions = {},
|
|
3734
|
-
): Promise<ExampleAutomationContext | null> {
|
|
3735
|
-
if (options.enabled !== true) {
|
|
3736
|
-
return null;
|
|
3737
|
-
}
|
|
3738
|
-
|
|
3739
|
-
try {
|
|
3740
|
-
const config = readRuntimeConfig(options.configPath ?? defaultConfigPath);
|
|
3741
|
-
const runtime = resolveRuntimeContext(config, options.overrides);
|
|
3742
|
-
|
|
3743
|
-
if (!runtime.baseUrl) {
|
|
3744
|
-
return null;
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
const client = new ApiClient({
|
|
3748
|
-
baseUrl: runtime.baseUrl,
|
|
3749
|
-
apiKey: runtime.apiKey,
|
|
3750
|
-
});
|
|
3751
|
-
|
|
3752
|
-
return {
|
|
3753
|
-
automationsApi: new AutomationsApi(client),
|
|
3754
|
-
schemasApi: new SchemasApi(client),
|
|
3755
|
-
};
|
|
3756
|
-
} catch {
|
|
3757
|
-
return null;
|
|
3758
|
-
}
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
function referenceValue(value: { slug?: string; id?: string }): string | undefined {
|
|
3762
|
-
return value.slug ?? value.id;
|
|
3763
|
-
}
|
|
3764
|
-
|
|
3765
|
-
function pickExampleField(fields: readonly ApiSchemaField[]): ApiSchemaField | undefined {
|
|
3766
|
-
return fields.find((field) => !field.required || field.slug || field.id) ?? fields[0];
|
|
3767
|
-
}
|
|
3768
|
-
|
|
3769
|
-
async function findSchemaFieldReference(
|
|
3770
|
-
context: ExampleAutomationContext,
|
|
3771
|
-
): Promise<SchemaFieldReference | null> {
|
|
3772
|
-
const schemas = await context.schemasApi.listSchemas();
|
|
3773
|
-
|
|
3774
|
-
for (const schema of schemas) {
|
|
3775
|
-
if (typeof schema.id !== "string") {
|
|
3776
|
-
continue;
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
|
-
const fullSchema = await context.schemasApi.getSchema(selector(schema.id));
|
|
3780
|
-
const fields = Array.isArray(fullSchema.fields) ? fullSchema.fields : [];
|
|
3781
|
-
const field = pickExampleField(fields);
|
|
3782
|
-
const schemaRef = referenceValue(schema);
|
|
3783
|
-
const fieldRef = field ? referenceValue(field) : undefined;
|
|
3784
|
-
const fieldId = typeof field?.id === "string" ? field.id : undefined;
|
|
3785
|
-
|
|
3786
|
-
if (!schemaRef || !fieldRef || !fieldId) {
|
|
3787
|
-
continue;
|
|
3788
|
-
}
|
|
3789
|
-
|
|
3790
|
-
return {
|
|
3791
|
-
schemaId: schema.id,
|
|
3792
|
-
schemaRef,
|
|
3793
|
-
fieldId,
|
|
3794
|
-
fieldRef,
|
|
3795
|
-
};
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
return null;
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
|
-
async function findAutomationId(context: ExampleAutomationContext): Promise<string | null> {
|
|
3802
|
-
const automations = await context.automationsApi.listAutomations();
|
|
3803
|
-
const first = automations.find((automation) => typeof automation.id === "string");
|
|
3804
|
-
return typeof first?.id === "string" ? first.id : null;
|
|
3805
|
-
}
|
|
3806
|
-
|
|
3807
|
-
async function findAutomationWithAction(
|
|
3808
|
-
context: ExampleAutomationContext,
|
|
3809
|
-
): Promise<AutomationActionReference | null> {
|
|
3810
|
-
const automations = await context.automationsApi.listAutomations();
|
|
3811
|
-
|
|
3812
|
-
for (const automation of automations) {
|
|
3813
|
-
if (typeof automation.id !== "string") {
|
|
3814
|
-
continue;
|
|
3815
|
-
}
|
|
3816
|
-
|
|
3817
|
-
const actions = await context.automationsApi.listActions(selector(automation.id));
|
|
3818
|
-
const firstAction = actions.find((action) => typeof action.id === "string");
|
|
3819
|
-
|
|
3820
|
-
if (typeof firstAction?.id === "string") {
|
|
3821
|
-
return {
|
|
3822
|
-
automationId: automation.id,
|
|
3823
|
-
actionId: firstAction.id,
|
|
3824
|
-
};
|
|
3825
|
-
}
|
|
3826
|
-
}
|
|
3827
|
-
|
|
3828
|
-
return null;
|
|
3829
|
-
}
|
|
3830
|
-
|
|
3831
|
-
async function buildDynamicAutomationExamples(
|
|
3832
|
-
commandName: string,
|
|
3833
|
-
options: ExampleContextOptions = {},
|
|
3834
|
-
): Promise<readonly CommandExample[]> {
|
|
3835
|
-
const context = await createExampleAutomationContext(options);
|
|
3836
|
-
|
|
3837
|
-
if (!context) {
|
|
3838
|
-
return [];
|
|
3839
|
-
}
|
|
3840
|
-
|
|
3841
|
-
const schemaField = await findSchemaFieldReference(context);
|
|
3842
|
-
const automationId = await findAutomationId(context);
|
|
3843
|
-
const automationWithAction = await findAutomationWithAction(context);
|
|
3844
|
-
const plugins = await context.automationsApi.listPlugins();
|
|
3845
|
-
const pluginId = typeof plugins[0]?.id === "string" ? plugins[0].id : undefined;
|
|
3846
|
-
const connections = await context.automationsApi.listConnections();
|
|
3847
|
-
const connectionId = typeof connections[0]?.id === "string" ? connections[0].id : undefined;
|
|
3848
|
-
|
|
3849
|
-
switch (commandName) {
|
|
3850
|
-
case "automations create":
|
|
3851
|
-
if (!schemaField) {
|
|
3852
|
-
return [];
|
|
3853
|
-
}
|
|
3854
|
-
return buildCommandExamples([
|
|
3855
|
-
{
|
|
3856
|
-
description:
|
|
3857
|
-
"Create a scheduled automation with a six-field cron expression. This is the safest first example because it does not depend on workspace schemas.",
|
|
3858
|
-
command:
|
|
3859
|
-
'zinkee --json automations create --name "Nightly invoice sync" --trigger-type scheduled --cron "0 15 10 * * 1"',
|
|
3860
|
-
raw: `{
|
|
3861
|
-
"name": "Nightly invoice sync",
|
|
3862
|
-
"trigger": {
|
|
3863
|
-
"type": "scheduled",
|
|
3864
|
-
"config": {
|
|
3865
|
-
"cronExpression": "0 15 10 * * 1"
|
|
3866
|
-
}
|
|
3867
|
-
}
|
|
3868
|
-
}`,
|
|
3869
|
-
response: `{
|
|
3870
|
-
"automationId": "d2df2478-2513-4ecb-a2aa-2cea8c3d614a",
|
|
3871
|
-
"webhookEndpoint": null
|
|
3872
|
-
}`,
|
|
3873
|
-
},
|
|
3874
|
-
{
|
|
3875
|
-
description:
|
|
3876
|
-
`Create a record-created automation using a real schema reference from this workspace (${schemaField.schemaRef}), with an 'is not empty' condition on ${schemaField.fieldRef}.`,
|
|
3877
|
-
command: `zinkee --json automations create --name "Record created demo" --trigger-type record_created --trigger-schema ${schemaField.schemaRef} --condition-json '{"field":"${schemaField.fieldRef}","comparator":"ine","values":[{"rawValue":"","source":null}]}'`,
|
|
3878
|
-
raw: `{
|
|
3879
|
-
"name": "Record created demo",
|
|
3880
|
-
"trigger": {
|
|
3881
|
-
"type": "record_created",
|
|
3882
|
-
"config": {
|
|
3883
|
-
"schemaId": "${schemaField.schemaRef}",
|
|
3884
|
-
"conditions": [
|
|
3885
|
-
{
|
|
3886
|
-
"field": "${schemaField.fieldRef}",
|
|
3887
|
-
"comparator": "ine",
|
|
3888
|
-
"values": [{"rawValue": "", "source": null}]
|
|
3889
|
-
}
|
|
3890
|
-
]
|
|
3891
|
-
}
|
|
3892
|
-
}
|
|
3893
|
-
}`,
|
|
3894
|
-
},
|
|
3895
|
-
{
|
|
3896
|
-
description:
|
|
3897
|
-
`Create a record-changed automation watching ${schemaField.fieldRef} on ${schemaField.schemaRef}, with an 'is not empty' condition on that field.`,
|
|
3898
|
-
command: `zinkee --json automations create --name "Record changed demo" --trigger-type record_changed --trigger-schema ${schemaField.schemaRef} --trigger-field ${schemaField.fieldRef} --condition-json '{"field":"${schemaField.fieldRef}","comparator":"ine","values":[{"rawValue":"","source":null}]}'`,
|
|
3899
|
-
raw: `{
|
|
3900
|
-
"name": "Record changed demo",
|
|
3901
|
-
"trigger": {
|
|
3902
|
-
"type": "record_changed",
|
|
3903
|
-
"config": {
|
|
3904
|
-
"schemaId": "${schemaField.schemaRef}",
|
|
3905
|
-
"fieldIds": ["${schemaField.fieldRef}"],
|
|
3906
|
-
"conditions": [
|
|
3907
|
-
{
|
|
3908
|
-
"field": "${schemaField.fieldRef}",
|
|
3909
|
-
"comparator": "ine",
|
|
3910
|
-
"values": [{"rawValue": "", "source": null}]
|
|
3911
|
-
}
|
|
3912
|
-
]
|
|
3913
|
-
}
|
|
3914
|
-
}
|
|
3915
|
-
}`,
|
|
3916
|
-
},
|
|
3917
|
-
]);
|
|
3918
|
-
case "automations trigger set":
|
|
3919
|
-
if (!automationId || !schemaField) {
|
|
3920
|
-
return [];
|
|
3921
|
-
}
|
|
3922
|
-
return buildCommandExamples([
|
|
3923
|
-
{
|
|
3924
|
-
description: "Replace the trigger with a scheduled trigger on a real automation from this workspace.",
|
|
3925
|
-
command: `zinkee --json automations trigger set ${automationId} --trigger-type scheduled --cron "0 15 10 * * 1"`,
|
|
3926
|
-
raw: `{
|
|
3927
|
-
"type": "scheduled",
|
|
3928
|
-
"config": {
|
|
3929
|
-
"cronExpression": "0 15 10 * * 1"
|
|
3930
|
-
}
|
|
3931
|
-
}`,
|
|
3932
|
-
},
|
|
3933
|
-
{
|
|
3934
|
-
description:
|
|
3935
|
-
`Replace the trigger with a record-created trigger on ${schemaField.schemaRef}, with an 'is not empty' condition on ${schemaField.fieldRef}.`,
|
|
3936
|
-
command: `zinkee --json automations trigger set ${automationId} --trigger-type record_created --trigger-schema ${schemaField.schemaRef} --condition-json '{"field":"${schemaField.fieldRef}","comparator":"ine","values":[{"rawValue":"","source":null}]}'`,
|
|
3937
|
-
raw: `{
|
|
3938
|
-
"type": "record_created",
|
|
3939
|
-
"config": {
|
|
3940
|
-
"schemaId": "${schemaField.schemaRef}",
|
|
3941
|
-
"conditions": [
|
|
3942
|
-
{
|
|
3943
|
-
"field": "${schemaField.fieldRef}",
|
|
3944
|
-
"comparator": "ine",
|
|
3945
|
-
"values": [{"rawValue": "", "source": null}]
|
|
3946
|
-
}
|
|
3947
|
-
]
|
|
3948
|
-
}
|
|
3949
|
-
}`,
|
|
3950
|
-
},
|
|
3951
|
-
{
|
|
3952
|
-
description:
|
|
3953
|
-
`Replace the trigger with a record-changed trigger watching ${schemaField.fieldRef} on ${schemaField.schemaRef}.`,
|
|
3954
|
-
command: `zinkee --json automations trigger set ${automationId} --trigger-type record_changed --trigger-schema ${schemaField.schemaRef} --trigger-field ${schemaField.fieldRef} --condition-json '{"field":"${schemaField.fieldRef}","comparator":"ine","values":[{"rawValue":"","source":null}]}'`,
|
|
3955
|
-
raw: `{
|
|
3956
|
-
"type": "record_changed",
|
|
3957
|
-
"config": {
|
|
3958
|
-
"schemaId": "${schemaField.schemaRef}",
|
|
3959
|
-
"fieldIds": ["${schemaField.fieldRef}"],
|
|
3960
|
-
"conditions": [
|
|
3961
|
-
{
|
|
3962
|
-
"field": "${schemaField.fieldRef}",
|
|
3963
|
-
"comparator": "ine",
|
|
3964
|
-
"values": [{"rawValue": "", "source": null}]
|
|
3965
|
-
}
|
|
3966
|
-
]
|
|
3967
|
-
}
|
|
3968
|
-
}`,
|
|
3969
|
-
},
|
|
3970
|
-
]);
|
|
3971
|
-
case "automations actions add":
|
|
3972
|
-
if (!automationId || !schemaField) {
|
|
3973
|
-
return [];
|
|
3974
|
-
}
|
|
3975
|
-
return buildCommandExamples([
|
|
3976
|
-
{
|
|
3977
|
-
description:
|
|
3978
|
-
`Add a create-record action with literal and trigger-based mappings targeting ${schemaField.schemaRef}.`,
|
|
3979
|
-
command: `zinkee --json automations actions add ${automationId} --type create_record --name "Create follow-up order" --target-schema ${schemaField.schemaRef} --map ${schemaField.fieldRef}=pending --map-json owner='{"rawValue":null,"source":{"type":"TRIGGER","id":"${schemaField.fieldId}"}}'`,
|
|
3980
|
-
raw: `{
|
|
3981
|
-
"type": "create_record",
|
|
3982
|
-
"name": "Create follow-up order",
|
|
3983
|
-
"config": {
|
|
3984
|
-
"targetSchemaId": "${schemaField.schemaRef}",
|
|
3985
|
-
"fieldMapping": {
|
|
3986
|
-
"${schemaField.fieldRef}": {
|
|
3987
|
-
"rawValue": "pending",
|
|
3988
|
-
"source": null
|
|
3989
|
-
},
|
|
3990
|
-
"owner": {
|
|
3991
|
-
"rawValue": null,
|
|
3992
|
-
"source": {
|
|
3993
|
-
"type": "TRIGGER",
|
|
3994
|
-
"id": "${schemaField.fieldId}"
|
|
3995
|
-
}
|
|
3996
|
-
}
|
|
3997
|
-
}
|
|
3998
|
-
}
|
|
3999
|
-
}`,
|
|
4000
|
-
},
|
|
4001
|
-
{
|
|
4002
|
-
description:
|
|
4003
|
-
`Add an update-record action that targets the trigger record on ${schemaField.schemaRef}.`,
|
|
4004
|
-
command: `zinkee --json automations actions add ${automationId} --type update_record --name "Mark record as processed" --target-schema ${schemaField.schemaRef} --use-trigger-record --map ${schemaField.fieldRef}=processed`,
|
|
4005
|
-
raw: `{
|
|
4006
|
-
"type": "update_record",
|
|
4007
|
-
"name": "Mark record as processed",
|
|
4008
|
-
"config": {
|
|
4009
|
-
"targetSchemaId": "${schemaField.schemaRef}",
|
|
4010
|
-
"fieldMapping": {
|
|
4011
|
-
"${schemaField.fieldRef}": {
|
|
4012
|
-
"rawValue": "processed",
|
|
4013
|
-
"source": null
|
|
4014
|
-
}
|
|
4015
|
-
},
|
|
4016
|
-
"useTriggerRecord": true
|
|
4017
|
-
}
|
|
4018
|
-
}`,
|
|
4019
|
-
},
|
|
4020
|
-
{
|
|
4021
|
-
description: `Add a search-records action with a trigger-based condition on ${schemaField.schemaRef}.`,
|
|
4022
|
-
command: `zinkee --json automations actions add ${automationId} --type search_records --name "Find duplicates" --target-schema ${schemaField.schemaRef} --condition-json '{"field":"${schemaField.fieldRef}","comparator":"eq","values":[{"rawValue":null,"source":{"type":"TRIGGER","id":"${schemaField.fieldId}"}}]}'`,
|
|
4023
|
-
raw: `{
|
|
4024
|
-
"type": "search_records",
|
|
4025
|
-
"name": "Find duplicates",
|
|
4026
|
-
"config": {
|
|
4027
|
-
"targetSchemaId": "${schemaField.schemaRef}",
|
|
4028
|
-
"conditions": [
|
|
4029
|
-
{
|
|
4030
|
-
"field": "${schemaField.fieldRef}",
|
|
4031
|
-
"comparator": "eq",
|
|
4032
|
-
"values": [
|
|
4033
|
-
{
|
|
4034
|
-
"rawValue": null,
|
|
4035
|
-
"source": {
|
|
4036
|
-
"type": "TRIGGER",
|
|
4037
|
-
"id": "${schemaField.fieldId}"
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
]
|
|
4041
|
-
}
|
|
4042
|
-
]
|
|
4043
|
-
}
|
|
4044
|
-
}`,
|
|
4045
|
-
},
|
|
4046
|
-
...(connectionId
|
|
4047
|
-
? buildCommandExamples([
|
|
4048
|
-
{
|
|
4049
|
-
description: `Add an HTTP request action authenticated through a stored connection (${connectionId}).`,
|
|
4050
|
-
command: `zinkee --json automations actions add ${automationId} --type http_request --name "Notify external ERP" --method POST --url https://example.com/integrations/order-status --header X-Demo=codex --content-type application/json --timeout-ms 5000 --auth-mode STORED --connection ${connectionId}`,
|
|
4051
|
-
raw: `{
|
|
4052
|
-
"type": "http_request",
|
|
4053
|
-
"name": "Notify external ERP",
|
|
4054
|
-
"config": {
|
|
4055
|
-
"method": "POST",
|
|
4056
|
-
"url": "https://example.com/integrations/order-status",
|
|
4057
|
-
"headers": {
|
|
4058
|
-
"X-Demo": "codex"
|
|
4059
|
-
},
|
|
4060
|
-
"contentType": "application/json",
|
|
4061
|
-
"timeoutMs": 5000,
|
|
4062
|
-
"authMode": "STORED",
|
|
4063
|
-
"connectionId": "${connectionId}"
|
|
4064
|
-
}
|
|
4065
|
-
}`,
|
|
4066
|
-
},
|
|
4067
|
-
])
|
|
4068
|
-
: buildCommandExamples([
|
|
4069
|
-
{
|
|
4070
|
-
description: "Add an HTTP request action through the generic --type path.",
|
|
4071
|
-
command: `zinkee --json automations actions add ${automationId} --type http_request --name "Notify external ERP" --method POST --url https://example.com/integrations/order-status --content-type application/json`,
|
|
4072
|
-
raw: `{
|
|
4073
|
-
"type": "http_request",
|
|
4074
|
-
"name": "Notify external ERP",
|
|
4075
|
-
"config": {
|
|
4076
|
-
"method": "POST",
|
|
4077
|
-
"url": "https://example.com/integrations/order-status",
|
|
4078
|
-
"contentType": "application/json"
|
|
4079
|
-
}
|
|
4080
|
-
}`,
|
|
4081
|
-
},
|
|
4082
|
-
])),
|
|
4083
|
-
...(pluginId
|
|
4084
|
-
? buildCommandExamples([
|
|
4085
|
-
{
|
|
4086
|
-
description: `Add an execute-plugin action using an active plugin from this workspace (${pluginId}).`,
|
|
4087
|
-
command: `zinkee --json automations actions add ${automationId} --type execute_plugin --name "Run billing plugin" --plugin ${pluginId} --arg mode=safe --arg-json steps='["one","two"]'`,
|
|
4088
|
-
raw: `{
|
|
4089
|
-
"type": "execute_plugin",
|
|
4090
|
-
"name": "Run billing plugin",
|
|
4091
|
-
"config": {
|
|
4092
|
-
"pluginId": "${pluginId}",
|
|
4093
|
-
"pluginArgs": {
|
|
4094
|
-
"mode": "safe",
|
|
4095
|
-
"steps": ["one", "two"]
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
|
-
}`,
|
|
4099
|
-
},
|
|
4100
|
-
])
|
|
4101
|
-
: []),
|
|
4102
|
-
]);
|
|
4103
|
-
case "automations actions update":
|
|
4104
|
-
if (!automationWithAction || !schemaField) {
|
|
4105
|
-
return [];
|
|
4106
|
-
}
|
|
4107
|
-
return buildCommandExamples([
|
|
4108
|
-
{
|
|
4109
|
-
description: "Update a record action on a real automation/action pair using the trigger record.",
|
|
4110
|
-
command: `zinkee --json automations actions update ${automationWithAction.automationId} ${automationWithAction.actionId} --type update_record --name "Update trigger record" --target-schema ${schemaField.schemaRef} --map ${schemaField.fieldRef}=ready --use-trigger-record`,
|
|
4111
|
-
raw: `{
|
|
4112
|
-
"type": "update_record",
|
|
4113
|
-
"name": "Update trigger record",
|
|
4114
|
-
"config": {
|
|
4115
|
-
"targetSchemaId": "${schemaField.schemaRef}",
|
|
4116
|
-
"fieldMapping": {
|
|
4117
|
-
"${schemaField.fieldRef}": {
|
|
4118
|
-
"rawValue": "ready",
|
|
4119
|
-
"source": null
|
|
4120
|
-
}
|
|
4121
|
-
},
|
|
4122
|
-
"useTriggerRecord": true
|
|
4123
|
-
}
|
|
4124
|
-
}`,
|
|
4125
|
-
response: `{
|
|
4126
|
-
"id": "${automationWithAction.actionId}",
|
|
4127
|
-
"type": "update_record",
|
|
4128
|
-
"name": "Update trigger record",
|
|
4129
|
-
"config": {
|
|
4130
|
-
"targetSchemaId": "${schemaField.schemaRef}",
|
|
4131
|
-
"fieldMapping": {
|
|
4132
|
-
"${schemaField.fieldRef}": {
|
|
4133
|
-
"rawValue": "ready",
|
|
4134
|
-
"source": null
|
|
4135
|
-
}
|
|
4136
|
-
},
|
|
4137
|
-
"useTriggerRecord": true
|
|
4138
|
-
}
|
|
4139
|
-
}`,
|
|
4140
|
-
},
|
|
4141
|
-
]);
|
|
4142
|
-
case "automations flow set":
|
|
4143
|
-
if (!automationWithAction) {
|
|
4144
|
-
return [];
|
|
4145
|
-
}
|
|
4146
|
-
return buildCommandExamples([
|
|
4147
|
-
{
|
|
4148
|
-
description: "Set flow entry actions using a real automation/action pair from this workspace.",
|
|
4149
|
-
command: `zinkee --json automations flow set ${automationWithAction.automationId} --entry ${automationWithAction.actionId}`,
|
|
4150
|
-
raw: `{
|
|
4151
|
-
"entryActionIds": ["${automationWithAction.actionId}"],
|
|
4152
|
-
"transitions": []
|
|
4153
|
-
}`,
|
|
4154
|
-
},
|
|
4155
|
-
]);
|
|
4156
|
-
case "automations connections create":
|
|
4157
|
-
return buildCommandExamples([
|
|
4158
|
-
{
|
|
4159
|
-
description: "Create a stored workspace connection for HTTP request actions.",
|
|
4160
|
-
command:
|
|
4161
|
-
'zinkee --json automations connections create --name "ERP API Key" --type api_key --scope workspace --config \'{"headerName":"Authorization"}\' --secret apiKey=super-secret --active',
|
|
4162
|
-
raw: `{
|
|
4163
|
-
"name": "ERP API Key",
|
|
4164
|
-
"type": "api_key",
|
|
4165
|
-
"scope": "workspace",
|
|
4166
|
-
"config": {
|
|
4167
|
-
"headerName": "Authorization"
|
|
4168
|
-
},
|
|
4169
|
-
"secret": {
|
|
4170
|
-
"apiKey": "super-secret"
|
|
4171
|
-
},
|
|
4172
|
-
"active": true
|
|
4173
|
-
}`,
|
|
4174
|
-
response: `{
|
|
4175
|
-
"id": "4fc20b5c-9353-4991-b68e-1027cb674ed4",
|
|
4176
|
-
"name": "ERP API Key",
|
|
4177
|
-
"type": "api_key",
|
|
4178
|
-
"scope": "workspace",
|
|
4179
|
-
"ownerMemberId": "6c8a3e0d-7b1f-4c98-a2e9-8b9a2e3f5b14",
|
|
4180
|
-
"active": true,
|
|
4181
|
-
"config": {
|
|
4182
|
-
"headerName": "Authorization"
|
|
4183
|
-
},
|
|
4184
|
-
"createdAt": "2026-04-21T09:00:00Z",
|
|
4185
|
-
"updatedAt": "2026-04-21T09:00:00Z",
|
|
4186
|
-
"createdBy": "developer@zinkee.com",
|
|
4187
|
-
"updatedBy": "developer@zinkee.com"
|
|
4188
|
-
}`,
|
|
4189
|
-
},
|
|
4190
|
-
]);
|
|
4191
|
-
case "automations connections update":
|
|
4192
|
-
if (!connectionId) {
|
|
4193
|
-
return [];
|
|
4194
|
-
}
|
|
4195
|
-
return buildCommandExamples([
|
|
4196
|
-
{
|
|
4197
|
-
description: "Patch an existing stored connection from this workspace.",
|
|
4198
|
-
command: `zinkee --json automations connections update ${connectionId} --raw '{"set":{"name":"ERP API Key Updated","config":{"headerName":"Authorization"}}}'`,
|
|
4199
|
-
raw: `{
|
|
4200
|
-
"set": {
|
|
4201
|
-
"name": "ERP API Key Updated",
|
|
4202
|
-
"config": {
|
|
4203
|
-
"headerName": "Authorization"
|
|
4204
|
-
}
|
|
4205
|
-
}
|
|
4206
|
-
}`,
|
|
4207
|
-
response: `{
|
|
4208
|
-
"id": "${connectionId}",
|
|
4209
|
-
"name": "ERP API Key Updated",
|
|
4210
|
-
"type": "api_key",
|
|
4211
|
-
"scope": "workspace",
|
|
4212
|
-
"ownerMemberId": "6c8a3e0d-7b1f-4c98-a2e9-8b9a2e3f5b14",
|
|
4213
|
-
"active": true,
|
|
4214
|
-
"config": {
|
|
4215
|
-
"headerName": "Authorization"
|
|
4216
|
-
},
|
|
4217
|
-
"createdAt": "2026-04-21T09:00:00Z",
|
|
4218
|
-
"updatedAt": "2026-04-21T10:15:00Z",
|
|
4219
|
-
"createdBy": "developer@zinkee.com",
|
|
4220
|
-
"updatedBy": "developer@zinkee.com"
|
|
4221
|
-
}`,
|
|
4222
|
-
},
|
|
4223
|
-
]);
|
|
4224
|
-
default:
|
|
4225
|
-
return [];
|
|
4226
|
-
}
|
|
4227
|
-
}
|
|
4228
|
-
|
|
4229
|
-
export async function getResolvedCommandExamples(
|
|
3695
|
+
export function getResolvedCommandExamples(
|
|
4230
3696
|
commandName: string,
|
|
4231
3697
|
filters: { type?: string } = {},
|
|
4232
|
-
|
|
4233
|
-
): Promise<readonly CommandExample[]> {
|
|
4234
|
-
const dynamicExamples = commandName.startsWith("automations")
|
|
4235
|
-
? await buildDynamicAutomationExamples(commandName, options)
|
|
4236
|
-
: [];
|
|
4237
|
-
|
|
4238
|
-
if (dynamicExamples.length > 0) {
|
|
4239
|
-
return dynamicExamples;
|
|
4240
|
-
}
|
|
4241
|
-
|
|
3698
|
+
): readonly CommandExample[] {
|
|
4242
3699
|
return getCommandExamples(commandName, filters);
|
|
4243
3700
|
}
|
|
@@ -421,7 +421,7 @@ const fieldTypeDefinitions = [
|
|
|
421
421
|
targetSchema: "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
422
422
|
targetDisplayField: "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
423
423
|
deleteBehavior: "RESTRICT",
|
|
424
|
-
defaultValue: "
|
|
424
|
+
defaultValue: "CUST-12",
|
|
425
425
|
filterFields: [
|
|
426
426
|
{
|
|
427
427
|
fatherField: "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(npm test *)",
|
|
5
|
-
"Bash(npm run *)",
|
|
6
|
-
"Bash(pnpm typecheck *)",
|
|
7
|
-
"Bash(pnpm test *)",
|
|
8
|
-
"Bash(npx tsc *)",
|
|
9
|
-
"Read(//home/guillermo/dev/z2-backend/api/src/main/java/com/zinkee/api/domain/model/v2/log/**)",
|
|
10
|
-
"Read(//home/guillermo/dev/z2-backend/**)",
|
|
11
|
-
"Bash(grep *)",
|
|
12
|
-
"Bash(npx vitest *)",
|
|
13
|
-
"Bash(npx tsx *)",
|
|
14
|
-
"Bash(node dist/index.js --help)",
|
|
15
|
-
"Bash(gh repo *)",
|
|
16
|
-
"WebFetch(domain:github.com)",
|
|
17
|
-
"Bash(git config *)",
|
|
18
|
-
"Read(//home/guillermo/.config/**)",
|
|
19
|
-
"Read(//home/guillermo/**)",
|
|
20
|
-
"Bash(curl *)",
|
|
21
|
-
"Bash(node dist/index.js --show-completion zsh)",
|
|
22
|
-
"Bash(node *)",
|
|
23
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee\" COMP_CWORD=1 node *)",
|
|
24
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee schemas\" COMP_CWORD=2 node *)",
|
|
25
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee schemas fields\" COMP_CWORD=3 node dist/index.js)",
|
|
26
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee schemas fields cr\" COMP_CWORD=3 node dist/index.js)",
|
|
27
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee schemas list --j\" COMP_CWORD=3 node dist/index.js)",
|
|
28
|
-
"Bash(rm -rf /tmp/zinkee-install)",
|
|
29
|
-
"Bash(mkdir -p /tmp/zinkee-install)",
|
|
30
|
-
"Bash(HOME=/tmp/zinkee-install SHELL=/bin/zsh node dist/index.js --install-completion)",
|
|
31
|
-
"Read(//tmp/**)",
|
|
32
|
-
"Read(//tmp/zinkee-install/**)",
|
|
33
|
-
"Bash(rm -rf /tmp/zinkee-install-bash)",
|
|
34
|
-
"Bash(mkdir -p /tmp/zinkee-install-bash)",
|
|
35
|
-
"Bash(HOME=/tmp/zinkee-install-bash SHELL=/bin/bash node dist/index.js --install-completion)",
|
|
36
|
-
"Bash(rm -rf /tmp/zinkee-install-fish)",
|
|
37
|
-
"Bash(mkdir -p /tmp/zinkee-install-fish)",
|
|
38
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete node dist/index.js)",
|
|
39
|
-
"Bash(echo \"exit: $?\")",
|
|
40
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee schemas\" COMP_CWORD=abc node dist/index.js)",
|
|
41
|
-
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee config show --foo --bar baz quux ?\" COMP_CWORD=10 node dist/index.js)"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|