@technicity/data-service-generator 0.12.0 → 0.12.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.
@@ -4,6 +4,7 @@ export declare function getFakeData(input: {
4
4
  select?: unknown[];
5
5
  isList: boolean;
6
6
  artifacts: IArtifacts;
7
+ operation: string | null;
7
8
  }): {
8
9
  [k: string]: unknown;
9
10
  } | {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFakeData = void 0;
4
4
  function getFakeData(input) {
5
- const { model, select, isList, artifacts } = input;
5
+ const { model, select, isList, artifacts, operation } = input;
6
6
  const tableMeta = artifacts[model];
7
7
  if (tableMeta === void 0) {
8
8
  throw new Error(`Model ${model} not found.`);
@@ -47,7 +47,9 @@ function getFakeData(input) {
47
47
  model: field.type,
48
48
  select: x.fields,
49
49
  artifacts,
50
- isList: field.isList
50
+ isList: field.isList,
51
+ // Only relevant at top-level
52
+ operation: null
51
53
  });
52
54
  }
53
55
  else {
@@ -55,10 +57,20 @@ function getFakeData(input) {
55
57
  }
56
58
  }
57
59
  }
58
- if (isList) {
59
- return [data];
60
+ let out = isList ? [data] : data;
61
+ if (typeof operation === "string" && operation.endsWith("Paginated")) {
62
+ out = {
63
+ paginationInfo: {
64
+ hasPreviousPage: false,
65
+ hasNextPage: false,
66
+ startCursor: "STUB",
67
+ endCursor: "STUB",
68
+ totalCount: 1
69
+ },
70
+ results: out
71
+ };
60
72
  }
61
- return data;
73
+ return out;
62
74
  }
63
75
  exports.getFakeData = getFakeData;
64
76
  function getValue(type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@technicity/data-service-generator",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"