@allthings/sdk 7.1.0 → 7.2.0-dev.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/dist/cli.js +1107 -27
- package/dist/lib.cjs.js +1107 -27
- package/dist/lib.esm.js +1107 -27
- package/dist/lib.umd.min.js +1 -1
- package/dist/src/rest/methods/idLookup.d.ts +2 -0
- package/dist/test/constants.js +16 -0
- package/dist/test/helpers.js +56 -0
- package/package.json +46 -37
|
@@ -3,12 +3,14 @@ export type LookupIdResult = Promise<{
|
|
|
3
3
|
readonly [externalId: string]: string | null;
|
|
4
4
|
}>;
|
|
5
5
|
export type MethodLookupIds = (appId: string, data: {
|
|
6
|
+
readonly dataSource?: string;
|
|
6
7
|
readonly externalIds: string | readonly string[];
|
|
7
8
|
readonly parentId?: string;
|
|
8
9
|
readonly resource: EnumResource;
|
|
9
10
|
readonly userType?: EnumLookupUserType;
|
|
10
11
|
}) => LookupIdResult;
|
|
11
12
|
export declare function lookupIds(client: IAllthingsRestClient, appId: string, data: {
|
|
13
|
+
readonly dataSource?: string;
|
|
12
14
|
readonly externalIds: string | readonly string[];
|
|
13
15
|
readonly parentId?: string;
|
|
14
16
|
readonly resource: EnumResource;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EnumCommunicationMethodType, EnumInputChannel, } from '../src/rest/types';
|
|
2
|
+
export const APP_ID = '575027e58178f56a008b4568';
|
|
3
|
+
export const APP_CHANNEL = 'App-575027e58178f56a008b4568';
|
|
4
|
+
export const APP_PROPERTY_MANAGER_ID = '5a818c07ef5f2f00441146a2';
|
|
5
|
+
export const CATEGORY_ID = '5eb9a4ff2a4433163d0e540a';
|
|
6
|
+
export const COMMUNICATION_METHOD = {
|
|
7
|
+
id: '5dd7ca6bfbdbb4af89be9c37',
|
|
8
|
+
type: EnumCommunicationMethodType.email,
|
|
9
|
+
value: 'pr-coreyplatt@allthings.me',
|
|
10
|
+
};
|
|
11
|
+
export const CONVERSATION_ID = '5aa7cd7bd4959e004112e136';
|
|
12
|
+
export const INPUT_CHANNEL = EnumInputChannel.EMAIL;
|
|
13
|
+
export const SERVICE_PROVIDER_ID = '5a818c07ef5f2f00441146a2';
|
|
14
|
+
export const USER_ID = '50f66beaeabc88ab0e000000';
|
|
15
|
+
export const UTILISATION_PERIOD_ID = '5a9d65cd0ecb330045742be3';
|
|
16
|
+
export const BOOKING_ID = '5aa68870d4959e00447d6f87';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
import restClient, { EnumUnitType } from '../src/rest';
|
|
3
|
+
import { EnumLocale, EnumTimezone, } from '../src/rest/types';
|
|
4
|
+
import { APP_ID, APP_PROPERTY_MANAGER_ID } from './constants';
|
|
5
|
+
export const generateId = () => crypto.randomUUID().replaceAll('-', '');
|
|
6
|
+
export async function createUserAndClient() {
|
|
7
|
+
const defaultClient = restClient();
|
|
8
|
+
const email = `${generateId()}@foobar.test`;
|
|
9
|
+
const password = generateId();
|
|
10
|
+
const data = {
|
|
11
|
+
description: 'Foobar User',
|
|
12
|
+
email,
|
|
13
|
+
externalId: generateId(),
|
|
14
|
+
locale: EnumLocale.en_US,
|
|
15
|
+
plainPassword: password,
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
client: restClient({
|
|
19
|
+
password,
|
|
20
|
+
username: email,
|
|
21
|
+
}),
|
|
22
|
+
user: await defaultClient.userCreate(APP_ID, generateId(), data),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export async function createUtilisationPeriod() {
|
|
26
|
+
const defaultClient = restClient();
|
|
27
|
+
const property = await defaultClient.propertyCreate(APP_ID, {
|
|
28
|
+
name: 'CommunityArticleStatsGetByUser Test Property',
|
|
29
|
+
timezone: EnumTimezone.EuropeBerlin,
|
|
30
|
+
});
|
|
31
|
+
const group = await defaultClient.groupCreate(property.id, {
|
|
32
|
+
name: 'CommunityArticleStatsGetByUser Test Group',
|
|
33
|
+
propertyManagerId: APP_PROPERTY_MANAGER_ID,
|
|
34
|
+
});
|
|
35
|
+
const unit = await defaultClient.unitCreate(group.id, {
|
|
36
|
+
name: 'CommunityArticleStatsGetByUser Test Unit',
|
|
37
|
+
type: EnumUnitType.rented,
|
|
38
|
+
});
|
|
39
|
+
return defaultClient.utilisationPeriodCreate(unit.id, {
|
|
40
|
+
endDate: '2050-01-03',
|
|
41
|
+
externalId: generateId(),
|
|
42
|
+
startDate: '2015-01-03',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export async function createUserWithUtilizationPeriod() {
|
|
46
|
+
const defaultClient = restClient();
|
|
47
|
+
const [utilisationPeriod, { client, user }] = await Promise.all([
|
|
48
|
+
await createUtilisationPeriod(),
|
|
49
|
+
await createUserAndClient(),
|
|
50
|
+
]);
|
|
51
|
+
await defaultClient.userCheckInToUtilisationPeriod(user.id, utilisationPeriod.id);
|
|
52
|
+
return {
|
|
53
|
+
client,
|
|
54
|
+
user,
|
|
55
|
+
};
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allthings/sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Allthings GmbH",
|
|
6
6
|
"keywords": [
|
|
@@ -53,36 +53,36 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"bottleneck": "2.19.5",
|
|
56
|
-
"cross-fetch": "4.
|
|
56
|
+
"cross-fetch": "4.1.0",
|
|
57
57
|
"query-string": "7.1.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@allthings/eslint-config": "1.1.0",
|
|
61
|
-
"@commitlint/cli": "19.
|
|
62
|
-
"@commitlint/config-conventional": "19.
|
|
63
|
-
"@rollup/plugin-commonjs": "28.0.
|
|
61
|
+
"@commitlint/cli": "19.8.0",
|
|
62
|
+
"@commitlint/config-conventional": "19.8.0",
|
|
63
|
+
"@rollup/plugin-commonjs": "28.0.3",
|
|
64
64
|
"@rollup/plugin-json": "6.1.0",
|
|
65
|
-
"@rollup/plugin-node-resolve": "
|
|
66
|
-
"@rollup/plugin-replace": "6.0.
|
|
65
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
66
|
+
"@rollup/plugin-replace": "6.0.2",
|
|
67
67
|
"@rollup/plugin-terser": "0.4.4",
|
|
68
68
|
"@types/form-data": "2.5.2",
|
|
69
|
-
"@types/jest": "
|
|
70
|
-
"@types/node": "22.
|
|
69
|
+
"@types/jest": "27.5.2",
|
|
70
|
+
"@types/node": "22.14.0",
|
|
71
71
|
"@types/query-string": "6.3.0",
|
|
72
72
|
"aws-sdk-client-mock": "4.1.0",
|
|
73
73
|
"coveralls": "3.1.1",
|
|
74
74
|
"eslint": "8.57.1",
|
|
75
|
-
"form-data": "4.0.
|
|
75
|
+
"form-data": "4.0.2",
|
|
76
76
|
"husky": "9.1.7",
|
|
77
|
-
"jest": "
|
|
78
|
-
"jest-environment-jsdom": "
|
|
79
|
-
"lint-staged": "15.
|
|
80
|
-
"prettier": "3.
|
|
77
|
+
"jest": "27.5.1",
|
|
78
|
+
"jest-environment-jsdom": "27.5.1",
|
|
79
|
+
"lint-staged": "15.5.0",
|
|
80
|
+
"prettier": "3.5.3",
|
|
81
81
|
"rimraf": "5.0.10",
|
|
82
|
-
"rollup": "4.
|
|
82
|
+
"rollup": "4.39.0",
|
|
83
83
|
"rollup-plugin-hashbang": "2.2.2",
|
|
84
84
|
"semantic-release": "19.0.5",
|
|
85
|
-
"ts-jest": "
|
|
85
|
+
"ts-jest": "27.1.5",
|
|
86
86
|
"typescript": "4.9.5"
|
|
87
87
|
},
|
|
88
88
|
"prettier": {
|
|
@@ -109,6 +109,26 @@
|
|
|
109
109
|
"jest": {
|
|
110
110
|
"bail": false,
|
|
111
111
|
"collectCoverage": true,
|
|
112
|
+
"collectCoverageFrom": [
|
|
113
|
+
"src/**/*.{ts,tsx}",
|
|
114
|
+
"!src/cli.ts",
|
|
115
|
+
"!src/global.d.ts",
|
|
116
|
+
"!src/index.ts",
|
|
117
|
+
"!src/aws/index.ts",
|
|
118
|
+
"!src/oauth/types.ts"
|
|
119
|
+
],
|
|
120
|
+
"coverageThreshold": {
|
|
121
|
+
"global": {
|
|
122
|
+
"branches": 89,
|
|
123
|
+
"functions": 97,
|
|
124
|
+
"lines": 97,
|
|
125
|
+
"statements": 96
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"coveragePathIgnorePatterns": [
|
|
129
|
+
"/node_modules/",
|
|
130
|
+
"/test/"
|
|
131
|
+
],
|
|
112
132
|
"globals": {
|
|
113
133
|
"ts-jest": {
|
|
114
134
|
"diagnostics": {
|
|
@@ -116,35 +136,24 @@
|
|
|
116
136
|
}
|
|
117
137
|
}
|
|
118
138
|
},
|
|
139
|
+
"moduleFileExtensions": [
|
|
140
|
+
"ts",
|
|
141
|
+
"tsx",
|
|
142
|
+
"js",
|
|
143
|
+
"json"
|
|
144
|
+
],
|
|
145
|
+
"preset": "ts-jest",
|
|
119
146
|
"roots": [
|
|
120
147
|
"src/"
|
|
121
148
|
],
|
|
122
149
|
"setupFilesAfterEnv": [
|
|
123
150
|
"./test/setup.ts"
|
|
124
151
|
],
|
|
152
|
+
"testEnvironment": "node",
|
|
153
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
|
|
125
154
|
"transform": {
|
|
126
155
|
"^.+\\.tsx?$": "ts-jest"
|
|
127
|
-
}
|
|
128
|
-
"testEnvironment": "node",
|
|
129
|
-
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
130
|
-
"moduleFileExtensions": [
|
|
131
|
-
"ts",
|
|
132
|
-
"tsx",
|
|
133
|
-
"js",
|
|
134
|
-
"json"
|
|
135
|
-
],
|
|
136
|
-
"coverageThreshold": {
|
|
137
|
-
"global": {
|
|
138
|
-
"branches": 99,
|
|
139
|
-
"functions": 100,
|
|
140
|
-
"lines": 100,
|
|
141
|
-
"statements": 100
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"coveragePathIgnorePatterns": [
|
|
145
|
-
"/node_modules/",
|
|
146
|
-
"/test/"
|
|
147
|
-
]
|
|
156
|
+
}
|
|
148
157
|
},
|
|
149
158
|
"release": {
|
|
150
159
|
"branch": "master",
|