@oneblink/sdk 3.2.0-beta.2 → 3.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.
- package/package.json +1 -1
- package/tenants/classes/FormElementLists.d.ts +111 -0
- package/tenants/classes/FormElementLists.js +149 -0
- package/tenants/classes/FormElementLists.js.map +1 -0
- package/tenants/classes/FormElementLookups.d.ts +120 -0
- package/tenants/classes/FormElementLookups.js +151 -0
- package/tenants/classes/FormElementLookups.js.map +1 -0
- package/tenants/classes/index.d.ts +3 -1
- package/tenants/classes/index.js +5 -1
- package/tenants/classes/index.js.map +1 -1
- package/tenants/types.d.ts +27 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/sdk",
|
|
3
3
|
"description": "OneBlink SDK to serve as an entry point for all OneBlink Services in NodeJS",
|
|
4
|
-
"version": "3.2.0
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/oneblink/sdk-node-js/issues"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { FormTypes } from '@oneblink/types';
|
|
2
|
+
import OneBlinkAPI from '../lib/one-blink-api';
|
|
3
|
+
import { ConstructorOptions, FormElementListSearchOptions, FormElementListSearchResult } from '../types';
|
|
4
|
+
export default class FormElementLists extends OneBlinkAPI {
|
|
5
|
+
/**
|
|
6
|
+
* #### Example
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { FormElementLists } from '@oneblink/sdk'
|
|
10
|
+
*
|
|
11
|
+
* const options = {
|
|
12
|
+
* accessKey: '123455678901ABCDEFGHIJKL',
|
|
13
|
+
* secretKey: '123455678901ABCDEFGHIJKL123455678901ABCDEFGHIJKL',
|
|
14
|
+
* }
|
|
15
|
+
* const formElementListsClient = new FormElementLists(options)
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
constructor(options: ConstructorOptions);
|
|
19
|
+
/**
|
|
20
|
+
* #### Example
|
|
21
|
+
*
|
|
22
|
+
* ```javascript
|
|
23
|
+
* const searchParams = {
|
|
24
|
+
* limit: 1,
|
|
25
|
+
* offset: 0,
|
|
26
|
+
* }
|
|
27
|
+
* const { formElementLists, meta } =
|
|
28
|
+
* await formElementListsClient.searchFormElementLists(searchParams)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param searchParams Search options
|
|
32
|
+
*/
|
|
33
|
+
searchFormElementLists(searchParams: FormElementListSearchOptions): Promise<FormElementListSearchResult>;
|
|
34
|
+
/**
|
|
35
|
+
* #### Example
|
|
36
|
+
*
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const data = {
|
|
39
|
+
* name: 'my list',
|
|
40
|
+
* organisationId: 'abc123',
|
|
41
|
+
* environments: [
|
|
42
|
+
* {
|
|
43
|
+
* options: [
|
|
44
|
+
* {
|
|
45
|
+
* label: 'One'
|
|
46
|
+
* value: '1'
|
|
47
|
+
* },
|
|
48
|
+
* {
|
|
49
|
+
* label: 'Two'
|
|
50
|
+
* value: '2'
|
|
51
|
+
* }
|
|
52
|
+
* ]
|
|
53
|
+
* formsAppEnvironmentId: 1,
|
|
54
|
+
* },
|
|
55
|
+
* ],
|
|
56
|
+
* type: 'STATIC',
|
|
57
|
+
* }
|
|
58
|
+
* const list = await formElementListsClient.createFormElementList(data)
|
|
59
|
+
* // Use list here...
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param newFormElementList The data for the new list
|
|
63
|
+
*/
|
|
64
|
+
createFormElementList(newFormElementList: FormTypes.NewFormElementOptionSet): Promise<FormTypes.FormElementOptionSet>;
|
|
65
|
+
/**
|
|
66
|
+
* #### Example
|
|
67
|
+
*
|
|
68
|
+
* ```javascript
|
|
69
|
+
* const data = {
|
|
70
|
+
* id: 1,
|
|
71
|
+
* name: 'my list',
|
|
72
|
+
* organisationId: 'abc123',
|
|
73
|
+
* environments: [
|
|
74
|
+
* {
|
|
75
|
+
* options: [
|
|
76
|
+
* {
|
|
77
|
+
* label: 'One'
|
|
78
|
+
* value: '1'
|
|
79
|
+
* },
|
|
80
|
+
* {
|
|
81
|
+
* label: 'Two'
|
|
82
|
+
* value: '2'
|
|
83
|
+
* },
|
|
84
|
+
* {
|
|
85
|
+
* label: 'Three'
|
|
86
|
+
* value: '2'
|
|
87
|
+
* },
|
|
88
|
+
* ]
|
|
89
|
+
* formsAppEnvironmentId: 1,
|
|
90
|
+
* },
|
|
91
|
+
* ],
|
|
92
|
+
* type: 'STATIC',
|
|
93
|
+
* }
|
|
94
|
+
* const list = await formElementListsClient.updateFormElementList(data)
|
|
95
|
+
* // Use list here...
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @param list The data for the list to update
|
|
99
|
+
*/
|
|
100
|
+
updateFormElementList(list: FormTypes.FormElementOptionSet): Promise<FormTypes.FormElementOptionSet>;
|
|
101
|
+
/**
|
|
102
|
+
* #### Example
|
|
103
|
+
*
|
|
104
|
+
* ```javascript
|
|
105
|
+
* await formElementListsClient.deleteFormElementList(1)
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param id The id of the list to delete
|
|
109
|
+
*/
|
|
110
|
+
deleteFormElementList(id: number): Promise<void>;
|
|
111
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const one_blink_api_1 = __importDefault(require("../lib/one-blink-api"));
|
|
7
|
+
const basePath = `/form-element-options/dynamic`;
|
|
8
|
+
class FormElementLists extends one_blink_api_1.default {
|
|
9
|
+
/**
|
|
10
|
+
* #### Example
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { FormElementLists } from '@oneblink/sdk'
|
|
14
|
+
*
|
|
15
|
+
* const options = {
|
|
16
|
+
* accessKey: '123455678901ABCDEFGHIJKL',
|
|
17
|
+
* secretKey: '123455678901ABCDEFGHIJKL123455678901ABCDEFGHIJKL',
|
|
18
|
+
* }
|
|
19
|
+
* const formElementListsClient = new FormElementLists(options)
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
constructor(options) {
|
|
23
|
+
options = options || {};
|
|
24
|
+
super(options.accessKey, options.secretKey);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* #### Example
|
|
28
|
+
*
|
|
29
|
+
* ```javascript
|
|
30
|
+
* const searchParams = {
|
|
31
|
+
* limit: 1,
|
|
32
|
+
* offset: 0,
|
|
33
|
+
* }
|
|
34
|
+
* const { formElementLists, meta } =
|
|
35
|
+
* await formElementListsClient.searchFormElementLists(searchParams)
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param searchParams Search options
|
|
39
|
+
*/
|
|
40
|
+
async searchFormElementLists(searchParams) {
|
|
41
|
+
if (!searchParams ||
|
|
42
|
+
typeof searchParams !== 'object' ||
|
|
43
|
+
typeof searchParams.organisationId !== 'string') {
|
|
44
|
+
throw new TypeError('Must supply "options.organisationId" as a string');
|
|
45
|
+
}
|
|
46
|
+
const result = await super.searchRequest(basePath, searchParams);
|
|
47
|
+
return {
|
|
48
|
+
meta: result.meta,
|
|
49
|
+
formElementLists: result.formElementDynamicOptionSets,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* #### Example
|
|
54
|
+
*
|
|
55
|
+
* ```javascript
|
|
56
|
+
* const data = {
|
|
57
|
+
* name: 'my list',
|
|
58
|
+
* organisationId: 'abc123',
|
|
59
|
+
* environments: [
|
|
60
|
+
* {
|
|
61
|
+
* options: [
|
|
62
|
+
* {
|
|
63
|
+
* label: 'One'
|
|
64
|
+
* value: '1'
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* label: 'Two'
|
|
68
|
+
* value: '2'
|
|
69
|
+
* }
|
|
70
|
+
* ]
|
|
71
|
+
* formsAppEnvironmentId: 1,
|
|
72
|
+
* },
|
|
73
|
+
* ],
|
|
74
|
+
* type: 'STATIC',
|
|
75
|
+
* }
|
|
76
|
+
* const list = await formElementListsClient.createFormElementList(data)
|
|
77
|
+
* // Use list here...
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param newFormElementList The data for the new list
|
|
81
|
+
*/
|
|
82
|
+
async createFormElementList(newFormElementList) {
|
|
83
|
+
if (!newFormElementList || typeof newFormElementList !== 'object') {
|
|
84
|
+
throw new TypeError('Must supply "newList" as an object');
|
|
85
|
+
}
|
|
86
|
+
return super.postRequest(basePath, newFormElementList);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* #### Example
|
|
90
|
+
*
|
|
91
|
+
* ```javascript
|
|
92
|
+
* const data = {
|
|
93
|
+
* id: 1,
|
|
94
|
+
* name: 'my list',
|
|
95
|
+
* organisationId: 'abc123',
|
|
96
|
+
* environments: [
|
|
97
|
+
* {
|
|
98
|
+
* options: [
|
|
99
|
+
* {
|
|
100
|
+
* label: 'One'
|
|
101
|
+
* value: '1'
|
|
102
|
+
* },
|
|
103
|
+
* {
|
|
104
|
+
* label: 'Two'
|
|
105
|
+
* value: '2'
|
|
106
|
+
* },
|
|
107
|
+
* {
|
|
108
|
+
* label: 'Three'
|
|
109
|
+
* value: '2'
|
|
110
|
+
* },
|
|
111
|
+
* ]
|
|
112
|
+
* formsAppEnvironmentId: 1,
|
|
113
|
+
* },
|
|
114
|
+
* ],
|
|
115
|
+
* type: 'STATIC',
|
|
116
|
+
* }
|
|
117
|
+
* const list = await formElementListsClient.updateFormElementList(data)
|
|
118
|
+
* // Use list here...
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @param list The data for the list to update
|
|
122
|
+
*/
|
|
123
|
+
async updateFormElementList(list) {
|
|
124
|
+
if (!list || typeof list !== 'object') {
|
|
125
|
+
throw new TypeError('Must supply "list" as an object');
|
|
126
|
+
}
|
|
127
|
+
if (typeof list.id !== 'number') {
|
|
128
|
+
throw new TypeError('Must supply "list.id" as a number');
|
|
129
|
+
}
|
|
130
|
+
return super.putRequest(`${basePath}/${list.id}`, list);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* #### Example
|
|
134
|
+
*
|
|
135
|
+
* ```javascript
|
|
136
|
+
* await formElementListsClient.deleteFormElementList(1)
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @param id The id of the list to delete
|
|
140
|
+
*/
|
|
141
|
+
async deleteFormElementList(id) {
|
|
142
|
+
if (typeof id !== 'number' || Number.isNaN(id)) {
|
|
143
|
+
throw new TypeError('Must supply "id" as a number');
|
|
144
|
+
}
|
|
145
|
+
return super.deleteRequest(`${basePath}/${id}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.default = FormElementLists;
|
|
149
|
+
//# sourceMappingURL=FormElementLists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormElementLists.js","sourceRoot":"","sources":["../../src/classes/FormElementLists.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAO9C,MAAM,QAAQ,GAAG,+BAA+B,CAAA;AAEhD,MAAqB,gBAAiB,SAAQ,uBAAW;IACvD;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B;QACrC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,sBAAsB,CAC1B,YAA0C;QAE1C,IACE,CAAC,YAAY;YACb,OAAO,YAAY,KAAK,QAAQ;YAChC,OAAO,YAAY,CAAC,cAAc,KAAK,QAAQ,EAC/C;Y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AAE,EAAE,CAAC,CAAA;IACjD,CAAC;CACF;AApKD,mCAoKC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { FormTypes } from '@oneblink/types';
|
|
2
|
+
import OneBlinkAPI from '../lib/one-blink-api';
|
|
3
|
+
import { ConstructorOptions, FormElementLookupSearchResult } from '../types';
|
|
4
|
+
export default class FormElementLookups extends OneBlinkAPI {
|
|
5
|
+
/**
|
|
6
|
+
* #### Example
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { FormElementLookups } from '@oneblink/sdk'
|
|
10
|
+
*
|
|
11
|
+
* const options = {
|
|
12
|
+
* accessKey: '123455678901ABCDEFGHIJKL',
|
|
13
|
+
* secretKey: '123455678901ABCDEFGHIJKL123455678901ABCDEFGHIJKL',
|
|
14
|
+
* }
|
|
15
|
+
* const formElementLookups = new FormElementLookups(options)
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
constructor(options: ConstructorOptions);
|
|
19
|
+
/**
|
|
20
|
+
* #### Example
|
|
21
|
+
*
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const lookupId = 1
|
|
24
|
+
* const lookup = await formElementLookups.getFormElementLookup(lookupId)
|
|
25
|
+
* // Use lookup here
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param id The exact id of the lookup you wish to get
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
getFormElementLookup(id: number): Promise<FormTypes.FormElementLookup>;
|
|
32
|
+
/**
|
|
33
|
+
* #### Example
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const organisationId = '2i4321a7n2389a2700065425'
|
|
37
|
+
* const lookups = await formElementLookups.searchFormElementLookups({
|
|
38
|
+
* organisationId,
|
|
39
|
+
* limit: 50,
|
|
40
|
+
* offset: 0,
|
|
41
|
+
* })
|
|
42
|
+
* // Use lookups here
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param options
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
searchFormElementLookups(options: {
|
|
49
|
+
/**
|
|
50
|
+
* The exact id of organisation associated with the lookups you wish to
|
|
51
|
+
* search
|
|
52
|
+
*/
|
|
53
|
+
organisationId: string;
|
|
54
|
+
limit?: number;
|
|
55
|
+
offset?: number;
|
|
56
|
+
}): Promise<FormElementLookupSearchResult>;
|
|
57
|
+
/**
|
|
58
|
+
* #### Example
|
|
59
|
+
*
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const newLookup = {
|
|
62
|
+
* name: 'My New Lookup',
|
|
63
|
+
* environments: [
|
|
64
|
+
* {
|
|
65
|
+
* formsAppEnvironmentId: 1,
|
|
66
|
+
* urL: 'https://my-url.com/lookup',
|
|
67
|
+
* },
|
|
68
|
+
* ],
|
|
69
|
+
* type: 'DATA',
|
|
70
|
+
* organisationId: '',
|
|
71
|
+
* }
|
|
72
|
+
* const createdLookup = await lookups.createFormElementLookup(newLookup)
|
|
73
|
+
* // Use lookup here
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @param newFormElementLookup
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
createFormElementLookup(newFormElementLookup: FormTypes.NewFormElementLookup): Promise<FormTypes.FormElementLookup>;
|
|
80
|
+
/**
|
|
81
|
+
* #### Example
|
|
82
|
+
*
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const lookup = {
|
|
85
|
+
* id: 1,
|
|
86
|
+
* createdAt: '2023-06-28T02:00:03.000Z',
|
|
87
|
+
* updatedAt: '2023-06-28T02:00:03.000Z',
|
|
88
|
+
* name: 'My New Lookup',
|
|
89
|
+
* environments: [
|
|
90
|
+
* {
|
|
91
|
+
* formsAppEnvironmentId: 1,
|
|
92
|
+
* url: 'https://my-url.com/lookup',
|
|
93
|
+
* },
|
|
94
|
+
* ],
|
|
95
|
+
* type: 'DATA',
|
|
96
|
+
* organisationId: '',
|
|
97
|
+
* }
|
|
98
|
+
* const updatedLookup = await formElementLookups.updateFormElementLookup(
|
|
99
|
+
* lookup,
|
|
100
|
+
* )
|
|
101
|
+
* // Use lookup here
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @param formElementLookup
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
updateFormElementLookup(formElementLookup: FormTypes.FormElementLookup): Promise<FormTypes.FormElementLookup>;
|
|
108
|
+
/**
|
|
109
|
+
* #### Example
|
|
110
|
+
*
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const lookupId = 7
|
|
113
|
+
* await formElementLookups.deleteFormElementLookup(lookupId)
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param id The id of the lookup to delete
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
deleteFormElementLookup(id: number): Promise<void>;
|
|
120
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const one_blink_api_1 = __importDefault(require("../lib/one-blink-api"));
|
|
7
|
+
class FormElementLookups extends one_blink_api_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* #### Example
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { FormElementLookups } from '@oneblink/sdk'
|
|
13
|
+
*
|
|
14
|
+
* const options = {
|
|
15
|
+
* accessKey: '123455678901ABCDEFGHIJKL',
|
|
16
|
+
* secretKey: '123455678901ABCDEFGHIJKL123455678901ABCDEFGHIJKL',
|
|
17
|
+
* }
|
|
18
|
+
* const formElementLookups = new FormElementLookups(options)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
constructor(options) {
|
|
22
|
+
options = options || {};
|
|
23
|
+
super(options.accessKey, options.secretKey);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* #### Example
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const lookupId = 1
|
|
30
|
+
* const lookup = await formElementLookups.getFormElementLookup(lookupId)
|
|
31
|
+
* // Use lookup here
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param id The exact id of the lookup you wish to get
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
async getFormElementLookup(id) {
|
|
38
|
+
if (typeof id !== 'number' || Number.isNaN(id)) {
|
|
39
|
+
throw new TypeError('Must supply "id" as a number');
|
|
40
|
+
}
|
|
41
|
+
return super.getRequest(`/form-element-lookups/${id}`);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* #### Example
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const organisationId = '2i4321a7n2389a2700065425'
|
|
48
|
+
* const lookups = await formElementLookups.searchFormElementLookups({
|
|
49
|
+
* organisationId,
|
|
50
|
+
* limit: 50,
|
|
51
|
+
* offset: 0,
|
|
52
|
+
* })
|
|
53
|
+
* // Use lookups here
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param options
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
async searchFormElementLookups(options) {
|
|
60
|
+
if (!options ||
|
|
61
|
+
typeof options !== 'object' ||
|
|
62
|
+
typeof options.organisationId !== 'string') {
|
|
63
|
+
throw new TypeError('Must supply "options.organisationId" as a string');
|
|
64
|
+
}
|
|
65
|
+
return super.searchRequest(`/form-element-lookups`, {
|
|
66
|
+
limit: options.limit,
|
|
67
|
+
offset: options.offset,
|
|
68
|
+
organisationId: options.organisationId,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* #### Example
|
|
73
|
+
*
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const newLookup = {
|
|
76
|
+
* name: 'My New Lookup',
|
|
77
|
+
* environments: [
|
|
78
|
+
* {
|
|
79
|
+
* formsAppEnvironmentId: 1,
|
|
80
|
+
* urL: 'https://my-url.com/lookup',
|
|
81
|
+
* },
|
|
82
|
+
* ],
|
|
83
|
+
* type: 'DATA',
|
|
84
|
+
* organisationId: '',
|
|
85
|
+
* }
|
|
86
|
+
* const createdLookup = await lookups.createFormElementLookup(newLookup)
|
|
87
|
+
* // Use lookup here
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param newFormElementLookup
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
async createFormElementLookup(newFormElementLookup) {
|
|
94
|
+
if (!newFormElementLookup || typeof newFormElementLookup !== 'object') {
|
|
95
|
+
throw new TypeError('Must supply "newLookup" as an object');
|
|
96
|
+
}
|
|
97
|
+
return super.postRequest(`/form-element-lookups`, newFormElementLookup);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* #### Example
|
|
101
|
+
*
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const lookup = {
|
|
104
|
+
* id: 1,
|
|
105
|
+
* createdAt: '2023-06-28T02:00:03.000Z',
|
|
106
|
+
* updatedAt: '2023-06-28T02:00:03.000Z',
|
|
107
|
+
* name: 'My New Lookup',
|
|
108
|
+
* environments: [
|
|
109
|
+
* {
|
|
110
|
+
* formsAppEnvironmentId: 1,
|
|
111
|
+
* url: 'https://my-url.com/lookup',
|
|
112
|
+
* },
|
|
113
|
+
* ],
|
|
114
|
+
* type: 'DATA',
|
|
115
|
+
* organisationId: '',
|
|
116
|
+
* }
|
|
117
|
+
* const updatedLookup = await formElementLookups.updateFormElementLookup(
|
|
118
|
+
* lookup,
|
|
119
|
+
* )
|
|
120
|
+
* // Use lookup here
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param formElementLookup
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
async updateFormElementLookup(formElementLookup) {
|
|
127
|
+
if (!formElementLookup || typeof formElementLookup !== 'object') {
|
|
128
|
+
throw new TypeError('Must supply "updatedLookup" as an object');
|
|
129
|
+
}
|
|
130
|
+
return super.putRequest(`/form-element-lookups/${formElementLookup.id}`, formElementLookup);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* #### Example
|
|
134
|
+
*
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const lookupId = 7
|
|
137
|
+
* await formElementLookups.deleteFormElementLookup(lookupId)
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @param id The id of the lookup to delete
|
|
141
|
+
* @returns
|
|
142
|
+
*/
|
|
143
|
+
async deleteFormElementLookup(id) {
|
|
144
|
+
if (typeof id !== 'number' || Number.isNaN(id)) {
|
|
145
|
+
throw new TypeError('Must supply "id" as a number');
|
|
146
|
+
}
|
|
147
|
+
return super.deleteRequest(`/form-element-lookups/${id}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.default = FormElementLookups;
|
|
151
|
+
//# sourceMappingURL=FormElementLookups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormElementLookups.js","sourceRoot":"","sources":["../../src/classes/FormElementLookups.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAG9C,MAAqB,kBAAmB,SAAQ,uBAAW;IACzD;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B;QACrC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,oBAAoB,CAAC,EAAU;QACnC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;YAC9C,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAA;SACpD;QAED,OAAO,KAAK,CAAC,UAAU,CAAC,yBAAyB,EAAE,EAAE,CA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SACpD;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA;IAC3D,CAAC;CACF;AAtKD,qCAsKC"}
|
|
@@ -9,5 +9,7 @@ import Approvals from './Approvals';
|
|
|
9
9
|
import FormsAppEnvironments from './FormsAppEnvironments';
|
|
10
10
|
import EmailTemplates from './EmailTemplates';
|
|
11
11
|
import DataManager from './DataManager';
|
|
12
|
+
import FormElementLookups from './FormElementLookups';
|
|
13
|
+
import FormElementLists from './FormElementLists';
|
|
12
14
|
import sendEmail from './sendEmail';
|
|
13
|
-
export { Forms, FormsApps, Jobs, Keys, Organisations, TeamMembers, PDF, Approvals, FormsAppEnvironments, EmailTemplates, DataManager, sendEmail, };
|
|
15
|
+
export { Forms, FormsApps, Jobs, Keys, Organisations, TeamMembers, PDF, Approvals, FormsAppEnvironments, EmailTemplates, DataManager, FormElementLookups, FormElementLists, sendEmail, };
|
package/tenants/classes/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sendEmail = exports.DataManager = exports.EmailTemplates = exports.FormsAppEnvironments = exports.Approvals = exports.PDF = exports.TeamMembers = exports.Organisations = exports.Keys = exports.Jobs = exports.FormsApps = exports.Forms = void 0;
|
|
6
|
+
exports.sendEmail = exports.FormElementLists = exports.FormElementLookups = exports.DataManager = exports.EmailTemplates = exports.FormsAppEnvironments = exports.Approvals = exports.PDF = exports.TeamMembers = exports.Organisations = exports.Keys = exports.Jobs = exports.FormsApps = exports.Forms = void 0;
|
|
7
7
|
// Classes
|
|
8
8
|
const Forms_1 = __importDefault(require("./Forms"));
|
|
9
9
|
exports.Forms = Forms_1.default;
|
|
@@ -27,6 +27,10 @@ const EmailTemplates_1 = __importDefault(require("./EmailTemplates"));
|
|
|
27
27
|
exports.EmailTemplates = EmailTemplates_1.default;
|
|
28
28
|
const DataManager_1 = __importDefault(require("./DataManager"));
|
|
29
29
|
exports.DataManager = DataManager_1.default;
|
|
30
|
+
const FormElementLookups_1 = __importDefault(require("./FormElementLookups"));
|
|
31
|
+
exports.FormElementLookups = FormElementLookups_1.default;
|
|
32
|
+
const FormElementLists_1 = __importDefault(require("./FormElementLists"));
|
|
33
|
+
exports.FormElementLists = FormElementLists_1.default;
|
|
30
34
|
// Functions
|
|
31
35
|
const sendEmail_1 = __importDefault(require("./sendEmail"));
|
|
32
36
|
exports.sendEmail = sendEmail_1.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,oDAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,oDAA2B;AAiBzB,gBAjBK,eAAK,CAiBL;AAhBP,4DAAmC;AAiBjC,oBAjBK,mBAAS,CAiBL;AAhBX,kDAAyB;AAiBvB,eAjBK,cAAI,CAiBL;AAhBN,kDAAyB;AAiBvB,eAjBK,cAAI,CAiBL;AAhBN,oEAA2C;AAiBzC,wBAjBK,uBAAa,CAiBL;AAhBf,gEAAuC;AAiBrC,sBAjBK,qBAAW,CAiBL;AAhBb,gDAAuB;AAiBrB,cAjBK,aAAG,CAiBL;AAhBL,4DAAmC;AAiBjC,oBAjBK,mBAAS,CAiBL;AAhBX,kFAAyD;AAiBvD,+BAjBK,8BAAoB,CAiBL;AAhBtB,sEAA6C;AAiB3C,yBAjBK,wBAAc,CAiBL;AAhBhB,gEAAuC;AAiBrC,sBAjBK,qBAAW,CAiBL;AAhBb,8EAAqD;AAiBnD,6BAjBK,4BAAkB,CAiBL;AAhBpB,0EAAiD;AAiB/C,2BAjBK,0BAAgB,CAiBL;AAhBlB,YAAY;AACZ,4DAAmC;AAgBjC,oBAhBK,mBAAS,CAgBL"}
|
package/tenants/types.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export type PreFillMeta = AWSTypes.FormS3Credentials & {
|
|
|
15
15
|
export type BaseSearchOptions = {
|
|
16
16
|
/** Limit the number of results returned */
|
|
17
17
|
limit?: number;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Skip a specific number of results, used in conjunction with `limit` to
|
|
20
|
+
* enforce paging
|
|
21
|
+
*/
|
|
19
22
|
offset?: number;
|
|
20
23
|
};
|
|
21
24
|
export type TenantBase = {
|
|
@@ -64,7 +67,10 @@ export type FormsSearchOptions = BaseSearchOptions & {
|
|
|
64
67
|
* or `false` or not specified.
|
|
65
68
|
*/
|
|
66
69
|
isAuthenticated?: boolean;
|
|
67
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Search on the `name` property of a form. Can be a prefix, suffix or partial
|
|
72
|
+
* match
|
|
73
|
+
*/
|
|
68
74
|
name?: string;
|
|
69
75
|
/**
|
|
70
76
|
* Search on the `formsAppIds` property of a form. Must be the exact match of
|
|
@@ -141,7 +147,10 @@ export type JobsSearchResult = MiscTypes.BaseSearchResult & {
|
|
|
141
147
|
jobs: SubmissionTypes.FormsAppJob[];
|
|
142
148
|
};
|
|
143
149
|
export type DataManagerRegexFilter = {
|
|
144
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* The Regular expression to search with. This can just be a simple string if
|
|
152
|
+
* desired.
|
|
153
|
+
*/
|
|
145
154
|
$regex: string;
|
|
146
155
|
/**
|
|
147
156
|
* Regex options. String with any combination of the following characters:
|
|
@@ -215,7 +224,10 @@ export type DataManagerFreshdeskDependentFieldFilter = {
|
|
|
215
224
|
* `select` element.
|
|
216
225
|
*/
|
|
217
226
|
subCategory?: DataManagerStringArrayFilter;
|
|
218
|
-
/**
|
|
227
|
+
/**
|
|
228
|
+
* The filter for the `item`. This property is treated as a non multi `select`
|
|
229
|
+
* element.
|
|
230
|
+
*/
|
|
219
231
|
item?: DataManagerStringArrayFilter;
|
|
220
232
|
};
|
|
221
233
|
export type DataManagerNestedFilterFilter = {
|
|
@@ -236,7 +248,8 @@ export type DataManagerNestedFilterFilter = {
|
|
|
236
248
|
* Element of type: checkboxes, select (multi): USE
|
|
237
249
|
* `DataManagerMultipleSelectionsArrayFilter`.
|
|
238
250
|
*
|
|
239
|
-
* Element of type: radio, autocomplete, select: USE
|
|
251
|
+
* Element of type: radio, autocomplete, select: USE
|
|
252
|
+
* `DataManagerStringArrayFilter`.
|
|
240
253
|
*
|
|
241
254
|
* Element of type: boolean: USE `DataManagerBooleanFilter`.
|
|
242
255
|
*
|
|
@@ -301,3 +314,12 @@ export type SearchDataManagerRecordsResponse = {
|
|
|
301
314
|
};
|
|
302
315
|
submissions: Array<FormStoreRecord>;
|
|
303
316
|
};
|
|
317
|
+
export type FormElementLookupSearchResult = {
|
|
318
|
+
formElementLookups: FormTypes.FormElementLookup[];
|
|
319
|
+
} & MiscTypes.BaseSearchResult;
|
|
320
|
+
export type FormElementListSearchResult = {
|
|
321
|
+
formElementLists: FormTypes.FormElementOptionSet[];
|
|
322
|
+
} & MiscTypes.BaseSearchResult;
|
|
323
|
+
export type FormElementListSearchOptions = BaseSearchOptions & {
|
|
324
|
+
organisationId: string;
|
|
325
|
+
};
|