@activeboxes/pieces-framework 0.7.4-2.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.
Files changed (95) hide show
  1. package/README.md +11 -0
  2. package/package.json +27 -0
  3. package/src/index.d.ts +1 -0
  4. package/src/index.js +5 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/action/action.d.ts +45 -0
  7. package/src/lib/action/action.js +40 -0
  8. package/src/lib/action/action.js.map +1 -0
  9. package/src/lib/context.d.ts +122 -0
  10. package/src/lib/context.js +10 -0
  11. package/src/lib/context.js.map +1 -0
  12. package/src/lib/index.d.ts +7 -0
  13. package/src/lib/index.js +11 -0
  14. package/src/lib/index.js.map +1 -0
  15. package/src/lib/piece-metadata.d.ts +3267 -0
  16. package/src/lib/piece-metadata.js +75 -0
  17. package/src/lib/piece-metadata.js.map +1 -0
  18. package/src/lib/piece.d.ts +52 -0
  19. package/src/lib/piece.js +53 -0
  20. package/src/lib/piece.js.map +1 -0
  21. package/src/lib/property/authentication/basic-auth-prop.d.ts +33 -0
  22. package/src/lib/property/authentication/basic-auth-prop.js +26 -0
  23. package/src/lib/property/authentication/basic-auth-prop.js.map +1 -0
  24. package/src/lib/property/authentication/common.d.ts +16 -0
  25. package/src/lib/property/authentication/common.js +9 -0
  26. package/src/lib/property/authentication/common.js.map +1 -0
  27. package/src/lib/property/authentication/custom-auth-prop.d.ts +53 -0
  28. package/src/lib/property/authentication/custom-auth-prop.js +26 -0
  29. package/src/lib/property/authentication/custom-auth-prop.js.map +1 -0
  30. package/src/lib/property/authentication/index.d.ts +109 -0
  31. package/src/lib/property/authentication/index.js +33 -0
  32. package/src/lib/property/authentication/index.js.map +1 -0
  33. package/src/lib/property/authentication/oauth2-prop.d.ts +180 -0
  34. package/src/lib/property/authentication/oauth2-prop.js +43 -0
  35. package/src/lib/property/authentication/oauth2-prop.js.map +1 -0
  36. package/src/lib/property/authentication/secret-text-property.d.ts +10 -0
  37. package/src/lib/property/authentication/secret-text-property.js +14 -0
  38. package/src/lib/property/authentication/secret-text-property.js.map +1 -0
  39. package/src/lib/property/index.d.ts +682 -0
  40. package/src/lib/property/index.js +76 -0
  41. package/src/lib/property/index.js.map +1 -0
  42. package/src/lib/property/input/array-property.d.ts +133 -0
  43. package/src/lib/property/input/array-property.js +30 -0
  44. package/src/lib/property/input/array-property.js.map +1 -0
  45. package/src/lib/property/input/checkbox-property.d.ts +9 -0
  46. package/src/lib/property/input/checkbox-property.js +11 -0
  47. package/src/lib/property/input/checkbox-property.js.map +1 -0
  48. package/src/lib/property/input/common.d.ts +15 -0
  49. package/src/lib/property/input/common.js +15 -0
  50. package/src/lib/property/input/common.js.map +1 -0
  51. package/src/lib/property/input/date-time-property.d.ts +9 -0
  52. package/src/lib/property/input/date-time-property.js +11 -0
  53. package/src/lib/property/input/date-time-property.js.map +1 -0
  54. package/src/lib/property/input/dropdown/common.d.ts +21 -0
  55. package/src/lib/property/input/dropdown/common.js +14 -0
  56. package/src/lib/property/input/dropdown/common.js.map +1 -0
  57. package/src/lib/property/input/dropdown/dropdown-prop.d.ts +27 -0
  58. package/src/lib/property/input/dropdown/dropdown-prop.js +21 -0
  59. package/src/lib/property/input/dropdown/dropdown-prop.js.map +1 -0
  60. package/src/lib/property/input/dropdown/static-dropdown.d.ts +37 -0
  61. package/src/lib/property/input/dropdown/static-dropdown.js +22 -0
  62. package/src/lib/property/input/dropdown/static-dropdown.js.map +1 -0
  63. package/src/lib/property/input/dynamic-prop.d.ts +218 -0
  64. package/src/lib/property/input/dynamic-prop.js +26 -0
  65. package/src/lib/property/input/dynamic-prop.js.map +1 -0
  66. package/src/lib/property/input/file-property.d.ts +16 -0
  67. package/src/lib/property/input/file-property.js +22 -0
  68. package/src/lib/property/input/file-property.js.map +1 -0
  69. package/src/lib/property/input/index.d.ts +186 -0
  70. package/src/lib/property/input/index.js +91 -0
  71. package/src/lib/property/input/index.js.map +1 -0
  72. package/src/lib/property/input/json-property.d.ts +9 -0
  73. package/src/lib/property/input/json-property.js +11 -0
  74. package/src/lib/property/input/json-property.js.map +1 -0
  75. package/src/lib/property/input/markdown-property.d.ts +12 -0
  76. package/src/lib/property/input/markdown-property.js +11 -0
  77. package/src/lib/property/input/markdown-property.js.map +1 -0
  78. package/src/lib/property/input/number-property.d.ts +9 -0
  79. package/src/lib/property/input/number-property.js +11 -0
  80. package/src/lib/property/input/number-property.js.map +1 -0
  81. package/src/lib/property/input/object-property.d.ts +9 -0
  82. package/src/lib/property/input/object-property.js +11 -0
  83. package/src/lib/property/input/object-property.js.map +1 -0
  84. package/src/lib/property/input/property-type.d.ts +21 -0
  85. package/src/lib/property/input/property-type.js +26 -0
  86. package/src/lib/property/input/property-type.js.map +1 -0
  87. package/src/lib/property/input/text-property.d.ts +16 -0
  88. package/src/lib/property/input/text-property.js +15 -0
  89. package/src/lib/property/input/text-property.js.map +1 -0
  90. package/src/lib/trigger/trigger.d.ts +85 -0
  91. package/src/lib/trigger/trigger.js +74 -0
  92. package/src/lib/trigger/trigger.js.map +1 -0
  93. package/src/lib/validators/index.d.ts +1 -0
  94. package/src/lib/validators/index.js +5 -0
  95. package/src/lib/validators/index.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-property.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/json-property.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qCAA8D;AAC9D,mDAA+C;AAElC,QAAA,YAAY,GAAG,cAAI,CAAC,SAAS,CAAC;IACzC,2BAAkB;IAClB,IAAA,uBAAc,EACZ,cAAI,CAAC,KAAK,CAAC,CAAC,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,cAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EACxD,4BAAY,CAAC,IAAI,CAClB;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { BasePropertySchema, TPropertyValue } from './common';
2
+ import { PropertyType } from './property-type';
3
+ import { MarkdownVariant } from '@activeboxes/shared';
4
+ export declare const MarkDownProperty: import("@sinclair/typebox").TObject<{
5
+ [x: string]: import("@sinclair/typebox").TSchema;
6
+ [x: number]: import("@sinclair/typebox").TSchema;
7
+ displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
8
+ description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
9
+ }>;
10
+ export type MarkDownProperty = BasePropertySchema & TPropertyValue<undefined, PropertyType.MARKDOWN, false> & {
11
+ variant?: MarkdownVariant;
12
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkDownProperty = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const common_1 = require("./common");
6
+ const property_type_1 = require("./property-type");
7
+ exports.MarkDownProperty = typebox_1.Type.Composite([
8
+ common_1.BasePropertySchema,
9
+ (0, common_1.TPropertyValue)(typebox_1.Type.Void(), property_type_1.PropertyType.MARKDOWN),
10
+ ]);
11
+ //# sourceMappingURL=markdown-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-property.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/markdown-property.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qCAA8D;AAC9D,mDAA+C;AAGlC,QAAA,gBAAgB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC7C,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,IAAI,EAAE,EAAE,4BAAY,CAAC,QAAQ,CAAC;CACnD,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { BasePropertySchema, TPropertyValue } from "./common";
2
+ import { PropertyType } from "./property-type";
3
+ export declare const NumberProperty: import("@sinclair/typebox").TObject<{
4
+ [x: string]: import("@sinclair/typebox").TSchema;
5
+ [x: number]: import("@sinclair/typebox").TSchema;
6
+ displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
7
+ description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
8
+ }>;
9
+ export type NumberProperty<R extends boolean> = BasePropertySchema & TPropertyValue<number, PropertyType.NUMBER, R>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberProperty = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const common_1 = require("./common");
6
+ const property_type_1 = require("./property-type");
7
+ exports.NumberProperty = typebox_1.Type.Composite([
8
+ common_1.BasePropertySchema,
9
+ (0, common_1.TPropertyValue)(typebox_1.Type.Number(), property_type_1.PropertyType.NUMBER)
10
+ ]);
11
+ //# sourceMappingURL=number-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-property.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/number-property.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qCAA8D;AAC9D,mDAA+C;AAElC,QAAA,cAAc,GAAG,cAAI,CAAC,SAAS,CAAC;IACzC,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,MAAM,EAAE,EAAE,4BAAY,CAAC,MAAM,CAAC;CACrD,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { BasePropertySchema, TPropertyValue } from "./common";
2
+ import { PropertyType } from "./property-type";
3
+ export declare const ObjectProperty: import("@sinclair/typebox").TObject<{
4
+ [x: string]: import("@sinclair/typebox").TSchema;
5
+ [x: number]: import("@sinclair/typebox").TSchema;
6
+ displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
7
+ description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
8
+ }>;
9
+ export type ObjectProperty<R extends boolean> = BasePropertySchema & TPropertyValue<Record<string, unknown>, PropertyType.OBJECT, R>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectProperty = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const common_1 = require("./common");
6
+ const property_type_1 = require("./property-type");
7
+ exports.ObjectProperty = typebox_1.Type.Composite([
8
+ common_1.BasePropertySchema,
9
+ (0, common_1.TPropertyValue)(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown()), property_type_1.PropertyType.OBJECT)
10
+ ]);
11
+ //# sourceMappingURL=object-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-property.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/object-property.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qCAA8D;AAC9D,mDAA+C;AAElC,QAAA,cAAc,GAAG,cAAI,CAAC,SAAS,CAAC;IACzC,2BAAkB;IAClB,IAAA,uBAAc,EACV,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,cAAI,CAAC,OAAO,EAAE,CAAC,EAC1C,4BAAY,CAAC,MAAM,CACtB;CACJ,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ export declare enum PropertyType {
2
+ SHORT_TEXT = "SHORT_TEXT",
3
+ LONG_TEXT = "LONG_TEXT",
4
+ MARKDOWN = "MARKDOWN",
5
+ DROPDOWN = "DROPDOWN",
6
+ STATIC_DROPDOWN = "STATIC_DROPDOWN",
7
+ NUMBER = "NUMBER",
8
+ CHECKBOX = "CHECKBOX",
9
+ OAUTH2 = "OAUTH2",
10
+ SECRET_TEXT = "SECRET_TEXT",
11
+ ARRAY = "ARRAY",
12
+ OBJECT = "OBJECT",
13
+ BASIC_AUTH = "BASIC_AUTH",
14
+ JSON = "JSON",
15
+ MULTI_SELECT_DROPDOWN = "MULTI_SELECT_DROPDOWN",
16
+ STATIC_MULTI_SELECT_DROPDOWN = "STATIC_MULTI_SELECT_DROPDOWN",
17
+ DYNAMIC = "DYNAMIC",
18
+ CUSTOM_AUTH = "CUSTOM_AUTH",
19
+ DATE_TIME = "DATE_TIME",
20
+ FILE = "FILE"
21
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropertyType = void 0;
4
+ var PropertyType;
5
+ (function (PropertyType) {
6
+ PropertyType["SHORT_TEXT"] = "SHORT_TEXT";
7
+ PropertyType["LONG_TEXT"] = "LONG_TEXT";
8
+ PropertyType["MARKDOWN"] = "MARKDOWN";
9
+ PropertyType["DROPDOWN"] = "DROPDOWN";
10
+ PropertyType["STATIC_DROPDOWN"] = "STATIC_DROPDOWN";
11
+ PropertyType["NUMBER"] = "NUMBER";
12
+ PropertyType["CHECKBOX"] = "CHECKBOX";
13
+ PropertyType["OAUTH2"] = "OAUTH2";
14
+ PropertyType["SECRET_TEXT"] = "SECRET_TEXT";
15
+ PropertyType["ARRAY"] = "ARRAY";
16
+ PropertyType["OBJECT"] = "OBJECT";
17
+ PropertyType["BASIC_AUTH"] = "BASIC_AUTH";
18
+ PropertyType["JSON"] = "JSON";
19
+ PropertyType["MULTI_SELECT_DROPDOWN"] = "MULTI_SELECT_DROPDOWN";
20
+ PropertyType["STATIC_MULTI_SELECT_DROPDOWN"] = "STATIC_MULTI_SELECT_DROPDOWN";
21
+ PropertyType["DYNAMIC"] = "DYNAMIC";
22
+ PropertyType["CUSTOM_AUTH"] = "CUSTOM_AUTH";
23
+ PropertyType["DATE_TIME"] = "DATE_TIME";
24
+ PropertyType["FILE"] = "FILE";
25
+ })(PropertyType || (exports.PropertyType = PropertyType = {}));
26
+ //# sourceMappingURL=property-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-type.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/property-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAoBX;AApBD,WAAY,YAAY;IACpB,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,mDAAmC,CAAA;IACnC,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,2CAA2B,CAAA;IAC3B,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,yCAAyB,CAAA;IACzB,6BAAa,CAAA;IACb,+DAA+C,CAAA;IAC/C,6EAA6D,CAAA;IAC7D,mCAAmB,CAAA;IACnB,2CAA2B,CAAA;IAC3B,uCAAuB,CAAA;IACvB,6BAAa,CAAA;AACjB,CAAC,EApBW,YAAY,4BAAZ,YAAY,QAoBvB"}
@@ -0,0 +1,16 @@
1
+ import { BasePropertySchema, TPropertyValue } from "./common";
2
+ import { PropertyType } from "./property-type";
3
+ export declare const ShortTextProperty: import("@sinclair/typebox").TObject<{
4
+ [x: string]: import("@sinclair/typebox").TSchema;
5
+ [x: number]: import("@sinclair/typebox").TSchema;
6
+ displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
7
+ description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
8
+ }>;
9
+ export type ShortTextProperty<R extends boolean> = BasePropertySchema & TPropertyValue<string, PropertyType.SHORT_TEXT, R>;
10
+ export declare const LongTextProperty: import("@sinclair/typebox").TObject<{
11
+ [x: string]: import("@sinclair/typebox").TSchema;
12
+ [x: number]: import("@sinclair/typebox").TSchema;
13
+ displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
14
+ description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
15
+ }>;
16
+ export type LongTextProperty<R extends boolean> = BasePropertySchema & TPropertyValue<string, PropertyType.LONG_TEXT, R>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LongTextProperty = exports.ShortTextProperty = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const common_1 = require("./common");
6
+ const property_type_1 = require("./property-type");
7
+ exports.ShortTextProperty = typebox_1.Type.Composite([
8
+ common_1.BasePropertySchema,
9
+ (0, common_1.TPropertyValue)(typebox_1.Type.String(), property_type_1.PropertyType.SHORT_TEXT)
10
+ ]);
11
+ exports.LongTextProperty = typebox_1.Type.Composite([
12
+ common_1.BasePropertySchema,
13
+ (0, common_1.TPropertyValue)(typebox_1.Type.String(), property_type_1.PropertyType.LONG_TEXT)
14
+ ]);
15
+ //# sourceMappingURL=text-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-property.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/text-property.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qCAA8D;AAC9D,mDAA+C;AAGlC,QAAA,iBAAiB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC5C,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,MAAM,EAAE,EAAE,4BAAY,CAAC,UAAU,CAAC;CACzD,CAAC,CAAA;AAOW,QAAA,gBAAgB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC3C,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,MAAM,EAAE,EAAE,4BAAY,CAAC,SAAS,CAAC;CACxD,CAAC,CAAA"}
@@ -0,0 +1,85 @@
1
+ import { Static } from '@sinclair/typebox';
2
+ import { OnStartContext, TestOrRunHookContext, TriggerHookContext } from '../context';
3
+ import { TriggerBase } from '../piece-metadata';
4
+ import { InputPropertyMap } from '../property';
5
+ import { PieceAuthProperty } from '../property/authentication';
6
+ import { TriggerTestStrategy } from '@activeboxes/shared';
7
+ export declare const DEDUPE_KEY_PROPERTY = "_dedupe_key";
8
+ export declare enum TriggerStrategy {
9
+ POLLING = "POLLING",
10
+ WEBHOOK = "WEBHOOK",
11
+ APP_WEBHOOK = "APP_WEBHOOK"
12
+ }
13
+ export declare enum WebhookHandshakeStrategy {
14
+ NONE = "NONE",
15
+ HEADER_PRESENT = "HEADER_PRESENT",
16
+ QUERY_PRESENT = "QUERY_PRESENT",
17
+ BODY_PARAM_PRESENT = "BODY_PARAM_PRESENT"
18
+ }
19
+ export declare enum WebhookRenewStrategy {
20
+ CRON = "CRON",
21
+ NONE = "NONE"
22
+ }
23
+ export declare const WebhookHandshakeConfiguration: import("@sinclair/typebox").TObject<{
24
+ strategy: import("@sinclair/typebox").TEnum<typeof WebhookHandshakeStrategy>;
25
+ paramName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
+ }>;
27
+ type OnStartRunner<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = (ctx: OnStartContext<PieceAuth, TriggerProps>) => Promise<unknown | void>;
28
+ export type WebhookHandshakeConfiguration = Static<typeof WebhookHandshakeConfiguration>;
29
+ export declare const WebhookRenewConfiguration: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
30
+ strategy: import("@sinclair/typebox").TLiteral<WebhookRenewStrategy.CRON>;
31
+ cronExpression: import("@sinclair/typebox").TString;
32
+ }>, import("@sinclair/typebox").TObject<{
33
+ strategy: import("@sinclair/typebox").TLiteral<WebhookRenewStrategy.NONE>;
34
+ }>]>;
35
+ export type WebhookRenewConfiguration = Static<typeof WebhookRenewConfiguration>;
36
+ export interface WebhookResponse {
37
+ status: number;
38
+ body?: any;
39
+ headers?: Record<string, string>;
40
+ }
41
+ type BaseTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = {
42
+ name: string;
43
+ displayName: string;
44
+ description: string;
45
+ requireAuth?: boolean;
46
+ auth?: PieceAuth;
47
+ props: TriggerProps;
48
+ type: TS;
49
+ onEnable: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
50
+ onDisable: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
51
+ run: (context: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
52
+ test?: (context: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
53
+ onStart?: OnStartRunner<PieceAuth, TriggerProps>;
54
+ sampleData: unknown;
55
+ };
56
+ type WebhookTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = BaseTriggerParams<PieceAuth, TriggerProps, TS> & {
57
+ handshakeConfiguration?: WebhookHandshakeConfiguration;
58
+ onHandshake?: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>;
59
+ renewConfiguration?: WebhookRenewConfiguration;
60
+ onRenew?(context: TriggerHookContext<PieceAuth, TriggerProps, TS>): Promise<void>;
61
+ };
62
+ type CreateTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = TS extends TriggerStrategy.WEBHOOK ? WebhookTriggerParams<PieceAuth, TriggerProps, TS> : BaseTriggerParams<PieceAuth, TriggerProps, TS>;
63
+ export declare class ITrigger<TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> implements TriggerBase {
64
+ readonly name: string;
65
+ readonly displayName: string;
66
+ readonly description: string;
67
+ readonly requireAuth: boolean;
68
+ readonly props: TriggerProps;
69
+ readonly type: TS;
70
+ readonly handshakeConfiguration: WebhookHandshakeConfiguration;
71
+ readonly onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>;
72
+ readonly renewConfiguration: WebhookRenewConfiguration;
73
+ readonly onRenew: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
74
+ readonly onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
75
+ readonly onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
76
+ readonly onStart: OnStartRunner<PieceAuth, TriggerProps>;
77
+ readonly run: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
78
+ readonly test: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
79
+ readonly sampleData: unknown;
80
+ readonly testStrategy: TriggerTestStrategy;
81
+ constructor(name: string, displayName: string, description: string, requireAuth: boolean, props: TriggerProps, type: TS, handshakeConfiguration: WebhookHandshakeConfiguration, onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>, renewConfiguration: WebhookRenewConfiguration, onRenew: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onStart: OnStartRunner<PieceAuth, TriggerProps>, run: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, test: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, sampleData: unknown, testStrategy: TriggerTestStrategy);
82
+ }
83
+ export type Trigger<PieceAuth extends PieceAuthProperty = any, TriggerProps extends InputPropertyMap = any, S extends TriggerStrategy = TriggerStrategy> = ITrigger<S, PieceAuth, TriggerProps>;
84
+ export declare const createTrigger: <TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap>(params: CreateTriggerParams<PieceAuth, TriggerProps, TS>) => ITrigger<TriggerStrategy.WEBHOOK, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.POLLING, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.APP_WEBHOOK, PieceAuth, TriggerProps>;
85
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTrigger = exports.ITrigger = exports.WebhookRenewConfiguration = exports.WebhookHandshakeConfiguration = exports.WebhookRenewStrategy = exports.WebhookHandshakeStrategy = exports.TriggerStrategy = exports.DEDUPE_KEY_PROPERTY = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typebox_1 = require("@sinclair/typebox");
6
+ const shared_1 = require("@activeboxes/shared");
7
+ exports.DEDUPE_KEY_PROPERTY = '_dedupe_key';
8
+ var TriggerStrategy;
9
+ (function (TriggerStrategy) {
10
+ TriggerStrategy["POLLING"] = "POLLING";
11
+ TriggerStrategy["WEBHOOK"] = "WEBHOOK";
12
+ TriggerStrategy["APP_WEBHOOK"] = "APP_WEBHOOK";
13
+ })(TriggerStrategy || (exports.TriggerStrategy = TriggerStrategy = {}));
14
+ var WebhookHandshakeStrategy;
15
+ (function (WebhookHandshakeStrategy) {
16
+ WebhookHandshakeStrategy["NONE"] = "NONE";
17
+ WebhookHandshakeStrategy["HEADER_PRESENT"] = "HEADER_PRESENT";
18
+ WebhookHandshakeStrategy["QUERY_PRESENT"] = "QUERY_PRESENT";
19
+ WebhookHandshakeStrategy["BODY_PARAM_PRESENT"] = "BODY_PARAM_PRESENT";
20
+ })(WebhookHandshakeStrategy || (exports.WebhookHandshakeStrategy = WebhookHandshakeStrategy = {}));
21
+ var WebhookRenewStrategy;
22
+ (function (WebhookRenewStrategy) {
23
+ WebhookRenewStrategy["CRON"] = "CRON";
24
+ WebhookRenewStrategy["NONE"] = "NONE";
25
+ })(WebhookRenewStrategy || (exports.WebhookRenewStrategy = WebhookRenewStrategy = {}));
26
+ exports.WebhookHandshakeConfiguration = typebox_1.Type.Object({
27
+ strategy: typebox_1.Type.Enum(WebhookHandshakeStrategy),
28
+ paramName: typebox_1.Type.Optional(typebox_1.Type.String()),
29
+ });
30
+ exports.WebhookRenewConfiguration = typebox_1.Type.Union([
31
+ typebox_1.Type.Object({
32
+ strategy: typebox_1.Type.Literal(WebhookRenewStrategy.CRON),
33
+ cronExpression: typebox_1.Type.String(),
34
+ }),
35
+ typebox_1.Type.Object({
36
+ strategy: typebox_1.Type.Literal(WebhookRenewStrategy.NONE),
37
+ }),
38
+ ]);
39
+ class ITrigger {
40
+ constructor(name, displayName, description, requireAuth, props, type, handshakeConfiguration, onHandshake, renewConfiguration, onRenew, onEnable, onDisable, onStart, run, test, sampleData, testStrategy) {
41
+ this.name = name;
42
+ this.displayName = displayName;
43
+ this.description = description;
44
+ this.requireAuth = requireAuth;
45
+ this.props = props;
46
+ this.type = type;
47
+ this.handshakeConfiguration = handshakeConfiguration;
48
+ this.onHandshake = onHandshake;
49
+ this.renewConfiguration = renewConfiguration;
50
+ this.onRenew = onRenew;
51
+ this.onEnable = onEnable;
52
+ this.onDisable = onDisable;
53
+ this.onStart = onStart;
54
+ this.run = run;
55
+ this.test = test;
56
+ this.sampleData = sampleData;
57
+ this.testStrategy = testStrategy;
58
+ }
59
+ }
60
+ exports.ITrigger = ITrigger;
61
+ // TODO refactor and extract common logic
62
+ const createTrigger = (params) => {
63
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
64
+ switch (params.type) {
65
+ case TriggerStrategy.WEBHOOK:
66
+ return new ITrigger(params.name, params.displayName, params.description, (_a = params.requireAuth) !== null && _a !== void 0 ? _a : true, params.props, params.type, (_b = params.handshakeConfiguration) !== null && _b !== void 0 ? _b : { strategy: WebhookHandshakeStrategy.NONE }, (_c = params.onHandshake) !== null && _c !== void 0 ? _c : (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return ({ status: 200 }); })), (_d = params.renewConfiguration) !== null && _d !== void 0 ? _d : { strategy: WebhookRenewStrategy.NONE }, (_e = params.onRenew) !== null && _e !== void 0 ? _e : (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.onEnable, params.onDisable, (_f = params.onStart) !== null && _f !== void 0 ? _f : (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.run, (_g = params.test) !== null && _g !== void 0 ? _g : (() => Promise.resolve([params.sampleData])), params.sampleData, params.test ? shared_1.TriggerTestStrategy.TEST_FUNCTION : shared_1.TriggerTestStrategy.SIMULATION);
67
+ case TriggerStrategy.POLLING:
68
+ return new ITrigger(params.name, params.displayName, params.description, (_h = params.requireAuth) !== null && _h !== void 0 ? _h : true, params.props, params.type, { strategy: WebhookHandshakeStrategy.NONE }, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return ({ status: 200 }); }), { strategy: WebhookRenewStrategy.NONE }, (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.onEnable, params.onDisable, (_j = params.onStart) !== null && _j !== void 0 ? _j : (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.run, (_k = params.test) !== null && _k !== void 0 ? _k : (() => Promise.resolve([params.sampleData])), params.sampleData, shared_1.TriggerTestStrategy.TEST_FUNCTION);
69
+ case TriggerStrategy.APP_WEBHOOK:
70
+ return new ITrigger(params.name, params.displayName, params.description, (_l = params.requireAuth) !== null && _l !== void 0 ? _l : true, params.props, params.type, { strategy: WebhookHandshakeStrategy.NONE }, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return ({ status: 200 }); }), { strategy: WebhookRenewStrategy.NONE }, (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.onEnable, params.onDisable, (_m = params.onStart) !== null && _m !== void 0 ? _m : (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Promise.resolve(); })), params.run, (_o = params.test) !== null && _o !== void 0 ? _o : (() => Promise.resolve([params.sampleData])), params.sampleData, ((0, shared_1.isNil)(params.sampleData) && (0, shared_1.isNil)(params.test)) ? shared_1.TriggerTestStrategy.SIMULATION : shared_1.TriggerTestStrategy.TEST_FUNCTION);
71
+ }
72
+ };
73
+ exports.createTrigger = createTrigger;
74
+ //# sourceMappingURL=trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/trigger/trigger.ts"],"names":[],"mappings":";;;;AAAA,+CAAiD;AAKjD,gDAAiE;AAEpD,QAAA,mBAAmB,GAAG,aAAa,CAAA;AAEhD,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,8CAA2B,CAAA;AAC7B,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,yCAAa,CAAA;IACb,6DAAiC,CAAA;IACjC,2DAA+B,CAAA;IAC/B,qEAAyC,CAAA;AAC3C,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;AACf,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B;AAEY,QAAA,6BAA6B,GAAG,cAAI,CAAC,MAAM,CAAC;IACvD,QAAQ,EAAE,cAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC;IAC7C,SAAS,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;CACxC,CAAC,CAAA;AAMW,QAAA,yBAAyB,GAAG,cAAI,CAAC,KAAK,CAAC;IAClD,cAAI,CAAC,MAAM,CAAC;QACV,QAAQ,EAAE,cAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC;QACjD,cAAc,EAAE,cAAI,CAAC,MAAM,EAAE;KAC9B,CAAC;IACF,cAAI,CAAC,MAAM,CAAC;QACV,QAAQ,EAAE,cAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC;KAClD,CAAC;CACH,CAAC,CAAA;AAgDF,MAAa,QAAQ;IAKnB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,WAAoB,EACpB,KAAmB,E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AAK,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,4BAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,4BAAmB,CAAC,aAAa,CACtH,CAAA;IACL,CAAC;AACH,CAAC,CAAA;AAnEY,QAAA,aAAa,iBAmEzB"}
@@ -0,0 +1 @@
1
+ export declare const CONNECTION_REGEX = "{{1}{connections.(.*?)}{1}}";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONNECTION_REGEX = void 0;
4
+ exports.CONNECTION_REGEX = '{{1}{connections.(.*?)}{1}}';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/validators/index.ts"],"names":[],"mappings":";;;AACa,QAAA,gBAAgB,GAAG,6BAA6B,CAAA"}