@useparagon/cli 0.0.1-canary.21 → 0.0.1-canary.22

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.
@@ -34,7 +34,10 @@ class ProjectCompiler {
34
34
  continue;
35
35
  }
36
36
  if (!previousProjectBuild.integrations[integration]) {
37
- const { inputs, triggers, intents } = require(`@useparagon/types/${integration}`);
37
+ const integrationModulePath = require.resolve(`@useparagon/types/${integration}`, {
38
+ paths: [process.cwd()],
39
+ });
40
+ const { inputs, triggers, intents } = require(integrationModulePath);
38
41
  previousProjectBuild.integrations[integration] = {
39
42
  id: (0, uuid_1.v4)(),
40
43
  config: { values: {} },
@@ -1 +1 @@
1
- {"version":3,"file":"project.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/project.compiler.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAI1B,kDAAiD;AACjD,8DAAmE;AAEnE,qCAA2D;AAE3D,uDAAmD;AACnD,mEAGiC;AACjC,yDAAqD;AACrD,4DAA4E;AAU5E,MAAa,eAAe;IAGlB,cAAc,CAAiB;IAC/B,oBAAoB,CAAuB;IAC3C,eAAe,CAAkB;IAEzC;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,oBAAoB,GAAG,IAAI,4CAAoB,EAAE,CAAC;QACvD,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAe,EAAE,CAAC;IAC/C,CAAC;IAOD,KAAK,CAAC,OAAO,CAAC,OAA6B;QACzC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAE3C,MAAM,oBAAoB,GAAiB,MAAM,IAAA,sBAAe,EAAC,SAAS,CAAC,CAAC;QAE5E,MAAM,OAAO,GAAa,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;YAC3D,WAAW;SACZ,CAAC,CAAC;QAEH,MAAM,UAAU,GAAa,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAC7D,WAAW;YACX,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC;SAC3D,CAAC,CAAC;QAEH,MAAM,yBAAyB,GAAa,MAAM,IAAA,wCAA4B,GAAE,CAAC;QAMjF,KAAK,MAAM,WAAW,IAAI,yBAAyB,EAAE,CAAC;YACpD,IAAI,IAAA,iCAAmB,EAAC,WAAW,CAAC,EAAE,CAAC;gBACrC,SAAS;YACX,CAAC;YACD,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,qBAAqB,WAAW,EAAE,CAAC,CAAC;gBAClF,oBAAoB,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG;oBAC/C,EAAE,EAAE,IAAA,SAAE,GAAE;oBACR,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;oBACtB,YAAY,EAAE;wBACZ,MAAM,EAAE,QAAQ,EAAE,OAAO;qBAC1B;oBACD,SAAS,EAAE,EAAE;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;QACD,MAAM,YAAY,GAChB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YACtC,WAAW;YACX,MAAM,EAAE,UAAU;YAClB,oBAAoB;SACrB,CAAC,CAAC;QAEL,OAAO;YACL,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,IAAA,eAAO,EAAC,IAAI,EAAE,UAAU,CAAC;YACjC,YAAY,EAAE,IAAA,eAAO,EAAC,MAAM,EAAE,YAAY,CAAC;YAC3C,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;CACF;AArED,0CAqEC"}
1
+ {"version":3,"file":"project.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/project.compiler.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAI1B,kDAAiD;AACjD,8DAAm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,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;gBACrE,oBAAoB,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG;oBAC/C,EAAE,EAAE,IAAA,SAAE,GAAE;oBACR,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;oBACtB,YAAY,EAAE;wBACZ,MAAM,EAAE,QAAQ,EAAE,OAAO;qBAC1B;oBACD,SAAS,EAAE,EAAE;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;QACD,MAAM,YAAY,GAChB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YACtC,WAAW;YACX,MAAM,EAAE,UAAU;YAClB,oBAAoB;SACrB,CAAC,CAAC;QAEL,OAAO;YACL,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,IAAA,eAAO,EAAC,IAAI,EAAE,UAAU,CAAC;YACjC,YAAY,EAAE,IAAA,eAAO,EAAC,MAAM,EAAE,YAAY,CAAC;YAC3C,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;CACF;AAxED,0CAwEC"}
@@ -10,6 +10,7 @@
10
10
  "experimentalDecorators": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
12
  "importHelpers": true,
13
+ "incremental": true,
13
14
  "isolatedModules": false,
14
15
  "jsx": "react",
15
16
  "module": "commonjs",
@@ -30,4 +31,4 @@
30
31
  "baseUrl": "./",
31
32
  "rootDir": "src"
32
33
  }
33
- }
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/cli",
3
- "version": "0.0.1-canary.21",
3
+ "version": "0.0.1-canary.22",
4
4
  "description": "CLI for WaC (Workflows as Code)",
5
5
  "repository": "https://github.com/useparagon/paragraph",
6
6
  "packageManager": "pnpm@8.10.5",
@@ -32,7 +32,7 @@
32
32
  "spinnies": "^0.5.1",
33
33
  "tslib": "2.3.1",
34
34
  "uuid": "^9.0.0",
35
- "@useparagon/core": "0.0.1-canary.21"
35
+ "@useparagon/core": "0.0.1-canary.22"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/cross-spawn": "^6.0.2",
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- /**
3
- * name of event
4
- */
5
- name: 'hello-world',
6
-
7
- /**
8
- * schema of event payload
9
- */
10
- schema: {
11
- message: 'Hello,world',
12
- },
13
- };
@@ -1,11 +0,0 @@
1
- export default {
2
- description: 'Slack Integration',
3
- overviewText: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
4
-
5
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
6
-
7
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
8
-
9
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`,
10
- scopes: 'channel:read',
11
- };
@@ -1,30 +0,0 @@
1
- import { EventStep, FunctionStep, Workflow } from '@useparagon/core';
2
- import { IContext } from '@useparagon/core/execution';
3
-
4
- import event from '../../../events/hello';
5
-
6
- /**
7
- * example workflow triggered by an app event
8
- */
9
- export default class ExampleWorkflow extends Workflow {
10
- /**
11
- * defines the workflow
12
- * @param integration
13
- * @param context
14
- * @param user
15
- */
16
- define(integration, context) {
17
- const trigger = new EventStep(event);
18
- const fn = new FunctionStep({
19
- code: (parameters) => {
20
- return parameters.message;
21
- },
22
- parameters: {
23
- message: context.getOutput(trigger)?.message,
24
- },
25
- });
26
-
27
- trigger.nextStep(fn);
28
- return this.register({ trigger, fn });
29
- }
30
- }
@@ -1,21 +0,0 @@
1
- import { IEventInit } from '@useparagon/core/event';
2
-
3
- type EventSchema = {
4
- message: string;
5
- };
6
-
7
- const event: IEventInit<EventSchema> = {
8
- /**
9
- * name of event
10
- */
11
- name: 'hello-world',
12
-
13
- /**
14
- * schema of event payload
15
- */
16
- schema: {
17
- message: 'Hello,world',
18
- },
19
- };
20
-
21
- export default event;
@@ -1,13 +0,0 @@
1
- import { IIntegrationConfig } from '@useparagon/core/integration';
2
-
3
- /**
4
- * configuration for a slack
5
- */
6
- const config: IIntegrationConfig = {
7
- description: 'Send notifications to Slack',
8
- overviewText:
9
- 'Connect your Slack workspace to receive notifications and alerts in Slack. Stay connected to important activity by bringing it all together in your Slack workspace.\n \n\nOur Slack integration enables you to:\n \n\n• Receive alerts and notifications in your Slack workspace\n• Notify or DM specific team members based on certain activity',
10
- showWatermark: true,
11
- };
12
-
13
- export default config;
@@ -1,23 +0,0 @@
1
- import { createInputs } from './types';
2
-
3
- /**
4
- * define inputs here which can be used across workflows
5
- */
6
- const integrationInputs = createInputs({
7
- chanels: {
8
- id: 'c718f8df-c470-45b5-983b-689bf5c0a128',
9
- title: 'chanels',
10
- tooltip: '',
11
- required: false,
12
- type: 'channel',
13
- },
14
- members: {
15
- id: 'f8db927c-28f8-4e0d-8a66-251769f8115a',
16
- title: 'members',
17
- tooltip: 'hey yo',
18
- required: false,
19
- type: 'workspace_member',
20
- },
21
- });
22
-
23
- export default integrationInputs;
@@ -1,57 +0,0 @@
1
- /**
2
- * ############### WARNING ######################
3
- * ##### DO NOT DELETE/RENAME THIS FILE ########
4
- * ##### DO NOT UPDATE THIS FILE CONTENT ########
5
- * ############### WARNING ######################
6
- */
7
-
8
- import { UserDefinedInput } from '@useparagon/core/inputs';
9
-
10
- /**
11
- * supported input names
12
- */
13
- export type InputType =
14
- | 'text'
15
- | 'number'
16
- | 'email'
17
- | 'url'
18
- | 'boolean'
19
- | 'password'
20
- | 'channel'
21
- | 'workspace_member';
22
-
23
- /**
24
- * map b/w input type to result
25
- */
26
- export type InputResultMap = {
27
- email: string;
28
- url: string;
29
- password: string;
30
- boolean: boolean;
31
- text: string;
32
- channel: string;
33
- workspace_member: string;
34
- };
35
-
36
- /**
37
- * pass { variableName for input => Input }
38
- * this should be used whenever we are creating inputs for integrations/workflows
39
- * as it will infer proper types
40
- */
41
- export const createInputs = <
42
- T extends Record<string, UserDefinedInput<InputType>>,
43
- >(
44
- inputs: T,
45
- ) => inputs;
46
-
47
- /**
48
- * map bw intent to [input , output]
49
- */
50
- export type IntentToInputOutput = {};
51
-
52
- /**
53
- * map bw trigger intent to [input , output]
54
- */
55
- export type TriggerIntentToInputOutput = {
56
- SLACK_TRIGGER_DIRECT_MESSAGE_CREATED: [{}, {}];
57
- };
@@ -1,120 +0,0 @@
1
- import { DelayStep, FunctionStep, Workflow } from '@useparagon/core';
2
- import { IContext } from '@useparagon/core/execution';
3
- import { IIntegration } from '@useparagon/core/integration';
4
- import * as Operator from '@useparagon/core/operator';
5
- import { IPersona } from '@useparagon/core/persona';
6
- import { ConditionalInput } from '@useparagon/core/steps/library/conditional';
7
- import { IConnectUser, IPermissionContext } from '@useparagon/core/user';
8
-
9
- import personaMeta from '../../../persona.meta';
10
- import sharedInputs from '../inputs';
11
- import {
12
- createInputs,
13
- InputResultMap,
14
- IntentToInputOutput,
15
- TriggerIntentToInputOutput,
16
- } from '../types';
17
-
18
- /**
19
- * define inputs here which can be used in this workflow only
20
- */
21
- const inputs = createInputs({});
22
-
23
- /**
24
- * New Workflow Workflow impolementation
25
- */
26
- export default class extends Workflow<
27
- IIntegration<IntentToInputOutput, TriggerIntentToInputOutput>,
28
- IPersona<typeof personaMeta>,
29
- InputResultMap
30
- > {
31
- /**
32
- * This property is maintained by Paragon. Do not edit this property.
33
- */
34
- readonly id: string = '0f96613c-7dc4-4294-a4dc-d0c86a71c2c7';
35
-
36
- /**
37
- * name shown in workflow editor
38
- */
39
- name: string = 'New Workflow';
40
-
41
- /**
42
- * description shown in connect portal for workflow
43
- */
44
- description: string = 'Add a user-facing description of this workflow';
45
-
46
- /**
47
- * inputs used in workflows
48
- */
49
- inputs = inputs;
50
-
51
- /**
52
- * if set to true , workflow will be automatically be enable
53
- * after integration connect
54
- */
55
- defaultEnabled: boolean = false;
56
-
57
- /**
58
- * if true , workflow will be hidden from connect portal
59
- */
60
- hidden: boolean = false;
61
-
62
- /**
63
- * defines the workflow
64
- * @param integration
65
- * @param context
66
- * @param user
67
- */
68
- define(
69
- integration: IIntegration<IntentToInputOutput, TriggerIntentToInputOutput>,
70
- context: IContext<InputResultMap>,
71
- _connectUser: IConnectUser<IPersona<typeof personaMeta>>,
72
- ) {
73
- /**
74
- * declare all steps here
75
- */
76
-
77
- const triggerStep = integration.withTrigger(
78
- integration.triggers.SLACK_TRIGGER_DIRECT_MESSAGE_CREATED,
79
- {},
80
- );
81
-
82
- const descriptionStep = new FunctionStep({
83
- code: function yourFunction(_parameters, _libraries) {
84
- return 'hello world';
85
- },
86
- parameters: {
87
- parameter_name: context.getInput(sharedInputs.chanels),
88
- parameter_name_2: context.getInput(sharedInputs.members),
89
- },
90
- description: 'description',
91
- });
92
-
93
- const descriptionStep1 = new DelayStep({
94
- unit: 'MINUTES',
95
- value: 5,
96
- description: 'description',
97
- });
98
-
99
- /**
100
- * chain steps correctly here
101
- */
102
-
103
- triggerStep.nextStep(descriptionStep).nextStep(descriptionStep1);
104
-
105
- /**
106
- * pass all steps here so that paragon can keep track of changes
107
- */
108
- return this.register({ triggerStep, descriptionStep, descriptionStep1 });
109
- }
110
-
111
- /**
112
- * define permissions for workflow
113
- * @param context
114
- */
115
- definePermissions(
116
- connectUser: IPermissionContext<IPersona<typeof personaMeta>>,
117
- ): ConditionalInput | undefined {
118
- return Operator.Or(Operator.Exists(connectUser.userId));
119
- }
120
- }
@@ -1 +0,0 @@
1
- export default {};
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "allowSyntheticDefaultImports": true,
5
- "allowUnreachableCode": false,
6
- "alwaysStrict": true,
7
- "declaration": true,
8
- "emitDecoratorMetadata": true,
9
- "esModuleInterop": true,
10
- "experimentalDecorators": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "importHelpers": true,
13
- "isolatedModules": false,
14
- "jsx": "react",
15
- "module": "commonjs",
16
- "moduleResolution": "node",
17
- "noFallthroughCasesInSwitch": true,
18
- "noImplicitAny": false,
19
- "noImplicitReturns": true,
20
- "noImplicitThis": true,
21
- "noUnusedLocals": true,
22
- "noUnusedParameters": true,
23
- "removeComments": true,
24
- "resolveJsonModule": true,
25
- "sourceMap": true,
26
- "strict": true,
27
- "strictNullChecks": true,
28
- "target": "es6",
29
- }
30
- }
31
-