@simtlix/simfinity-js-client 1.1.0 → 3.19.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/README.md +21 -3
- package/package.json +17 -6
- package/src/SimfinityClient.js +231 -393
- package/src/inputs.js +106 -0
- package/src/metadata.js +104 -0
- package/src/selection.js +88 -0
- package/types/index.d.ts +91 -0
- package/.claude/worktrees/flamboyant-cartwright/.claude/settings.local.json +0 -18
- package/.claude/worktrees/flamboyant-cartwright/IMPLEMENTATION_PROMPT.md +0 -1137
- package/.claude/worktrees/flamboyant-cartwright/LICENSE +0 -201
- package/.claude/worktrees/flamboyant-cartwright/README.md +0 -491
- package/.claude/worktrees/flamboyant-cartwright/examples/demo.js +0 -402
- package/.claude/worktrees/flamboyant-cartwright/package-lock.json +0 -107
- package/.claude/worktrees/flamboyant-cartwright/package.json +0 -29
- package/.claude/worktrees/flamboyant-cartwright/src/SimfinityClient.js +0 -1398
- package/IMPLEMENTATION_PROMPT.md +0 -1137
- package/examples/demo.js +0 -402
- package/simtlix-simfinity-js-client-1.0.0.tgz +0 -0
- package/simtlix-simfinity-js-client-1.0.1.tgz +0 -0
- package/simtlix-simfinity-js-client-1.0.3.tgz +0 -0
- package/simtlix-simfinity-js-client-1.0.4.tgz +0 -0
- package/simtlix-simfinity-js-client-1.0.5.tgz +0 -0
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
import SimfinityClient from '../src/SimfinityClient.js';
|
|
2
|
-
|
|
3
|
-
const ENDPOINT = process.env.GRAPHQL_ENDPOINT || 'http://localhost:3000/graphql';
|
|
4
|
-
const client = new SimfinityClient(ENDPOINT);
|
|
5
|
-
|
|
6
|
-
const log = (label, data) => {
|
|
7
|
-
console.log(`\n${'='.repeat(60)}`);
|
|
8
|
-
console.log(label);
|
|
9
|
-
console.log('='.repeat(60));
|
|
10
|
-
console.log(typeof data === 'string' ? data : JSON.stringify(data, null, 2));
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
(async () => {
|
|
14
|
-
// -----------------------------------------------------------------------
|
|
15
|
-
// 1. Initialization
|
|
16
|
-
// -----------------------------------------------------------------------
|
|
17
|
-
await client.init();
|
|
18
|
-
log('1. Schema Discovery', {
|
|
19
|
-
types: Object.keys(client.getTypes()).filter(t => client.getTypes()[t].kind === 'OBJECT'),
|
|
20
|
-
queries: Object.keys(client.getQueries()),
|
|
21
|
-
mutations: Object.keys(client.getMutations()),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// -----------------------------------------------------------------------
|
|
25
|
-
// 2. find() -- auto-selected fields
|
|
26
|
-
// -----------------------------------------------------------------------
|
|
27
|
-
const allSeries = await client.find('serie').exec();
|
|
28
|
-
log('2. find("serie") -- auto-selected scalar fields', allSeries);
|
|
29
|
-
|
|
30
|
-
// -----------------------------------------------------------------------
|
|
31
|
-
// 3. find() -- where scalar filter
|
|
32
|
-
// -----------------------------------------------------------------------
|
|
33
|
-
const dramas = await client.find('serie')
|
|
34
|
-
.where('categories', 'EQ', 'Drama')
|
|
35
|
-
.fields('id name categories')
|
|
36
|
-
.exec();
|
|
37
|
-
log('3. find("serie") -- where categories = Drama', dramas);
|
|
38
|
-
|
|
39
|
-
// -----------------------------------------------------------------------
|
|
40
|
-
// 4. find() -- where + joinObject
|
|
41
|
-
// -----------------------------------------------------------------------
|
|
42
|
-
const withDirector = await client.find('serie')
|
|
43
|
-
.where('name', 'EQ', 'Breaking Bad')
|
|
44
|
-
.joinObject('director', 'name country')
|
|
45
|
-
.fields('id name')
|
|
46
|
-
.exec();
|
|
47
|
-
log('4. find("serie") -- where name = Breaking Bad + joinObject director', withDirector);
|
|
48
|
-
|
|
49
|
-
// -----------------------------------------------------------------------
|
|
50
|
-
// 5. find() -- joinCollection
|
|
51
|
-
// -----------------------------------------------------------------------
|
|
52
|
-
const withSeasons = await client.find('serie')
|
|
53
|
-
.where('name', 'EQ', 'Breaking Bad')
|
|
54
|
-
.joinCollection('seasons', 'number year state')
|
|
55
|
-
.fields('id name')
|
|
56
|
-
.exec();
|
|
57
|
-
log('5. find("serie") -- joinCollection seasons', withSeasons);
|
|
58
|
-
|
|
59
|
-
// -----------------------------------------------------------------------
|
|
60
|
-
// 6. find() -- nested joinCollection (seasons.episodes)
|
|
61
|
-
// -----------------------------------------------------------------------
|
|
62
|
-
const withEpisodes = await client.find('serie')
|
|
63
|
-
.where('name', 'EQ', 'Game of Thrones')
|
|
64
|
-
.joinCollection('seasons', 'number year')
|
|
65
|
-
.joinCollection('seasons.episodes', 'number name')
|
|
66
|
-
.fields('id name')
|
|
67
|
-
.page(1, 1)
|
|
68
|
-
.exec();
|
|
69
|
-
log('6. find("serie") -- nested joinCollection seasons.episodes (page 1, size 1)', withEpisodes);
|
|
70
|
-
|
|
71
|
-
// -----------------------------------------------------------------------
|
|
72
|
-
// 7. find() -- where collection filter (terms)
|
|
73
|
-
// -----------------------------------------------------------------------
|
|
74
|
-
const seriesWithPilot = await client.find('serie')
|
|
75
|
-
.where('seasons', [
|
|
76
|
-
{ path: 'episodes.name', operator: 'EQ', value: 'Pilot' },
|
|
77
|
-
])
|
|
78
|
-
.fields('id name')
|
|
79
|
-
.exec();
|
|
80
|
-
log('7. find("serie") -- where seasons.episodes.name = Pilot', seriesWithPilot);
|
|
81
|
-
|
|
82
|
-
// -----------------------------------------------------------------------
|
|
83
|
-
// 8. find() -- pagination + sort
|
|
84
|
-
// -----------------------------------------------------------------------
|
|
85
|
-
const sortedStars = await client.find('star')
|
|
86
|
-
.sort('name', 'ASC')
|
|
87
|
-
.page(1, 5)
|
|
88
|
-
.fields('id name')
|
|
89
|
-
.exec();
|
|
90
|
-
log('8. find("star") -- sorted ASC, page 1 size 5', sortedStars);
|
|
91
|
-
|
|
92
|
-
// -----------------------------------------------------------------------
|
|
93
|
-
// 9. getById()
|
|
94
|
-
// -----------------------------------------------------------------------
|
|
95
|
-
if (allSeries.length > 0) {
|
|
96
|
-
const serie = await client.getById('serie', allSeries[0].id,
|
|
97
|
-
'id name categories');
|
|
98
|
-
log('9. getById("serie") -- ' + allSeries[0].id, serie);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// -----------------------------------------------------------------------
|
|
102
|
-
// 10. add() + update() + delete() -- full CRUD cycle
|
|
103
|
-
// -----------------------------------------------------------------------
|
|
104
|
-
const demoName = `Demo Actor ${Date.now()}`;
|
|
105
|
-
log('10. CRUD cycle -- add / update / delete star', '--- Starting ---');
|
|
106
|
-
|
|
107
|
-
const newStar = await client.add('star', { name: demoName }, 'id name');
|
|
108
|
-
console.log(' Added:', newStar);
|
|
109
|
-
|
|
110
|
-
const updated = await client.update('star', newStar.id,
|
|
111
|
-
{ name: demoName + ' Updated' }, 'id name');
|
|
112
|
-
console.log(' Updated:', updated);
|
|
113
|
-
|
|
114
|
-
const deleted = await client.delete('star', newStar.id, 'id name');
|
|
115
|
-
console.log(' Deleted:', deleted);
|
|
116
|
-
|
|
117
|
-
// -----------------------------------------------------------------------
|
|
118
|
-
// 11. transition() -- state machine
|
|
119
|
-
// -----------------------------------------------------------------------
|
|
120
|
-
const scheduledSeasons = await client.find('season')
|
|
121
|
-
.where('state', 'EQ', 'SCHEDULED')
|
|
122
|
-
.fields('id number state')
|
|
123
|
-
.page(1, 1)
|
|
124
|
-
.exec();
|
|
125
|
-
|
|
126
|
-
if (scheduledSeasons.length > 0) {
|
|
127
|
-
const seasonId = scheduledSeasons[0].id;
|
|
128
|
-
log('11. State machine -- activate then finalize season ' + seasonId, '');
|
|
129
|
-
|
|
130
|
-
const activated = await client.transition('season', 'activate', seasonId, 'id number state');
|
|
131
|
-
console.log(' Activated:', activated);
|
|
132
|
-
|
|
133
|
-
const finalized = await client.transition('season', 'finalize', seasonId, 'id number state');
|
|
134
|
-
console.log(' Finalized:', finalized);
|
|
135
|
-
} else {
|
|
136
|
-
log('11. State machine -- skipped (no SCHEDULED seasons)', '');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// -----------------------------------------------------------------------
|
|
140
|
-
// 12. execute() -- raw GraphQL
|
|
141
|
-
// -----------------------------------------------------------------------
|
|
142
|
-
const raw = await client.execute('{ stars(pagination: { page: 1, size: 2 }) { id name } }');
|
|
143
|
-
log('12. execute() -- raw GraphQL query', raw.data);
|
|
144
|
-
|
|
145
|
-
// -----------------------------------------------------------------------
|
|
146
|
-
// 13. Full builder example -- all features combined
|
|
147
|
-
// -----------------------------------------------------------------------
|
|
148
|
-
const full = await client.find('serie')
|
|
149
|
-
.where('categories', 'EQ', 'Drama')
|
|
150
|
-
.joinObject('director', 'name country')
|
|
151
|
-
.joinCollection('seasons', 'number year state')
|
|
152
|
-
.joinCollection('seasons.episodes', 'number name')
|
|
153
|
-
.page(1, 2)
|
|
154
|
-
.sort('name', 'ASC')
|
|
155
|
-
.fields('id name categories')
|
|
156
|
-
.exec();
|
|
157
|
-
log('13. Full builder -- filters + joins + pagination + sort', full);
|
|
158
|
-
|
|
159
|
-
// -----------------------------------------------------------------------
|
|
160
|
-
// 14. aggregate() -- count seasons per serie
|
|
161
|
-
// -----------------------------------------------------------------------
|
|
162
|
-
const aggBasic = await client.aggregate('season')
|
|
163
|
-
.groupBy('serie')
|
|
164
|
-
.fact('COUNT', 'seasonCount', 'id')
|
|
165
|
-
.exec();
|
|
166
|
-
log('14. aggregate("season") -- count seasons per serie', aggBasic);
|
|
167
|
-
|
|
168
|
-
// -----------------------------------------------------------------------
|
|
169
|
-
// 15. aggregate() -- multiple facts
|
|
170
|
-
// -----------------------------------------------------------------------
|
|
171
|
-
const aggMulti = await client.aggregate('season')
|
|
172
|
-
.groupBy('serie')
|
|
173
|
-
.fact('COUNT', 'seasonCount', 'id')
|
|
174
|
-
.fact('AVG', 'avgYear', 'year')
|
|
175
|
-
.fact('MIN', 'minYear', 'year')
|
|
176
|
-
.fact('MAX', 'maxYear', 'year')
|
|
177
|
-
.exec();
|
|
178
|
-
log('15. aggregate("season") -- COUNT + AVG + MIN + MAX year', aggMulti);
|
|
179
|
-
|
|
180
|
-
// -----------------------------------------------------------------------
|
|
181
|
-
// 16. aggregate() -- with pagination and sort
|
|
182
|
-
// -----------------------------------------------------------------------
|
|
183
|
-
const aggPaged = await client.aggregate('season')
|
|
184
|
-
.groupBy('serie')
|
|
185
|
-
.fact('COUNT', 'seasonCount', 'id')
|
|
186
|
-
.page(1, 3)
|
|
187
|
-
.sort('serie', 'ASC')
|
|
188
|
-
.exec();
|
|
189
|
-
log('16. aggregate("season") -- with page(1,3) + sort', aggPaged);
|
|
190
|
-
|
|
191
|
-
// -----------------------------------------------------------------------
|
|
192
|
-
// 17. aggregate() -- episodes with filter
|
|
193
|
-
// -----------------------------------------------------------------------
|
|
194
|
-
const aggFiltered = await client.aggregate('episode')
|
|
195
|
-
.groupBy('season')
|
|
196
|
-
.fact('COUNT', 'episodeCount', 'id')
|
|
197
|
-
.page(1, 5)
|
|
198
|
-
.exec();
|
|
199
|
-
log('17. aggregate("episode") -- count episodes per season', aggFiltered);
|
|
200
|
-
|
|
201
|
-
// -----------------------------------------------------------------------
|
|
202
|
-
// 18. Scalar type utilities (Feature 2)
|
|
203
|
-
// -----------------------------------------------------------------------
|
|
204
|
-
log('18. Scalar type utilities', {
|
|
205
|
-
'getActualScalarType("SeasonNumber_Int")': client.getActualScalarType('SeasonNumber_Int'),
|
|
206
|
-
'getActualScalarType("StartDate_Date")': client.getActualScalarType('StartDate_Date'),
|
|
207
|
-
'isNumericScalar("SeasonNumber_Int")': client.isNumericScalar('SeasonNumber_Int'),
|
|
208
|
-
'isNumericScalar("String")': client.isNumericScalar('String'),
|
|
209
|
-
'isBooleanScalar("Boolean")': client.isBooleanScalar('Boolean'),
|
|
210
|
-
'isDateTimeScalar("EpisodeDate_DateTime")': client.isDateTimeScalar('EpisodeDate_DateTime'),
|
|
211
|
-
'isDateTimeScalar("Int")': client.isDateTimeScalar('Int'),
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// -----------------------------------------------------------------------
|
|
215
|
-
// 19. Schema metadata access (Feature 3)
|
|
216
|
-
// -----------------------------------------------------------------------
|
|
217
|
-
const serieType = client.getTypes()['serie'] ? 'serie' : 'Serie';
|
|
218
|
-
const serieFields = client.getFieldsOfType(serieType);
|
|
219
|
-
log('19. Schema metadata -- getFieldsOfType(' + serieType + ')', serieFields.map(f => ({
|
|
220
|
-
name: f.name,
|
|
221
|
-
kind: f.type.kind,
|
|
222
|
-
typeName: f.type.name,
|
|
223
|
-
extensions: f.extensions,
|
|
224
|
-
})));
|
|
225
|
-
|
|
226
|
-
const objectFields = serieFields.filter(f => f.type.kind === 'OBJECT');
|
|
227
|
-
if (objectFields.length > 0) {
|
|
228
|
-
const objField = objectFields[0];
|
|
229
|
-
log('19b. Schema metadata -- extensions for ' + serieType + '.' + objField.name, {
|
|
230
|
-
extensions: client.getFieldExtensions(serieType, objField.name),
|
|
231
|
-
displayField: client.getDisplayField(serieType, objField.name),
|
|
232
|
-
isEmbedded: client.isEmbeddedField(serieType, objField.name),
|
|
233
|
-
connectionField: client.getConnectionField(serieType, objField.name),
|
|
234
|
-
isStateMachine: client.isStateMachineField(serieType, objField.name),
|
|
235
|
-
isReadOnly: client.isReadOnlyField(serieType, objField.name),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// -----------------------------------------------------------------------
|
|
240
|
-
// 20. buildSelectionSet / autoSelect (Feature 4)
|
|
241
|
-
// -----------------------------------------------------------------------
|
|
242
|
-
const selSet = client.buildSelectionSet(serieType);
|
|
243
|
-
log('20. buildSelectionSet(' + serieType + ')', selSet);
|
|
244
|
-
|
|
245
|
-
const autoSelectResult = await client.find(serieType)
|
|
246
|
-
.autoSelect()
|
|
247
|
-
.page(1, 2)
|
|
248
|
-
.exec();
|
|
249
|
-
log('20b. find().autoSelect().page(1,2).exec()', autoSelectResult);
|
|
250
|
-
|
|
251
|
-
// -----------------------------------------------------------------------
|
|
252
|
-
// 21. Entity & query name resolution (Feature 5)
|
|
253
|
-
// -----------------------------------------------------------------------
|
|
254
|
-
log('21. Entity & query name resolution', {
|
|
255
|
-
listEntityNames: client.getListEntityNames(),
|
|
256
|
-
'getQueryNamesForType(serieType)': client.getQueryNamesForType(serieType),
|
|
257
|
-
'getPluralQueryName(serieType)': client.getPluralQueryName(serieType),
|
|
258
|
-
'getSingularQueryName(serieType)': client.getSingularQueryName(serieType),
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const pluralName = client.getPluralQueryName(serieType);
|
|
262
|
-
if (pluralName) {
|
|
263
|
-
log('21b. getTypeNameForQuery("' + pluralName + '")',
|
|
264
|
-
client.getTypeNameForQuery(pluralName));
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// -----------------------------------------------------------------------
|
|
268
|
-
// 22. transformInput (Feature 6)
|
|
269
|
-
// -----------------------------------------------------------------------
|
|
270
|
-
const rawInput = {
|
|
271
|
-
name: 'Test Serie',
|
|
272
|
-
categories: 'Drama',
|
|
273
|
-
year: '2025',
|
|
274
|
-
__typename: 'Serie',
|
|
275
|
-
director: { id: 'dir-123', name: 'Some Director', __typename: 'Director' },
|
|
276
|
-
};
|
|
277
|
-
const transformed = client.transformInput(serieType, rawInput, { mode: 'create' });
|
|
278
|
-
log('22. transformInput -- raw vs transformed', { rawInput, transformed });
|
|
279
|
-
|
|
280
|
-
// -----------------------------------------------------------------------
|
|
281
|
-
// 23. transformCollectionDelta (Feature 7)
|
|
282
|
-
// -----------------------------------------------------------------------
|
|
283
|
-
const seasonType = client.getTypes()['season'] ? 'season' : 'Season';
|
|
284
|
-
const delta = {
|
|
285
|
-
added: [
|
|
286
|
-
{ id: 'temp_1', number: '3', year: '2025', __typename: 'Season', __status: 'added' },
|
|
287
|
-
],
|
|
288
|
-
updated: [
|
|
289
|
-
{ id: 'real-id-1', number: '2', year: '2024', __status: 'modified' },
|
|
290
|
-
],
|
|
291
|
-
deleted: [
|
|
292
|
-
{ id: 'del-id-1' },
|
|
293
|
-
],
|
|
294
|
-
};
|
|
295
|
-
const connectionField = client.getConnectionField(serieType, 'seasons');
|
|
296
|
-
const transformedDelta = client.transformCollectionDelta(seasonType, delta, {
|
|
297
|
-
connectionField: connectionField || 'serie',
|
|
298
|
-
});
|
|
299
|
-
log('23. transformCollectionDelta', { delta, transformedDelta });
|
|
300
|
-
|
|
301
|
-
// -----------------------------------------------------------------------
|
|
302
|
-
// 24. findByParent (Feature 8)
|
|
303
|
-
// -----------------------------------------------------------------------
|
|
304
|
-
if (allSeries.length > 0) {
|
|
305
|
-
const parentId = allSeries[0].id;
|
|
306
|
-
const childSeasons = await client
|
|
307
|
-
.findByParent(seasonType, 'serie', parentId)
|
|
308
|
-
.page(1, 5, true)
|
|
309
|
-
.fields('id number year')
|
|
310
|
-
.exec();
|
|
311
|
-
log('24. findByParent(' + seasonType + ', "serie", "' + parentId + '")', childSeasons);
|
|
312
|
-
} else {
|
|
313
|
-
log('24. findByParent -- skipped (no series)', '');
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// -----------------------------------------------------------------------
|
|
317
|
-
// 25. search (Feature 9)
|
|
318
|
-
// -----------------------------------------------------------------------
|
|
319
|
-
const searchResults = await client.search('star', 'a', {
|
|
320
|
-
displayField: 'name',
|
|
321
|
-
page: 1,
|
|
322
|
-
size: 5,
|
|
323
|
-
});
|
|
324
|
-
log('25. search("star", "a", { displayField: "name" })', searchResults);
|
|
325
|
-
|
|
326
|
-
// -----------------------------------------------------------------------
|
|
327
|
-
// 26. State machine metadata (Feature 10)
|
|
328
|
-
// -----------------------------------------------------------------------
|
|
329
|
-
log('26. State machine metadata', {
|
|
330
|
-
'getStateMachineFields(seasonType)': client.getStateMachineFields(seasonType),
|
|
331
|
-
'getAvailableTransitions(seasonType)': client.getAvailableTransitions(seasonType),
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// -----------------------------------------------------------------------
|
|
335
|
-
// 27. execWithMeta -- pagination count (Feature 11)
|
|
336
|
-
// -----------------------------------------------------------------------
|
|
337
|
-
const { data: pagedSeries, extensions } = await client
|
|
338
|
-
.find(serieType)
|
|
339
|
-
.page(1, 2, true)
|
|
340
|
-
.execWithMeta();
|
|
341
|
-
log('27. execWithMeta -- pagination count', {
|
|
342
|
-
data: pagedSeries,
|
|
343
|
-
extensions,
|
|
344
|
-
totalCount: extensions?.count,
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
// -----------------------------------------------------------------------
|
|
348
|
-
// 28. find() with OR filter
|
|
349
|
-
// -----------------------------------------------------------------------
|
|
350
|
-
const orResults = await client.find(serieType)
|
|
351
|
-
.or([
|
|
352
|
-
SimfinityClient.condition('categories', 'EQ', 'Drama'),
|
|
353
|
-
SimfinityClient.condition('categories', 'EQ', 'Comedy'),
|
|
354
|
-
])
|
|
355
|
-
.fields('id name categories')
|
|
356
|
-
.exec();
|
|
357
|
-
log('28. find() -- OR filter (Drama OR Comedy)', orResults);
|
|
358
|
-
|
|
359
|
-
// -----------------------------------------------------------------------
|
|
360
|
-
// 29. find() with flat where + OR combined
|
|
361
|
-
// -----------------------------------------------------------------------
|
|
362
|
-
const combinedOrResults = await client.find(serieType)
|
|
363
|
-
.where('categories', 'NE', 'Horror')
|
|
364
|
-
.or([
|
|
365
|
-
SimfinityClient.condition('name', 'LIKE', 'Breaking'),
|
|
366
|
-
SimfinityClient.condition('name', 'LIKE', 'Game'),
|
|
367
|
-
])
|
|
368
|
-
.fields('id name categories')
|
|
369
|
-
.exec();
|
|
370
|
-
log('29. find() -- flat where + OR (not Horror AND (name LIKE Breaking OR Game))', combinedOrResults);
|
|
371
|
-
|
|
372
|
-
// -----------------------------------------------------------------------
|
|
373
|
-
// 30. find() with AND containing nested OR
|
|
374
|
-
// -----------------------------------------------------------------------
|
|
375
|
-
const nestedAndOrResults = await client.find(serieType)
|
|
376
|
-
.and([
|
|
377
|
-
{ OR: [
|
|
378
|
-
SimfinityClient.condition('categories', 'EQ', 'Drama'),
|
|
379
|
-
SimfinityClient.condition('categories', 'EQ', 'Comedy'),
|
|
380
|
-
]},
|
|
381
|
-
])
|
|
382
|
-
.fields('id name categories')
|
|
383
|
-
.exec();
|
|
384
|
-
log('30. find() -- AND with nested OR groups', nestedAndOrResults);
|
|
385
|
-
|
|
386
|
-
// -----------------------------------------------------------------------
|
|
387
|
-
// 31. aggregate() with OR filter
|
|
388
|
-
// -----------------------------------------------------------------------
|
|
389
|
-
const aggOrResults = await client.aggregate(seasonType)
|
|
390
|
-
.groupBy('serie')
|
|
391
|
-
.fact('COUNT', 'seasonCount', 'id')
|
|
392
|
-
.or([
|
|
393
|
-
SimfinityClient.condition('year', 'GTE', 2020),
|
|
394
|
-
SimfinityClient.condition('year', 'LTE', 2010),
|
|
395
|
-
])
|
|
396
|
-
.exec();
|
|
397
|
-
log('31. aggregate() -- OR filter (year >= 2020 OR year <= 2010)', aggOrResults);
|
|
398
|
-
|
|
399
|
-
console.log('\n' + '='.repeat(60));
|
|
400
|
-
console.log('Demo complete.');
|
|
401
|
-
console.log('='.repeat(60));
|
|
402
|
-
})();
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@simtlix/simfinity-js-client",
|
|
3
|
-
"version": "1.0.6",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "@simtlix/simfinity-js-client",
|
|
9
|
-
"version": "1.0.6",
|
|
10
|
-
"license": "Apache-2.0",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"node-fetch": "^3.3.2"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"node_modules/data-uri-to-buffer": {
|
|
16
|
-
"version": "4.0.1",
|
|
17
|
-
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
|
18
|
-
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">= 12"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"node_modules/fetch-blob": {
|
|
25
|
-
"version": "3.2.0",
|
|
26
|
-
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
|
27
|
-
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
|
28
|
-
"funding": [
|
|
29
|
-
{
|
|
30
|
-
"type": "github",
|
|
31
|
-
"url": "https://github.com/sponsors/jimmywarting"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "paypal",
|
|
35
|
-
"url": "https://paypal.me/jimmywarting"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"node-domexception": "^1.0.0",
|
|
41
|
-
"web-streams-polyfill": "^3.0.3"
|
|
42
|
-
},
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": "^12.20 || >= 14.13"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"node_modules/formdata-polyfill": {
|
|
48
|
-
"version": "4.0.10",
|
|
49
|
-
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
|
50
|
-
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
|
51
|
-
"license": "MIT",
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"fetch-blob": "^3.1.2"
|
|
54
|
-
},
|
|
55
|
-
"engines": {
|
|
56
|
-
"node": ">=12.20.0"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"node_modules/node-domexception": {
|
|
60
|
-
"version": "1.0.0",
|
|
61
|
-
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
|
62
|
-
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
|
63
|
-
"deprecated": "Use your platform's native DOMException instead",
|
|
64
|
-
"funding": [
|
|
65
|
-
{
|
|
66
|
-
"type": "github",
|
|
67
|
-
"url": "https://github.com/sponsors/jimmywarting"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"type": "github",
|
|
71
|
-
"url": "https://paypal.me/jimmywarting"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"license": "MIT",
|
|
75
|
-
"engines": {
|
|
76
|
-
"node": ">=10.5.0"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"node_modules/node-fetch": {
|
|
80
|
-
"version": "3.3.2",
|
|
81
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
|
82
|
-
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
|
83
|
-
"license": "MIT",
|
|
84
|
-
"dependencies": {
|
|
85
|
-
"data-uri-to-buffer": "^4.0.0",
|
|
86
|
-
"fetch-blob": "^3.1.4",
|
|
87
|
-
"formdata-polyfill": "^4.0.10"
|
|
88
|
-
},
|
|
89
|
-
"engines": {
|
|
90
|
-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
91
|
-
},
|
|
92
|
-
"funding": {
|
|
93
|
-
"type": "opencollective",
|
|
94
|
-
"url": "https://opencollective.com/node-fetch"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"node_modules/web-streams-polyfill": {
|
|
98
|
-
"version": "3.3.3",
|
|
99
|
-
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
|
100
|
-
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
|
101
|
-
"license": "MIT",
|
|
102
|
-
"engines": {
|
|
103
|
-
"node": ">= 8"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@simtlix/simfinity-js-client",
|
|
3
|
-
"version": "1.0.6",
|
|
4
|
-
"description": "Introspection-driven GraphQL client for simfinity-js APIs",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "src/SimfinityClient.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./src/SimfinityClient.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"demo": "node examples/demo.js"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"graphql",
|
|
15
|
-
"client",
|
|
16
|
-
"simfinity",
|
|
17
|
-
"introspection",
|
|
18
|
-
"query-builder"
|
|
19
|
-
],
|
|
20
|
-
"author": "Multiscreen Technology Group - SimTLiX SRL",
|
|
21
|
-
"license": "Apache-2.0",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://github.com/simtlix/simfinity-js-client"
|
|
25
|
-
},
|
|
26
|
-
"engines": {
|
|
27
|
-
"node": ">=18.0.0"
|
|
28
|
-
}
|
|
29
|
-
}
|