@useparagon/core 1.0.17 → 1.0.18-canary.2

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.
@@ -1,2 +1,4 @@
1
+ export * from './resource.context';
2
+ export * from './resource.context.interface';
1
3
  export * from './resource.interface';
2
4
  export * from './resource.utils';
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./resource.context"), exports);
5
+ tslib_1.__exportStar(require("./resource.context.interface"), exports);
4
6
  tslib_1.__exportStar(require("./resource.interface"), exports);
5
7
  tslib_1.__exportStar(require("./resource.utils"), exports);
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resource/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,2DAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resource/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uEAA6C;AAC7C,+DAAqC;AACrC,2DAAiC"}
@@ -0,0 +1,4 @@
1
+ export declare class ResourceContext {
2
+ getEnvironmentSecret(key: string): string;
3
+ getInput(input: string): string;
4
+ }
@@ -0,0 +1,4 @@
1
+ export interface IResourceContext {
2
+ getEnvironmentSecret(key: string): string;
3
+ getInput(input: string): string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resource.context.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.context.interface.js","sourceRoot":"","sources":["../../src/resource/resource.context.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceContext = void 0;
4
+ const context_interface_1 = require("../execution/context.interface");
5
+ const context_utils_1 = require("../execution/context.utils");
6
+ class ResourceContext {
7
+ getEnvironmentSecret(key) {
8
+ return (0, context_utils_1.createProxyInputReference)(key, () => key, context_interface_1.ProxyVariableSourceType.SECRET_REFERENCE);
9
+ }
10
+ getInput(input) {
11
+ return (0, context_utils_1.createProxyInputReference)(input, () => input, context_interface_1.ProxyVariableSourceType.WORKFLOW_INPUT_REFERENCE);
12
+ }
13
+ }
14
+ exports.ResourceContext = ResourceContext;
15
+ //# sourceMappingURL=resource.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.context.js","sourceRoot":"","sources":["../../src/resource/resource.context.ts"],"names":[],"mappings":";;;AAAA,sEAAyE;AACzE,8DAAuE;AAEvE,MAAa,eAAe;IAK1B,oBAAoB,CAAC,GAAW;QAC9B,OAAO,IAAA,yCAAyB,EAC9B,GAAG,EACH,GAAG,EAAE,CAAC,GAAG,EACT,2CAAuB,CAAC,gBAAgB,CACzC,CAAC;IACJ,CAAC;IAMD,QAAQ,CAAC,KAAa;QACpB,OAAO,IAAA,yCAAyB,EAC9B,KAAK,EACL,GAAG,EAAE,CAAC,KAAK,EACX,2CAAuB,CAAC,wBAAwB,CACjD,CAAC;IACJ,CAAC;CACF;AAxBD,0CAwBC"}
@@ -1,5 +1,6 @@
1
1
  import { UserProfileUIConfig } from '../integration/custom.integration.interface';
2
2
  import { HttpMethodWithBody, HttpMethodWithoutBody } from '../steps/library/request/request.interface';
3
+ import { IResourceContext } from './resource.context.interface';
3
4
  export declare enum ResourceCategory {
4
5
  API = "api"
5
6
  }
@@ -17,7 +18,34 @@ export declare enum OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE {
17
18
  BodyParam = "body-param",
18
19
  BasicAuthHeader = "basic-auth-header"
19
20
  }
20
- type APIResourceOptionsInit = {
21
+ type AppConnectionScopeAuthorizationOptions = {
22
+ type: `${ResourceAuthorizationType.NONE}`;
23
+ } | {
24
+ type: `${ResourceAuthorizationType.OAUTH_CLIENT_CREDENTIAL}`;
25
+ accessTokenUrl: string;
26
+ userInputs: string[];
27
+ audience?: string;
28
+ includeClientIdClientSecretInExchange?: boolean;
29
+ } | {
30
+ type: `${ResourceAuthorizationType.API_KEY}`;
31
+ };
32
+ type UserConnectionScopeAuthorizationOptions = {
33
+ type: `${ResourceAuthorizationType.NONE}`;
34
+ } | {
35
+ type: `${ResourceAuthorizationType.OAUTH}`;
36
+ accessTokenUrl: string;
37
+ userInputs: string[];
38
+ includeClientIdClientSecretInExchange?: boolean;
39
+ } | {
40
+ type: `${ResourceAuthorizationType.OAUTH_CLIENT_CREDENTIAL}`;
41
+ accessTokenUrl: string;
42
+ userInputs: string[];
43
+ includeClientIdClientSecretInExchange?: boolean;
44
+ } | {
45
+ type: `${ResourceAuthorizationType.API_KEY}`;
46
+ userInputs: string[];
47
+ };
48
+ type APIResourceOptionsInit<T extends `${ResourceConnectionScope}`> = {
21
49
  requestOptions: {
22
50
  apiBaseUrl: string;
23
51
  authentication: {
@@ -52,43 +80,37 @@ type APIResourceOptionsInit = {
52
80
  bodyType: 'xml' | 'raw';
53
81
  body: string;
54
82
  });
55
- } & ({
83
+ } & (T extends `${ResourceConnectionScope.APP}` ? {
56
84
  connectionScope: `${ResourceConnectionScope.APP}`;
57
- authorizationOptions: {
58
- type: `${ResourceAuthorizationType.NONE}`;
59
- } | {
60
- type: `${ResourceAuthorizationType.OAUTH_CLIENT_CREDENTIAL}`;
61
- accessTokenUrl: string;
62
- userInputs: string[];
63
- audience?: string;
64
- includeClientIdClientSecretInExchange?: boolean;
65
- } | {
66
- type: `${ResourceAuthorizationType.API_KEY}`;
67
- };
68
- } | {
85
+ authorizationOptions: AppConnectionScopeAuthorizationOptions;
86
+ } : {
69
87
  connectionScope: `${ResourceConnectionScope.USER}`;
70
- authorizationOptions: {
71
- type: `${ResourceAuthorizationType.NONE}`;
72
- } | {
73
- type: `${ResourceAuthorizationType.OAUTH}`;
74
- accessTokenUrl: string;
75
- userInputs: string[];
76
- includeClientIdClientSecretInExchange?: boolean;
77
- } | {
78
- type: `${ResourceAuthorizationType.OAUTH_CLIENT_CREDENTIAL}`;
79
- accessTokenUrl: string;
80
- userInputs: string[];
81
- includeClientIdClientSecretInExchange?: boolean;
82
- } | {
83
- type: `${ResourceAuthorizationType.API_KEY}`;
84
- userInputs: string[];
85
- };
88
+ authorizationOptions: UserConnectionScopeAuthorizationOptions;
86
89
  userProfileConfig?: UserProfileUIConfig;
87
90
  });
88
- export type IResourceInit = {
91
+ export type IResourceInit<T extends `${ResourceConnectionScope}` = ResourceConnectionScope.APP | ResourceConnectionScope.USER> = {
89
92
  id: string;
90
93
  name: string;
91
94
  isPublished: boolean;
92
95
  category: `${ResourceCategory.API}`;
93
- } & APIResourceOptionsInit;
96
+ connectionScope: T;
97
+ getRequestConfig(context: IResourceContext): ResourceRequestConfig<T>;
98
+ getTestRequestConfig(context: IResourceContext): ResourceTestRequestConfig<T>;
99
+ getAuthorizationConfig(context: IResourceContext): ResourceAuthorizationConfig<T>;
100
+ getUserProfileConfig?(context: IResourceContext): T extends ResourceConnectionScope.USER ? UserProfileUIConfig | undefined : never;
101
+ };
102
+ export type ResourceTestRequestConfig<T extends `${ResourceConnectionScope}`> = APIResourceOptionsInit<T>['testRequestOptions'];
103
+ export type ResourceAuthorizationConfig<T extends `${ResourceConnectionScope}`> = APIResourceOptionsInit<T>['authorizationOptions'];
104
+ export type ResourceRequestConfig<T extends `${ResourceConnectionScope}`> = APIResourceOptionsInit<T>['requestOptions'];
105
+ export declare abstract class AbstractAPIResourceInit<T extends `${ResourceConnectionScope}`> {
106
+ abstract readonly id: string;
107
+ abstract name: string;
108
+ abstract isPublished: boolean;
109
+ abstract connectionScope: T;
110
+ category: `${ResourceCategory.API}`;
111
+ abstract getRequestConfig(context: IResourceContext): ResourceRequestConfig<T>;
112
+ abstract getTestRequestConfig(context: IResourceContext): ResourceTestRequestConfig<T>;
113
+ abstract getAuthorizationConfig(context: IResourceContext): ResourceAuthorizationConfig<T>;
114
+ abstract getUserProfileConfig?(context: IResourceContext): T extends ResourceConnectionScope.USER ? UserProfileUIConfig | undefined : never;
115
+ }
94
116
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE = exports.ResourceAuthorizationType = exports.ResourceConnectionScope = exports.ResourceCategory = void 0;
3
+ exports.AbstractAPIResourceInit = exports.OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE = exports.ResourceAuthorizationType = exports.ResourceConnectionScope = exports.ResourceCategory = void 0;
4
4
  var ResourceCategory;
5
5
  (function (ResourceCategory) {
6
6
  ResourceCategory["API"] = "api";
@@ -22,4 +22,8 @@ var OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE;
22
22
  OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE["BodyParam"] = "body-param";
23
23
  OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE["BasicAuthHeader"] = "basic-auth-header";
24
24
  })(OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE || (exports.OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE = OAUTH_CLIENT_CREDENTIAL_REQUEST_TYPE = {}));
25
+ class AbstractAPIResourceInit {
26
+ category = ResourceCategory.API;
27
+ }
28
+ exports.AbstractAPIResourceInit = AbstractAPIResourceInit;
25
29
  //# sourceMappingURL=resource.interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.interface.js","sourceRoot":"","sources":["../../src/resource/resource.interface.ts"],"names":[],"mappings":";;;AAMA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;AACb,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,sCAAW,CAAA;IACX,wCAAa,CAAA;AACf,CAAC,EAHW,uBAAuB,uCAAvB,uBAAuB,QAGlC;AAED,IAAY,yBAKX;AALD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,4CAAe,CAAA;IACf,gFAAmD,CAAA;IACnD,gDAAmB,CAAA;AACrB,CAAC,EALW,yBAAyB,yCAAzB,yBAAyB,QAKpC;AAED,IAAY,oCAGX;AAHD,WAAY,oCAAoC;IAC9C,gEAAwB,CAAA;IACxB,6EAAqC,CAAA;AACvC,CAAC,EAHW,oCAAoC,oDAApC,oCAAoC,QAG/C"}
1
+ {"version":3,"file":"resource.interface.js","sourceRoot":"","sources":["../../src/resource/resource.interface.ts"],"names":[],"mappings":";;;AAOA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;AACb,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,sCAAW,CAAA;IACX,wCAAa,CAAA;AACf,CAAC,EAHW,uBAAuB,uCAAvB,uBAAuB,QAGlC;AAED,IAAY,yBAKX;AALD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,4CAAe,CAAA;IACf,gFAAmD,CAAA;IACnD,gDAAmB,CAAA;AACrB,CAAC,EALW,yBAAyB,yCAAzB,yBAAyB,QAKpC;AAED,IAAY,oCAGX;AAHD,WAAY,oCAAoC;IAC9C,gEAAwB,CAAA;IACxB,6EAAqC,CAAA;AACvC,CAAC,EAHW,oCAAoC,oDAApC,oCAAoC,QAG/C;AAyPD,MAAsB,uBAAuB;IAW3C,QAAQ,GAA8B,gBAAgB,CAAC,GAAG,CAAC;CAmB5D;AA9BD,0DA8BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/core",
3
- "version": "1.0.17",
3
+ "version": "1.0.18-canary.2",
4
4
  "description": "Core libraries for paragraph",
5
5
  "repository": "https://github.com/useparagon/paragraph",
6
6
  "packageManager": "pnpm@8.10.5",