@activepieces/pieces-framework 0.20.3 → 0.22.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/package.json +2 -2
- package/src/lib/action/action.d.ts +14 -11
- package/src/lib/action/action.js.map +1 -1
- package/src/lib/{context.d.ts → context/index.d.ts} +20 -16
- package/src/lib/{context.js → context/index.js} +1 -1
- package/src/lib/context/index.js.map +1 -0
- package/src/lib/context/versioning.d.ts +15 -0
- package/src/lib/context/versioning.js +24 -0
- package/src/lib/context/versioning.js.map +1 -0
- package/src/lib/index.d.ts +1 -1
- package/src/lib/index.js +1 -1
- package/src/lib/index.js.map +1 -1
- package/src/lib/piece-metadata.d.ts +494 -12
- package/src/lib/piece-metadata.js +1 -1
- package/src/lib/piece-metadata.js.map +1 -1
- package/src/lib/piece.d.ts +12 -8
- package/src/lib/piece.js +20 -4
- package/src/lib/piece.js.map +1 -1
- package/src/lib/property/authentication/index.d.ts +12 -2
- package/src/lib/property/authentication/index.js +22 -4
- package/src/lib/property/authentication/index.js.map +1 -1
- package/src/lib/property/authentication/oauth2-prop.d.ts +2 -2
- package/src/lib/property/index.d.ts +523 -520
- package/src/lib/property/index.js +5 -1
- package/src/lib/property/index.js.map +1 -1
- package/src/lib/property/input/dropdown/dropdown-prop.d.ts +17 -6
- package/src/lib/property/input/dropdown/dropdown-prop.js.map +1 -1
- package/src/lib/property/input/dynamic-prop.d.ts +9 -4
- package/src/lib/property/input/index.d.ts +5 -4
- package/src/lib/property/input/index.js.map +1 -1
- package/src/lib/property/util.d.ts +8 -0
- package/src/lib/property/util.js +121 -0
- package/src/lib/property/util.js.map +1 -0
- package/src/lib/trigger/trigger.d.ts +23 -23
- package/src/lib/trigger/trigger.js.map +1 -1
- package/src/lib/context.js.map +0 -1
- package/src/lib/validators/index.d.ts +0 -1
- package/src/lib/validators/index.js +0 -5
- package/src/lib/validators/index.js.map +0 -1
|
@@ -18,7 +18,7 @@ exports.PieceBase = typebox_1.Type.Object({
|
|
|
18
18
|
authors: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
19
19
|
platformId: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
20
20
|
directoryPath: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
21
|
-
auth: typebox_1.Type.Optional(authentication_1.PieceAuthProperty),
|
|
21
|
+
auth: typebox_1.Type.Optional(typebox_1.Type.Union([authentication_1.PieceAuthProperty, typebox_1.Type.Array(authentication_1.PieceAuthProperty)])),
|
|
22
22
|
version: typebox_1.Type.String(),
|
|
23
23
|
categories: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Enum(shared_1.PieceCategory))),
|
|
24
24
|
minimumSupportedRelease: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piece-metadata.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece-metadata.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAA8D;AAC9D,4CAA4D;AAC5D,8DAA8D;AAC9D,+CAAiD;AACjD,iDAA0K;
|
|
1
|
+
{"version":3,"file":"piece-metadata.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece-metadata.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAA8D;AAC9D,4CAA4D;AAC5D,8DAA8D;AAC9D,+CAAiD;AACjD,iDAA0K;AAG1K,MAAM,YAAY,GAAI,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAW,CAAC,EAAE,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,cAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAErH,QAAA,SAAS,GAAG,cAAI,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,cAAI,CAAC,QAAQ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K,CAAC,kBAAU,CAAC,CAAC;KACzD,CAAC;CACH,CAAC,CAAA;AASF,MAAM,oBAAoB,GAAG,cAAI,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,cAAI,CAAC,MAAM,EAAE;IAC3B,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,SAAS,EAAE,cAAI,CAAC,IAAI,CAAC,kBAAS,CAAC;IAC/B,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,oBAAW,CAAC;IACnC,UAAU,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IACxC,SAAS,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;CACxC,CAAC,CAAA;AAGW,QAAA,kBAAkB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC/C,qBAAa;IACb,oBAAoB;CACrB,CAAC,CAAA;AAGW,QAAA,yBAAyB,GAAG,cAAI,CAAC,SAAS,CAAC;IACtD,4BAAoB;IACpB,oBAAoB;CACrB,CAAC,CAAA;AAGW,QAAA,uBAAuB,GAAG,cAAI,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,cAAI,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,cAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAA"}
|
package/src/lib/piece.d.ts
CHANGED
|
@@ -4,27 +4,31 @@ import { EventPayload, ParseEventResponse, PieceCategory } from '@activepieces/s
|
|
|
4
4
|
import { PieceBase, PieceMetadata } from './piece-metadata';
|
|
5
5
|
import { PieceAuthProperty } from './property/authentication';
|
|
6
6
|
import { ServerContext } from './context';
|
|
7
|
-
|
|
7
|
+
import { ContextVersion } from './context/versioning';
|
|
8
|
+
export declare class Piece<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = PieceAuthProperty> implements Omit<PieceBase, 'version' | 'name'> {
|
|
8
9
|
readonly displayName: string;
|
|
9
10
|
readonly logoUrl: string;
|
|
10
11
|
readonly authors: string[];
|
|
11
12
|
readonly events: PieceEventProcessors | undefined;
|
|
12
13
|
readonly categories: PieceCategory[];
|
|
13
14
|
readonly auth?: PieceAuth | undefined;
|
|
14
|
-
readonly minimumSupportedRelease
|
|
15
|
+
readonly minimumSupportedRelease: string;
|
|
15
16
|
readonly maximumSupportedRelease?: string | undefined;
|
|
16
17
|
readonly description: string;
|
|
17
18
|
private readonly _actions;
|
|
18
19
|
private readonly _triggers;
|
|
19
|
-
|
|
20
|
+
getContextInfo: (() => {
|
|
21
|
+
version: ContextVersion;
|
|
22
|
+
}) | undefined;
|
|
23
|
+
constructor(displayName: string, logoUrl: string, authors: string[], events: PieceEventProcessors | undefined, actions: Action[], triggers: Trigger[], categories: PieceCategory[], auth?: PieceAuth | undefined, minimumSupportedRelease?: string, maximumSupportedRelease?: string | undefined, description?: string);
|
|
20
24
|
metadata(): BackwardCompatiblePieceMetadata;
|
|
21
25
|
getAction(actionName: string): Action | undefined;
|
|
22
26
|
getTrigger(triggerName: string): Trigger | undefined;
|
|
23
27
|
actions(): Record<string, Action>;
|
|
24
28
|
triggers(): Record<string, Trigger>;
|
|
25
29
|
}
|
|
26
|
-
export declare const createPiece: <PieceAuth extends PieceAuthProperty>(params: CreatePieceParams<PieceAuth>) => Piece<PieceAuth>;
|
|
27
|
-
type CreatePieceParams<PieceAuth extends PieceAuthProperty
|
|
30
|
+
export declare const createPiece: <PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined>(params: CreatePieceParams<PieceAuth>) => Piece<PieceAuth>;
|
|
31
|
+
type CreatePieceParams<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined> = {
|
|
28
32
|
displayName: string;
|
|
29
33
|
logoUrl: string;
|
|
30
34
|
authors: string[];
|
|
@@ -33,8 +37,8 @@ type CreatePieceParams<PieceAuth extends PieceAuthProperty = PieceAuthProperty>
|
|
|
33
37
|
events?: PieceEventProcessors;
|
|
34
38
|
minimumSupportedRelease?: string;
|
|
35
39
|
maximumSupportedRelease?: string;
|
|
36
|
-
actions: Action
|
|
37
|
-
triggers: Trigger
|
|
40
|
+
actions: Action[];
|
|
41
|
+
triggers: Trigger[];
|
|
38
42
|
categories?: PieceCategory[];
|
|
39
43
|
};
|
|
40
44
|
type PieceEventProcessors = {
|
|
@@ -48,7 +52,7 @@ type PieceEventProcessors = {
|
|
|
48
52
|
appWebhookUrl: string;
|
|
49
53
|
}) => boolean;
|
|
50
54
|
};
|
|
51
|
-
type BackwardCompatiblePieceMetadata = Omit<PieceMetadata, 'name' | 'version' | 'authors' | 'i18n'> & {
|
|
55
|
+
type BackwardCompatiblePieceMetadata = Omit<PieceMetadata, 'name' | 'version' | 'authors' | 'i18n' | 'getContextInfo'> & {
|
|
52
56
|
authors?: PieceMetadata['authors'];
|
|
53
57
|
i18n?: PieceMetadata['i18n'];
|
|
54
58
|
};
|
package/src/lib/piece.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPiece = exports.Piece = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const versioning_1 = require("./context/versioning");
|
|
6
|
+
const semver = tslib_1.__importStar(require("semver"));
|
|
4
7
|
class Piece {
|
|
5
|
-
constructor(displayName, logoUrl, authors, events, actions, triggers, categories, auth, minimumSupportedRelease, maximumSupportedRelease, description = '') {
|
|
8
|
+
constructor(displayName, logoUrl, authors, events, actions, triggers, categories, auth, minimumSupportedRelease = versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION, maximumSupportedRelease, description = '') {
|
|
6
9
|
this.displayName = displayName;
|
|
7
10
|
this.logoUrl = logoUrl;
|
|
8
11
|
this.authors = authors;
|
|
@@ -14,10 +17,16 @@ class Piece {
|
|
|
14
17
|
this.description = description;
|
|
15
18
|
this._actions = {};
|
|
16
19
|
this._triggers = {};
|
|
20
|
+
// this method didn't exist in older version
|
|
21
|
+
this.getContextInfo = () => ({ version: versioning_1.LATEST_CONTEXT_VERSION });
|
|
22
|
+
if (!semver.valid(minimumSupportedRelease) || semver.lt(minimumSupportedRelease, versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION)) {
|
|
23
|
+
this.minimumSupportedRelease = versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION;
|
|
24
|
+
}
|
|
17
25
|
actions.forEach((action) => (this._actions[action.name] = action));
|
|
18
26
|
triggers.forEach((trigger) => (this._triggers[trigger.name] = trigger));
|
|
19
27
|
}
|
|
20
28
|
metadata() {
|
|
29
|
+
var _a;
|
|
21
30
|
return {
|
|
22
31
|
displayName: this.displayName,
|
|
23
32
|
logoUrl: this.logoUrl,
|
|
@@ -28,7 +37,8 @@ class Piece {
|
|
|
28
37
|
authors: this.authors,
|
|
29
38
|
auth: this.auth,
|
|
30
39
|
minimumSupportedRelease: this.minimumSupportedRelease,
|
|
31
|
-
maximumSupportedRelease: this.maximumSupportedRelease
|
|
40
|
+
maximumSupportedRelease: this.maximumSupportedRelease,
|
|
41
|
+
contextInfo: (_a = this.getContextInfo) === null || _a === void 0 ? void 0 : _a.call(this)
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
44
|
getAction(actionName) {
|
|
@@ -46,8 +56,14 @@ class Piece {
|
|
|
46
56
|
}
|
|
47
57
|
exports.Piece = Piece;
|
|
48
58
|
const createPiece = (params) => {
|
|
49
|
-
var _a, _b
|
|
50
|
-
|
|
59
|
+
var _a, _b;
|
|
60
|
+
if (params.auth && Array.isArray(params.auth)) {
|
|
61
|
+
const isUnique = params.auth.every((auth, index, self) => index === self.findIndex((t) => t.type === auth.type));
|
|
62
|
+
if (!isUnique) {
|
|
63
|
+
throw new Error('Auth properties must be unique by type');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return new Piece(params.displayName, params.logoUrl, (_a = params.authors) !== null && _a !== void 0 ? _a : [], params.events, params.actions, params.triggers, (_b = params.categories) !== null && _b !== void 0 ? _b : [], params.auth, params.minimumSupportedRelease, params.maximumSupportedRelease, params.description);
|
|
51
67
|
};
|
|
52
68
|
exports.createPiece = createPiece;
|
|
53
69
|
//# sourceMappingURL=piece.js.map
|
package/src/lib/piece.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piece.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"piece.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece.ts"],"names":[],"mappings":";;;;AAUA,qDAAsI;AACtI,uDAAiC;AAIjC,MAAa,KAAK;IAOhB,YACkB,WAAmB,EACnB,OAAe,EACf,OAAiB,EACjB,MAAwC,EACxD,OAAiB,EACjB,QAAmB,EACH,UAA2B,EAC3B,IAAgB,EAChB,0BAAkC,mEAAsD,EACxF,uBAAgC,EAChC,cAAc,EAAE;QAVhB,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAU;QACjB,WAAM,GAAN,MAAM,CAAkC;QAGxC,eAAU,GAAV,UAAU,CAAiB;QAC3B,SAAI,GAAJ,IAAI,CAAY;QAChB,4BAAuB,GAAvB,uBAAuB,CAAiE;QACxF,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,gBAAW,GAAX,WAAW,CAAK;QAfjB,aAAQ,GAA2B,EAAE,CAAC;QACtC,cAAS,GAA4B,EAAE,CAAC;QACzD,4CAA4C;QACrC,mBAAc,GAAoD,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,mCAAsB,EAAE,CAAC,CAAC;QAcnH,IAAG,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,MAAM,CAAC,EAAE,C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,MAAoC,EACpC,EAAE;;IACF,IAAG,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACvD,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CACtD,CAAC;QACF,IAAG,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IACD,OAAO,IAAI,KAAK,CACd,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,OAAO,EACd,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE,EACpB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAA,MAAM,CAAC,UAAU,mCAAI,EAAE,EACvB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,uBAAuB,EAC9B,MAAM,CAAC,uBAAuB,EAC9B,MAAM,CAAC,WAAW,CACnB,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,WAAW,eAwBtB"}
|
|
@@ -2,6 +2,7 @@ import { BasicAuthProperty } from "./basic-auth-prop";
|
|
|
2
2
|
import { CustomAuthProperty, CustomAuthProps } from "./custom-auth-prop";
|
|
3
3
|
import { SecretTextProperty } from "./secret-text-property";
|
|
4
4
|
import { OAuth2Property, OAuth2Props } from "./oauth2-prop";
|
|
5
|
+
import { AppConnectionType } from "@activepieces/shared";
|
|
5
6
|
export declare const PieceAuthProperty: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
6
7
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
7
8
|
[x: number]: import("@sinclair/typebox").TSchema;
|
|
@@ -90,7 +91,7 @@ export declare const PieceAuthProperty: import("@sinclair/typebox").TUnion<[impo
|
|
|
90
91
|
pkce: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TSchema]>;
|
|
91
92
|
pkceMethod: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"plain">, import("@sinclair/typebox").TLiteral<"S256">]>, import("@sinclair/typebox").TSchema]>;
|
|
92
93
|
authorizationMethod: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TEnum<typeof import("./oauth2-prop").OAuth2AuthorizationMethod>, import("@sinclair/typebox").TSchema]>;
|
|
93
|
-
grantType: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<typeof import("
|
|
94
|
+
grantType: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<typeof import("@activepieces/shared").OAuth2GrantType>, import("@sinclair/typebox").TLiteral<"both_client_credentials_and_authorization_code">]>, import("@sinclair/typebox").TSchema]>;
|
|
94
95
|
extra: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>, import("@sinclair/typebox").TSchema]>;
|
|
95
96
|
}>, import("@sinclair/typebox").TObject<{
|
|
96
97
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
@@ -99,8 +100,11 @@ export declare const PieceAuthProperty: import("@sinclair/typebox").TUnion<[impo
|
|
|
99
100
|
description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
100
101
|
}>]>;
|
|
101
102
|
export type PieceAuthProperty = BasicAuthProperty | CustomAuthProperty<any> | OAuth2Property<any> | SecretTextProperty<boolean>;
|
|
102
|
-
type AuthProperties<T> = Omit<Properties<T>, 'displayName'
|
|
103
|
+
type AuthProperties<T> = Omit<Properties<T>, 'displayName'> & {
|
|
104
|
+
displayName?: string;
|
|
105
|
+
};
|
|
103
106
|
type Properties<T> = Omit<T, 'valueSchema' | 'type' | 'defaultValidators' | 'defaultProcessors'>;
|
|
107
|
+
export declare const DEFAULT_CONNECTION_DISPLAY_NAME = "Connection";
|
|
104
108
|
export declare const PieceAuth: {
|
|
105
109
|
SecretText<R extends boolean>(request: Properties<SecretTextProperty<R>>): R extends true ? SecretTextProperty<true> : SecretTextProperty<false>;
|
|
106
110
|
OAuth2<T extends OAuth2Props>(request: AuthProperties<OAuth2Property<T>>): OAuth2Property<T>;
|
|
@@ -108,4 +112,10 @@ export declare const PieceAuth: {
|
|
|
108
112
|
CustomAuth<T extends CustomAuthProps>(request: AuthProperties<CustomAuthProperty<T>>): CustomAuthProperty<T>;
|
|
109
113
|
None(): undefined;
|
|
110
114
|
};
|
|
115
|
+
export type ExtractPieceAuthPropertyTypeForMethods<T extends PieceAuthProperty | PieceAuthProperty[] | undefined> = T extends PieceAuthProperty[] ? T[number] : T extends undefined ? undefined : T;
|
|
116
|
+
export declare function getAuthPropertyForValue({ authValueType, pieceAuth }: GetAuthPropertyForValue): PieceAuthProperty | undefined;
|
|
117
|
+
type GetAuthPropertyForValue = {
|
|
118
|
+
authValueType: AppConnectionType;
|
|
119
|
+
pieceAuth: PieceAuthProperty | PieceAuthProperty[] | undefined;
|
|
120
|
+
};
|
|
111
121
|
export {};
|
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PieceAuth = exports.PieceAuthProperty = void 0;
|
|
3
|
+
exports.PieceAuth = exports.DEFAULT_CONNECTION_DISPLAY_NAME = exports.PieceAuthProperty = void 0;
|
|
4
|
+
exports.getAuthPropertyForValue = getAuthPropertyForValue;
|
|
4
5
|
const typebox_1 = require("@sinclair/typebox");
|
|
5
6
|
const basic_auth_prop_1 = require("./basic-auth-prop");
|
|
6
7
|
const custom_auth_prop_1 = require("./custom-auth-prop");
|
|
7
8
|
const secret_text_property_1 = require("./secret-text-property");
|
|
8
9
|
const property_type_1 = require("../input/property-type");
|
|
9
10
|
const oauth2_prop_1 = require("./oauth2-prop");
|
|
11
|
+
const shared_1 = require("@activepieces/shared");
|
|
10
12
|
exports.PieceAuthProperty = typebox_1.Type.Union([
|
|
11
13
|
basic_auth_prop_1.BasicAuthProperty,
|
|
12
14
|
custom_auth_prop_1.CustomAuthProperty,
|
|
13
15
|
oauth2_prop_1.OAuth2Property,
|
|
14
16
|
secret_text_property_1.SecretTextProperty,
|
|
15
17
|
]);
|
|
18
|
+
exports.DEFAULT_CONNECTION_DISPLAY_NAME = 'Connection';
|
|
16
19
|
exports.PieceAuth = {
|
|
17
20
|
SecretText(request) {
|
|
18
21
|
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.SECRET_TEXT });
|
|
19
22
|
},
|
|
20
23
|
OAuth2(request) {
|
|
21
|
-
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.OAUTH2, displayName:
|
|
24
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.OAUTH2, displayName: request.displayName || exports.DEFAULT_CONNECTION_DISPLAY_NAME });
|
|
22
25
|
},
|
|
23
26
|
BasicAuth(request) {
|
|
24
|
-
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.BASIC_AUTH, displayName:
|
|
27
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.BASIC_AUTH, displayName: request.displayName || exports.DEFAULT_CONNECTION_DISPLAY_NAME, required: true });
|
|
25
28
|
},
|
|
26
29
|
CustomAuth(request) {
|
|
27
|
-
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.CUSTOM_AUTH, displayName:
|
|
30
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: property_type_1.PropertyType.CUSTOM_AUTH, displayName: request.displayName || exports.DEFAULT_CONNECTION_DISPLAY_NAME });
|
|
28
31
|
},
|
|
29
32
|
None() {
|
|
30
33
|
return undefined;
|
|
31
34
|
},
|
|
32
35
|
};
|
|
36
|
+
function getAuthPropertyForValue({ authValueType, pieceAuth }) {
|
|
37
|
+
if (!Array.isArray(pieceAuth) || (0, shared_1.isNil)(pieceAuth)) {
|
|
38
|
+
return pieceAuth;
|
|
39
|
+
}
|
|
40
|
+
return pieceAuth.find(auth => authConnectionTypeToPropertyType[authValueType] === auth.type);
|
|
41
|
+
}
|
|
42
|
+
const authConnectionTypeToPropertyType = {
|
|
43
|
+
[shared_1.AppConnectionType.OAUTH2]: property_type_1.PropertyType.OAUTH2,
|
|
44
|
+
[shared_1.AppConnectionType.CLOUD_OAUTH2]: property_type_1.PropertyType.OAUTH2,
|
|
45
|
+
[shared_1.AppConnectionType.PLATFORM_OAUTH2]: property_type_1.PropertyType.OAUTH2,
|
|
46
|
+
[shared_1.AppConnectionType.BASIC_AUTH]: property_type_1.PropertyType.BASIC_AUTH,
|
|
47
|
+
[shared_1.AppConnectionType.CUSTOM_AUTH]: property_type_1.PropertyType.CUSTOM_AUTH,
|
|
48
|
+
[shared_1.AppConnectionType.SECRET_TEXT]: property_type_1.PropertyType.SECRET_TEXT,
|
|
49
|
+
[shared_1.AppConnectionType.NO_AUTH]: undefined,
|
|
50
|
+
};
|
|
33
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/authentication/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/authentication/index.ts"],"names":[],"mappings":";;;AA4EA,0DAKC;AAhFD,+CAAyC;AACzC,uDAAsD;AACtD,yDAAyE;AACzE,iEAA4D;AAC5D,0DAAsD;AACt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AE,CAAC,gCAAgC,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/F,CAAC;AAOD,MAAM,gCAAgC,GAAwD;IAC5F,CAAC,0BAAiB,CAAC,MAAM,CAAC,EAAE,4BAAY,CAAC,MAAM;IAC/C,CAAC,0BAAiB,CAAC,YAAY,CAAC,EAAE,4BAAY,CAAC,MAAM;IACrD,CAAC,0BAAiB,CAAC,eAAe,CAAC,EAAE,4BAAY,CAAC,MAAM;IACxD,CAAC,0BAAiB,CAAC,UAAU,CAAC,EAAE,4BAAY,CAAC,UAAU;IACvD,CAAC,0BAAiB,CAAC,WAAW,CAAC,EAAE,4BAAY,CAAC,WAAW;IACzD,CAAC,0BAAiB,CAAC,WAAW,CAAC,EAAE,4BAAY,CAAC,WAAW;IACzD,CAAC,0BAAiB,CAAC,OAAO,CAAC,EAAE,SAAS;CACvC,CAAA"}
|
|
@@ -34,7 +34,7 @@ declare const OAuthProp: import("@sinclair/typebox").TUnion<[import("@sinclair/t
|
|
|
34
34
|
}>>;
|
|
35
35
|
}>, import("@sinclair/typebox").TSchema]>;
|
|
36
36
|
}>]>;
|
|
37
|
-
type OAuthProp = ShortTextProperty<boolean> | SecretTextProperty<boolean> | StaticDropdownProperty<any,
|
|
37
|
+
type OAuthProp = ShortTextProperty<boolean> | SecretTextProperty<boolean> | StaticDropdownProperty<any, boolean>;
|
|
38
38
|
export declare const OAuth2Props: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
39
39
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
40
40
|
[x: number]: import("@sinclair/typebox").TSchema;
|
|
@@ -182,5 +182,5 @@ export declare const OAuth2Property: import("@sinclair/typebox").TObject<{
|
|
|
182
182
|
grantType: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<typeof OAuth2GrantType>, import("@sinclair/typebox").TLiteral<"both_client_credentials_and_authorization_code">]>, import("@sinclair/typebox").TSchema]>;
|
|
183
183
|
extra: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>, import("@sinclair/typebox").TSchema]>;
|
|
184
184
|
}>;
|
|
185
|
-
export type OAuth2Property<T extends OAuth2Props> = BasePieceAuthSchema<OAuth2PropertyValue
|
|
185
|
+
export type OAuth2Property<T extends OAuth2Props> = BasePieceAuthSchema<OAuth2PropertyValue<T>> & OAuth2ExtraProps & TPropertyValue<OAuth2PropertyValue<T>, PropertyType.OAUTH2, true>;
|
|
186
186
|
export {};
|