@coveo/push-api-client 1.5.6 → 1.6.1
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/definitions/errors/baseError.d.ts +4 -0
- package/dist/definitions/errors/fieldErrors.d.ts +11 -0
- package/dist/definitions/{validation → errors}/validatorErrors.d.ts +1 -4
- package/dist/definitions/fieldAnalyser/fieldAnalyser.d.ts +44 -0
- package/dist/definitions/fieldAnalyser/fieldAnalyser.spec.d.ts +1 -0
- package/dist/definitions/fieldAnalyser/fieldStore.d.ts +5 -0
- package/dist/definitions/fieldAnalyser/inconsistencies.d.ts +5 -0
- package/dist/definitions/fieldAnalyser/inconsistencies.spec.d.ts +1 -0
- package/dist/definitions/fieldAnalyser/utils.d.ts +3 -0
- package/dist/definitions/fieldAnalyser/utils.spec.d.ts +1 -0
- package/dist/definitions/index.d.ts +1 -0
- package/dist/definitions/source.d.ts +13 -5
- package/dist/docs/assets/main.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/AnySecurityIdentityBuilder.html +2 -2
- package/dist/docs/classes/DocumentBuilder.html +16 -16
- package/dist/docs/classes/FieldAnalyser.html +9 -0
- package/dist/docs/classes/GroupSecurityIdentityBuilder.html +2 -2
- package/dist/docs/classes/Source.html +17 -16
- package/dist/docs/classes/UserSecurityIdentityBuilder.html +2 -2
- package/dist/docs/classes/VirtualGroupSecurityIdentityBuilder.html +2 -2
- package/dist/docs/enums/PlatformEnvironment.html +1 -1
- package/dist/docs/index.html +1 -1
- package/dist/docs/interfaces/BatchUpdateDocuments.html +1 -1
- package/dist/docs/interfaces/BatchUpdateDocumentsFromFiles.html +4 -2
- package/dist/docs/interfaces/Document.html +13 -13
- package/dist/docs/interfaces/SecurityIdentity.html +3 -3
- package/dist/docs/interfaces/SecurityIdentityBuilder.html +1 -1
- package/dist/docs/interfaces/UploadBatchCallbackData.html +1 -1
- package/dist/docs/modules.html +2 -2
- package/dist/documentBuilder.js +1 -1
- package/dist/documentBuilder.js.map +1 -1
- package/dist/errors/baseError.js +11 -0
- package/dist/errors/baseError.js.map +1 -0
- package/dist/errors/fieldErrors.js +38 -0
- package/dist/errors/fieldErrors.js.map +1 -0
- package/dist/{validation → errors}/validatorErrors.js +6 -12
- package/dist/errors/validatorErrors.js.map +1 -0
- package/dist/fieldAnalyser/fieldAnalyser.js +133 -0
- package/dist/fieldAnalyser/fieldAnalyser.js.map +1 -0
- package/dist/fieldAnalyser/fieldAnalyser.spec.js +203 -0
- package/dist/fieldAnalyser/fieldAnalyser.spec.js.map +1 -0
- package/dist/fieldAnalyser/fieldStore.js +22 -0
- package/dist/fieldAnalyser/fieldStore.js.map +1 -0
- package/dist/fieldAnalyser/inconsistencies.js +15 -0
- package/dist/fieldAnalyser/inconsistencies.js.map +1 -0
- package/dist/fieldAnalyser/inconsistencies.spec.js +41 -0
- package/dist/fieldAnalyser/inconsistencies.spec.js.map +1 -0
- package/dist/fieldAnalyser/utils.js +23 -0
- package/dist/fieldAnalyser/utils.js.map +1 -0
- package/dist/fieldAnalyser/utils.spec.js +82 -0
- package/dist/fieldAnalyser/utils.spec.js.map +1 -0
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/source.js +47 -5
- package/dist/source.js.map +1 -1
- package/dist/source.spec.js +145 -49
- package/dist/source.spec.js.map +1 -1
- package/dist/validation/parseFile.js +1 -1
- package/dist/validation/parseFile.js.map +1 -1
- package/dist/validation/parseFile.spec.js +1 -1
- package/dist/validation/parseFile.spec.js.map +1 -1
- package/package.json +8 -8
- package/dist/validation/validatorErrors.js.map +0 -1
@@ -0,0 +1,203 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
jest.mock('@coveord/platform-client');
|
4
|
+
const platform_client_1 = require("@coveord/platform-client");
|
5
|
+
const __1 = require("..");
|
6
|
+
const fieldErrors_1 = require("../errors/fieldErrors");
|
7
|
+
const fieldAnalyser_1 = require("./fieldAnalyser");
|
8
|
+
const buildDocument = (metadata) => {
|
9
|
+
const doc = new __1.DocumentBuilder('https://my.document.uri', 'some title');
|
10
|
+
if (metadata) {
|
11
|
+
doc.withMetadata(metadata);
|
12
|
+
}
|
13
|
+
return doc;
|
14
|
+
};
|
15
|
+
const docWithNewFields = buildDocument({
|
16
|
+
promo_price: 23.13,
|
17
|
+
description: 'Plumbus can generate and store vast amounts of heat, allowing it to be used for cooking, ironing or just heating the room.',
|
18
|
+
additional_info: 'Plumbus can secrete various agents from itself and has adaptive rubbing surfaces, making it useful for cleaning.',
|
19
|
+
price: 'six-and-a-half Brapples',
|
20
|
+
category: 'Various',
|
21
|
+
available: true,
|
22
|
+
});
|
23
|
+
const docWithExistingFields = buildDocument({
|
24
|
+
type: 'Teleportation Device',
|
25
|
+
category: 'Electronics',
|
26
|
+
})
|
27
|
+
.withAuthor('Rick')
|
28
|
+
.withFileExtension('.pewpew');
|
29
|
+
const dummyPlatformClient = () => {
|
30
|
+
return new platform_client_1.default({ accessToken: 'xxx' });
|
31
|
+
};
|
32
|
+
describe('FieldAnalyser', () => {
|
33
|
+
let analyser;
|
34
|
+
const mockedPlatformClient = jest.mocked(platform_client_1.default);
|
35
|
+
const mockedListFields = jest.fn();
|
36
|
+
const mockListFieldsWithValidPermanentId = () => {
|
37
|
+
mockedListFields
|
38
|
+
.mockResolvedValueOnce({
|
39
|
+
items: [
|
40
|
+
{ name: 'brand', type: platform_client_1.FieldTypes.STRING },
|
41
|
+
{ name: 'category', type: platform_client_1.FieldTypes.STRING },
|
42
|
+
{ name: 'permanentid', type: platform_client_1.FieldTypes.STRING },
|
43
|
+
],
|
44
|
+
totalPages: 2,
|
45
|
+
})
|
46
|
+
.mockResolvedValueOnce({
|
47
|
+
items: [{ name: 'type' }],
|
48
|
+
totalPages: 2,
|
49
|
+
});
|
50
|
+
};
|
51
|
+
const mockListFieldsWithInvalidPermanentId = () => {
|
52
|
+
mockedListFields.mockResolvedValueOnce({
|
53
|
+
items: [{ name: 'permanentid', type: platform_client_1.FieldTypes.DATE }],
|
54
|
+
totalPages: 1,
|
55
|
+
});
|
56
|
+
};
|
57
|
+
const mockListFieldsWithNoPermanentId = () => {
|
58
|
+
mockedListFields.mockResolvedValueOnce({
|
59
|
+
items: [],
|
60
|
+
totalPages: 1,
|
61
|
+
});
|
62
|
+
};
|
63
|
+
const doMockPlatformClient = () => {
|
64
|
+
mockedPlatformClient.mockImplementation(() => ({
|
65
|
+
field: { list: mockedListFields },
|
66
|
+
}));
|
67
|
+
};
|
68
|
+
beforeAll(() => {
|
69
|
+
doMockPlatformClient();
|
70
|
+
});
|
71
|
+
beforeEach(() => {
|
72
|
+
mockedListFields.mockReset();
|
73
|
+
analyser = new fieldAnalyser_1.FieldAnalyser(dummyPlatformClient());
|
74
|
+
});
|
75
|
+
describe('when fields from the batch already exist in the org', () => {
|
76
|
+
let report;
|
77
|
+
beforeEach(async () => {
|
78
|
+
mockListFieldsWithValidPermanentId();
|
79
|
+
report = (await analyser.add([docWithExistingFields])).report();
|
80
|
+
});
|
81
|
+
afterEach(() => { });
|
82
|
+
it('should not return fields to create', async () => {
|
83
|
+
expect(report.fields).toStrictEqual([]);
|
84
|
+
});
|
85
|
+
it('should not detect inconsistencies', async () => {
|
86
|
+
expect(report.inconsistencies.size).toStrictEqual(0);
|
87
|
+
});
|
88
|
+
});
|
89
|
+
describe('when batch contain new fields', () => {
|
90
|
+
beforeEach(() => {
|
91
|
+
mockListFieldsWithValidPermanentId();
|
92
|
+
});
|
93
|
+
it('should return fields to create', async () => {
|
94
|
+
const docBuilders = [docWithNewFields, docWithExistingFields];
|
95
|
+
const { fields } = (await analyser.add(docBuilders)).report();
|
96
|
+
expect(fields).toStrictEqual([
|
97
|
+
{
|
98
|
+
name: 'promo_price',
|
99
|
+
type: 'DOUBLE',
|
100
|
+
},
|
101
|
+
{
|
102
|
+
name: 'description',
|
103
|
+
type: 'STRING',
|
104
|
+
},
|
105
|
+
{
|
106
|
+
name: 'additional_info',
|
107
|
+
type: 'STRING',
|
108
|
+
},
|
109
|
+
{
|
110
|
+
name: 'price',
|
111
|
+
type: 'STRING',
|
112
|
+
},
|
113
|
+
{
|
114
|
+
name: 'available',
|
115
|
+
type: 'STRING',
|
116
|
+
},
|
117
|
+
]);
|
118
|
+
});
|
119
|
+
});
|
120
|
+
describe('when the batch contains inconsistent metadata', () => {
|
121
|
+
let report;
|
122
|
+
const docBuilders = [
|
123
|
+
docWithNewFields,
|
124
|
+
docWithExistingFields,
|
125
|
+
buildDocument({ price: 6.5, available: 0 }),
|
126
|
+
buildDocument({ available: 1 }),
|
127
|
+
];
|
128
|
+
beforeEach(async () => {
|
129
|
+
mockListFieldsWithValidPermanentId();
|
130
|
+
report = (await analyser.add(docBuilders)).report();
|
131
|
+
});
|
132
|
+
it('should detect 2 inconsistencies', () => {
|
133
|
+
expect(report.inconsistencies.size).toBe(2);
|
134
|
+
});
|
135
|
+
it('should detect type inconsistencies', () => {
|
136
|
+
const inconsistenciesSet = report.inconsistencies;
|
137
|
+
expect(inconsistenciesSet.get('price')).toStrictEqual(new Set(['DOUBLE', 'STRING']));
|
138
|
+
expect(inconsistenciesSet.get('available')).toStrictEqual(new Set(['DOUBLE', 'STRING']));
|
139
|
+
});
|
140
|
+
it('should still provide fields to create', () => {
|
141
|
+
expect(report.fields).toStrictEqual([
|
142
|
+
{
|
143
|
+
name: 'promo_price',
|
144
|
+
type: 'DOUBLE',
|
145
|
+
},
|
146
|
+
{
|
147
|
+
name: 'description',
|
148
|
+
type: 'STRING',
|
149
|
+
},
|
150
|
+
{
|
151
|
+
name: 'additional_info',
|
152
|
+
type: 'STRING',
|
153
|
+
},
|
154
|
+
{
|
155
|
+
name: 'price',
|
156
|
+
type: 'STRING',
|
157
|
+
},
|
158
|
+
{
|
159
|
+
name: 'available',
|
160
|
+
type: 'DOUBLE',
|
161
|
+
},
|
162
|
+
]);
|
163
|
+
});
|
164
|
+
it('should associate to a field a type based on the type precedence list', () => {
|
165
|
+
// In this scenario, there were equal amount of occurences of numeric string values for the same metadata
|
166
|
+
expect(report.fields).toContainEqual({
|
167
|
+
name: 'price',
|
168
|
+
type: 'STRING',
|
169
|
+
});
|
170
|
+
});
|
171
|
+
it('should associate to a field a type with the most occurences', () => {
|
172
|
+
// In this scenario, there were 2 occurences of numeric value and 1 occurence of string value for the same metadata
|
173
|
+
expect(report.fields).toContainEqual({
|
174
|
+
name: 'available',
|
175
|
+
type: 'DOUBLE',
|
176
|
+
});
|
177
|
+
});
|
178
|
+
});
|
179
|
+
describe('when permanentId is not correctly configured', () => {
|
180
|
+
beforeEach(() => {
|
181
|
+
mockListFieldsWithInvalidPermanentId();
|
182
|
+
});
|
183
|
+
it('should throw an error', async () => {
|
184
|
+
await analyser.add([docWithExistingFields]);
|
185
|
+
expect(() => analyser.report()).toThrow(fieldErrors_1.InvalidPermanentId);
|
186
|
+
});
|
187
|
+
});
|
188
|
+
describe('when permanentId is missing from the organization', () => {
|
189
|
+
beforeEach(() => {
|
190
|
+
mockListFieldsWithNoPermanentId();
|
191
|
+
});
|
192
|
+
it('should include permanentid field in the analysis report', async () => {
|
193
|
+
await analyser.add([docWithExistingFields]);
|
194
|
+
const report = analyser.report();
|
195
|
+
expect(report.fields).toContainEqual({
|
196
|
+
name: 'permanentid',
|
197
|
+
type: 'STRING',
|
198
|
+
});
|
199
|
+
});
|
200
|
+
});
|
201
|
+
it.todo('should create the missing fields');
|
202
|
+
});
|
203
|
+
//# sourceMappingURL=fieldAnalyser.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldAnalyser.spec.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldAnalyser.spec.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAEtC,8DAAoE;AACpE,0BAA6C;AAC7C,uDAAyD;AACzD,mDAAmE;AAEnE,MAAM,aAAa,GAAG,CAAC,QAAmB,EAAE,EAAE;IAC5C,MAAM,GA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,EAAE;YACvE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;YAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC;gBACnC,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FieldStore = void 0;
|
4
|
+
class FieldStore extends Map {
|
5
|
+
concat(fieldBuilder) {
|
6
|
+
fieldBuilder.forEach((type, name) => {
|
7
|
+
this.set(name, type);
|
8
|
+
});
|
9
|
+
}
|
10
|
+
marshal() {
|
11
|
+
const fieldModels = [];
|
12
|
+
this.forEach((fieldType, fieldName) => {
|
13
|
+
fieldModels.push({
|
14
|
+
name: fieldName,
|
15
|
+
type: fieldType,
|
16
|
+
});
|
17
|
+
});
|
18
|
+
return fieldModels;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
exports.FieldStore = FieldStore;
|
22
|
+
//# sourceMappingURL=fieldStore.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldStore.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldStore.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAW,SAAQ,GAAuB;IAC9C,MAAM,CAAC,YAAwB;QACpC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAClC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,OAAO;QACZ,MAAM,WAAW,GAAiB,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;YACpC,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAlBD,gCAkBC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Inconsistencies = void 0;
|
4
|
+
class Inconsistencies extends Map {
|
5
|
+
constructor() {
|
6
|
+
super();
|
7
|
+
}
|
8
|
+
add(fieldName, types) {
|
9
|
+
const fieldTypeSet = this.get(fieldName) || [];
|
10
|
+
this.set(fieldName, new Set([...fieldTypeSet, ...types]));
|
11
|
+
return this;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
exports.Inconsistencies = Inconsistencies;
|
15
|
+
//# sourceMappingURL=inconsistencies.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"inconsistencies.js","sourceRoot":"","sources":["../../src/fieldAnalyser/inconsistencies.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAgB,SAAQ,GAAG;IACtC;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAEM,GAAG,CAAC,SAAiB,EAAE,KAAmB;QAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAa,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,0CAUC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const platform_client_1 = require("@coveord/platform-client");
|
4
|
+
const inconsistencies_1 = require("./inconsistencies");
|
5
|
+
describe('Inconsistencies', () => {
|
6
|
+
const insconsitencies = new inconsistencies_1.Inconsistencies();
|
7
|
+
beforeAll(() => {
|
8
|
+
insconsitencies
|
9
|
+
.add('foo', [platform_client_1.FieldTypes.STRING, platform_client_1.FieldTypes.VECTOR])
|
10
|
+
.add('foo', [platform_client_1.FieldTypes.STRING, platform_client_1.FieldTypes.LONG_64])
|
11
|
+
.add('bar', [platform_client_1.FieldTypes.LONG, platform_client_1.FieldTypes.STRING]);
|
12
|
+
});
|
13
|
+
it('should return the inconsistencies count', () => {
|
14
|
+
expect(insconsitencies.size).toEqual(2);
|
15
|
+
});
|
16
|
+
it('should retrieve a specific inconsistency', () => {
|
17
|
+
const set = new Set([
|
18
|
+
platform_client_1.FieldTypes.STRING,
|
19
|
+
platform_client_1.FieldTypes.VECTOR,
|
20
|
+
platform_client_1.FieldTypes.LONG_64,
|
21
|
+
]);
|
22
|
+
expect(insconsitencies.get('foo')).toEqual(set);
|
23
|
+
});
|
24
|
+
it('should return undefined when retrieving invalid inconsistencies key', () => {
|
25
|
+
expect(insconsitencies.get('invalid')).toBeUndefined();
|
26
|
+
});
|
27
|
+
it('should loop through inconsistencies', () => {
|
28
|
+
const types = [];
|
29
|
+
const fields = [];
|
30
|
+
insconsitencies.forEach((typeSet, field) => {
|
31
|
+
types.push(typeSet);
|
32
|
+
fields.push(field);
|
33
|
+
});
|
34
|
+
expect(types).toStrictEqual([
|
35
|
+
new Set([platform_client_1.FieldTypes.STRING, platform_client_1.FieldTypes.VECTOR, platform_client_1.FieldTypes.LONG_64]),
|
36
|
+
new Set([platform_client_1.FieldTypes.STRING, platform_client_1.FieldTypes.LONG]),
|
37
|
+
]);
|
38
|
+
expect(fields).toStrictEqual(['foo', 'bar']);
|
39
|
+
});
|
40
|
+
});
|
41
|
+
//# sourceMappingURL=inconsistencies.spec.js.map
|
@@ -0,0 +1 @@
|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AM,KAAK,GAAsB,EAAE,CAAC;QACpC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;YAC1B,IAAI,GAAG,CAAC,CAAC,4BAAU,CAAC,MAAM,EAAE,4BAAU,CAAC,MAAM,EAAE,4BAAU,CAAC,OAAO,CAAC,CAAC;YACnE,IAAI,GAAG,CAAC,CAAC,4BAAU,CAAC,MAAM,EAAE,4BAAU,CAAC,IAAI,CAAC,CAAC;SAC9C,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createFields = exports.listAllFieldsFromOrg = void 0;
|
4
|
+
const listAllFieldsFromOrg = async (client, page = 0, fields = []) => {
|
5
|
+
const list = await client.field.list({
|
6
|
+
page,
|
7
|
+
perPage: 1000,
|
8
|
+
});
|
9
|
+
fields.push(...list.items);
|
10
|
+
if (page < list.totalPages - 1) {
|
11
|
+
return (0, exports.listAllFieldsFromOrg)(client, page + 1, fields);
|
12
|
+
}
|
13
|
+
return fields;
|
14
|
+
};
|
15
|
+
exports.listAllFieldsFromOrg = listAllFieldsFromOrg;
|
16
|
+
const createFields = async (client, fields, fieldBatch = 500) => {
|
17
|
+
for (let i = 0; i < fields.length; i += fieldBatch) {
|
18
|
+
const batch = fields.slice(i, fieldBatch + i);
|
19
|
+
await client.field.createFields(batch);
|
20
|
+
}
|
21
|
+
};
|
22
|
+
exports.createFields = createFields;
|
23
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/fieldAnalyser/utils.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAsB,EACtB,IAAI,GAAG,CAAC,EACR,SAAuB,EAAE,EACF,EAAE;IACzB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,IAAI;QACJ,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE;QAC9B,OAAO,IAAA,4BAAoB,EAAC,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjBW,QAAA,oBAAoB,wBAiB/B;AAEK,MAAM,YAAY,GAAG,KAAK,EAC/B,MAAsB,EACtB,MAAoB,EACpB,UAAU,GAAG,GAAG,EAChB,EAAE;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,UAAU,EAAE;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAC9C,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;KACxC;AACH,CAAC,CAAC;AATW,QAAA,YAAY,gBASvB"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
jest.mock('@coveord/platform-client');
|
4
|
+
const platform_client_1 = require("@coveord/platform-client");
|
5
|
+
const utils_1 = require("./utils");
|
6
|
+
const mockedPlatformClient = jest.mocked(platform_client_1.default);
|
7
|
+
const mockedCreateField = jest.fn();
|
8
|
+
const mockedListFields = jest.fn();
|
9
|
+
const dummyPlatformClient = () => {
|
10
|
+
return new platform_client_1.default({ accessToken: 'xxx' });
|
11
|
+
};
|
12
|
+
const doMockPlatformClient = () => {
|
13
|
+
mockedPlatformClient.mockImplementation(() => ({
|
14
|
+
field: {
|
15
|
+
createFields: mockedCreateField,
|
16
|
+
list: mockedListFields,
|
17
|
+
},
|
18
|
+
}));
|
19
|
+
};
|
20
|
+
describe('fieldUtils', () => {
|
21
|
+
let client;
|
22
|
+
beforeAll(() => {
|
23
|
+
doMockPlatformClient();
|
24
|
+
});
|
25
|
+
beforeEach(async () => {
|
26
|
+
client = dummyPlatformClient();
|
27
|
+
});
|
28
|
+
describe('when listing fields', () => {
|
29
|
+
beforeEach(async () => {
|
30
|
+
mockedListFields
|
31
|
+
.mockReturnValueOnce({
|
32
|
+
items: [{ name: 'brand' }, { name: 'category' }],
|
33
|
+
totalPages: 2,
|
34
|
+
})
|
35
|
+
.mockReturnValueOnce({
|
36
|
+
items: [{ name: 'type' }],
|
37
|
+
totalPages: 2,
|
38
|
+
});
|
39
|
+
await (0, utils_1.listAllFieldsFromOrg)(client);
|
40
|
+
});
|
41
|
+
it('should list all fields from org', async () => {
|
42
|
+
expect(mockedListFields).toHaveBeenCalledTimes(2);
|
43
|
+
});
|
44
|
+
});
|
45
|
+
describe('when creating fields', () => {
|
46
|
+
const fields = [
|
47
|
+
{ name: 'field1' },
|
48
|
+
{ name: 'field2' },
|
49
|
+
{ name: 'field3' },
|
50
|
+
{ name: 'field4' },
|
51
|
+
{ name: 'field5' },
|
52
|
+
{ name: 'field6' },
|
53
|
+
];
|
54
|
+
it.each([
|
55
|
+
{
|
56
|
+
batchLimit: 4,
|
57
|
+
batches: [
|
58
|
+
['field1', 'field2', 'field3', 'field4'],
|
59
|
+
['field5', 'field6'],
|
60
|
+
],
|
61
|
+
},
|
62
|
+
{
|
63
|
+
batchLimit: 6,
|
64
|
+
batches: [['field1', 'field2', 'field3', 'field4', 'field5', 'field6']],
|
65
|
+
},
|
66
|
+
{
|
67
|
+
batchLimit: 999,
|
68
|
+
batches: [['field1', 'field2', 'field3', 'field4', 'field5', 'field6']],
|
69
|
+
},
|
70
|
+
])('should split fields into smaller batches', async ({ batchLimit, batches }) => {
|
71
|
+
await (0, utils_1.createFields)(client, fields, batchLimit);
|
72
|
+
expect(mockedCreateField).toHaveBeenCalledTimes(batches.length);
|
73
|
+
batches.forEach((batch, index) => {
|
74
|
+
const field = batch.map((f) => ({
|
75
|
+
name: f,
|
76
|
+
}));
|
77
|
+
expect(mockedCreateField).toHaveBeenNthCalledWith(index + 1, field);
|
78
|
+
});
|
79
|
+
});
|
80
|
+
});
|
81
|
+
});
|
82
|
+
//# sourceMappingURL=utils.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../src/fieldAnalyser/utils.spec.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAEtC,8DAAoE;AACpE,mCAA2D;AAE3D,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAc,CAAC,CAAC;AACzD,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACpC,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEnC,MAAM,mBAAmB,GAAG,GAAmB,EAAE;IAC/C,OAAO,IAAI,yBAAc,CAAC,EAAC,WAAW,EAAE,KAAK,EAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,oBAAoB,CAAC,kBAAkB,CACrC,GAAG,EAAE,CACH,CAAC;QACC,KAAK,EAAE;YACL,YAAY,EAAE,iBAAiB;YAC/B,IAAI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{ value: true });
|
3
|
-
exports.Region = exports.PlatformEnvironment = exports.DocumentBuilder = exports.SourceVisibility = exports.Source = void 0;
|
3
|
+
exports.Region = exports.PlatformEnvironment = exports.DocumentBuilder = exports.FieldAnalyser = exports.SourceVisibility = exports.Source = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
-
|
5
|
+
tslib_1.__exportStar(require("./document"), exports);
|
6
6
|
var source_1 = require("./source");
|
7
7
|
Object.defineProperty(exports, "Source", { enumerable: true, get: function () { return source_1.Source; } });
|
8
8
|
Object.defineProperty(exports, "SourceVisibility", { enumerable: true, get: function () { return source_1.SourceVisibility; } });
|
9
|
+
var fieldAnalyser_1 = require("./fieldAnalyser/fieldAnalyser");
|
10
|
+
Object.defineProperty(exports, "FieldAnalyser", { enumerable: true, get: function () { return fieldAnalyser_1.FieldAnalyser; } });
|
9
11
|
var documentBuilder_1 = require("./documentBuilder");
|
10
12
|
Object.defineProperty(exports, "DocumentBuilder", { enumerable: true, get: function () { return documentBuilder_1.DocumentBuilder; } });
|
11
|
-
|
13
|
+
tslib_1.__exportStar(require("./securityIdentityBuilder"), exports);
|
12
14
|
var environment_1 = require("./environment");
|
13
15
|
Object.defineProperty(exports, "PlatformEnvironment", { enumerable: true, get: function () { return environment_1.PlatformEnvironment; } });
|
14
16
|
Object.defineProperty(exports, "Region", { enumerable: true, get: function () { return environment_1.Region; } });
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA2B;AAC3B,mCAOkB;AANhB,gGAAA,MAAM,OAAA;AACN,0GAAA,gBAAgB,OAAA;AAMlB,+DAA4D;AAApD,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,oEAA0C;AAC1C,6CAA0D;AAAlD,kHAAA,mBAAmB,OAAA;AAAE,qGAAA,MAAM,OAAA"}
|
package/dist/source.js
CHANGED
@@ -14,6 +14,9 @@ const parseFile_1 = require("./validation/parseFile");
|
|
14
14
|
const path_1 = require("path");
|
15
15
|
const file_1 = require("./help/file");
|
16
16
|
const environment_1 = require("./environment");
|
17
|
+
const fieldAnalyser_1 = require("./fieldAnalyser/fieldAnalyser");
|
18
|
+
const fieldErrors_1 = require("./errors/fieldErrors");
|
19
|
+
const utils_1 = require("./fieldAnalyser/utils");
|
17
20
|
/**
|
18
21
|
* Manage a push source.
|
19
22
|
*
|
@@ -96,9 +99,15 @@ class Source {
|
|
96
99
|
* Adds or updates an individual item in a push source. See [Adding a Single Item in a Push Source](https://docs.coveo.com/en/133).
|
97
100
|
* @param sourceID
|
98
101
|
* @param docBuilder
|
102
|
+
* @param {BatchUpdateDocumentsOptions} [{createFields = true}={}]
|
99
103
|
* @returns
|
100
104
|
*/
|
101
|
-
addOrUpdateDocument(sourceID, docBuilder) {
|
105
|
+
async addOrUpdateDocument(sourceID, docBuilder, { createFields: createFields = true } = {}) {
|
106
|
+
if (createFields) {
|
107
|
+
const analyser = new fieldAnalyser_1.FieldAnalyser(this.platformClient);
|
108
|
+
await analyser.add([docBuilder]);
|
109
|
+
await this.createFields(analyser);
|
110
|
+
}
|
102
111
|
const doc = docBuilder.build();
|
103
112
|
const addURL = new url_1.URL(this.getBaseAPIURLForDocuments(sourceID));
|
104
113
|
addURL.searchParams.append('documentId', doc.uri);
|
@@ -110,7 +119,12 @@ class Source {
|
|
110
119
|
* @param batch
|
111
120
|
* @returns
|
112
121
|
*/
|
113
|
-
async batchUpdateDocuments(sourceID, batch) {
|
122
|
+
async batchUpdateDocuments(sourceID, batch, { createFields: createFields = true } = {}) {
|
123
|
+
if (createFields) {
|
124
|
+
const analyser = new fieldAnalyser_1.FieldAnalyser(this.platformClient);
|
125
|
+
await analyser.add(batch.addOrUpdate);
|
126
|
+
await this.createFields(analyser);
|
127
|
+
}
|
114
128
|
const fileContainer = await this.createFileContainer();
|
115
129
|
await this.uploadContentToFileContainer(fileContainer, batch);
|
116
130
|
return this.pushFileContainerContent(sourceID, fileContainer);
|
@@ -121,12 +135,33 @@ class Source {
|
|
121
135
|
* @param {string} sourceID The unique identifier of the target Push source
|
122
136
|
* @param {string[]} filesOrDirectories A list of JSON files or directories (containing JSON files) from which to extract documents.
|
123
137
|
* @param {UploadBatchCallback} callback Callback executed when a batch of documents is either successfully uploaded or when an error occurs during the upload
|
124
|
-
* @param {BatchUpdateDocumentsFromFiles}
|
138
|
+
* @param {BatchUpdateDocumentsFromFiles} options
|
125
139
|
*/
|
126
|
-
async batchUpdateDocumentsFromFiles(sourceID, filesOrDirectories, callback,
|
140
|
+
async batchUpdateDocumentsFromFiles(sourceID, filesOrDirectories, callback, options) {
|
141
|
+
const defaultOptions = {
|
142
|
+
maxConcurrent: 10,
|
143
|
+
createFields: true,
|
144
|
+
};
|
145
|
+
const { maxConcurrent, createFields: createFields } = Object.assign(Object.assign({}, defaultOptions), options);
|
127
146
|
const files = (0, file_1.getAllJsonFilesFromEntries)(filesOrDirectories);
|
147
|
+
if (createFields) {
|
148
|
+
const analyser = new fieldAnalyser_1.FieldAnalyser(this.platformClient);
|
149
|
+
for (const filePath of files.values()) {
|
150
|
+
const docBuilders = (0, parseFile_1.parseAndGetDocumentBuilderFromJSONDocument)(filePath);
|
151
|
+
await analyser.add(docBuilders);
|
152
|
+
}
|
153
|
+
await this.createFields(analyser);
|
154
|
+
}
|
128
155
|
const fileNames = files.map((path) => (0, path_1.basename)(path));
|
129
156
|
const { chunksToUpload, close } = this.splitByChunkAndUpload(sourceID, fileNames, callback);
|
157
|
+
if (createFields) {
|
158
|
+
const analyser = new fieldAnalyser_1.FieldAnalyser(this.platformClient);
|
159
|
+
for (const filePath of files.values()) {
|
160
|
+
const docBuilders = (0, parseFile_1.parseAndGetDocumentBuilderFromJSONDocument)(filePath);
|
161
|
+
await analyser.add(docBuilders);
|
162
|
+
}
|
163
|
+
await this.createFields(analyser);
|
164
|
+
}
|
130
165
|
// parallelize uploads within the same file
|
131
166
|
const docBuilderGenerator = function* (docBuilders) {
|
132
167
|
for (const upload of chunksToUpload(docBuilders)) {
|
@@ -190,6 +225,13 @@ class Source {
|
|
190
225
|
headers: this.documentsRequestHeaders,
|
191
226
|
};
|
192
227
|
}
|
228
|
+
async createFields(analyser) {
|
229
|
+
const { fields, inconsistencies } = analyser.report();
|
230
|
+
if (inconsistencies.size > 0) {
|
231
|
+
throw new fieldErrors_1.FieldTypeInconsistencyError(inconsistencies);
|
232
|
+
}
|
233
|
+
await (0, utils_1.createFields)(this.platformClient, fields);
|
234
|
+
}
|
193
235
|
getFileContainerAxiosConfig(fileContainer) {
|
194
236
|
return {
|
195
237
|
headers: fileContainer.requiredHeaders,
|
@@ -250,7 +292,7 @@ class Source {
|
|
250
292
|
const res = await this.batchUpdateDocuments(sourceID, {
|
251
293
|
addOrUpdate: batch,
|
252
294
|
delete: [],
|
253
|
-
});
|
295
|
+
}, { createFields: false });
|
254
296
|
callback(null, {
|
255
297
|
files: fileNames,
|
256
298
|
batch,
|
package/dist/source.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":";;;AAAA,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEpC,8DASkC;AAClC,4DAA0D;AAAlD,mHAAA,gBAAgB,OAAA;AACxB,iCAA+D;AAE/D,+BAAgC;AAChC,6BAAwB;AACxB,gDAAkD;AAClD,sDAAkF;AAClF,+BAA8B;AAC9B,sCAAuD;AACvD,+CAMuB;
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":";;;AAAA,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEpC,8DASkC;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