@postxl/generators 3.2.1 → 4.0.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.
Files changed (109) hide show
  1. package/dist/backend-actions/actions.generator.d.ts +17 -0
  2. package/dist/backend-actions/actions.generator.js +8 -0
  3. package/dist/backend-actions/actions.generator.js.map +1 -1
  4. package/dist/backend-actions/generators/action-types.generator.js +25 -0
  5. package/dist/backend-actions/generators/action-types.generator.js.map +1 -1
  6. package/dist/backend-actions/generators/dispatcher-service.generator.d.ts +8 -1
  7. package/dist/backend-actions/generators/dispatcher-service.generator.js +68 -13
  8. package/dist/backend-actions/generators/dispatcher-service.generator.js.map +1 -1
  9. package/dist/backend-actions/generators/execution-class.generator.js +10 -4
  10. package/dist/backend-actions/generators/execution-class.generator.js.map +1 -1
  11. package/dist/backend-core/backend.generator.js +5 -0
  12. package/dist/backend-core/backend.generator.js.map +1 -1
  13. package/dist/backend-core/generators/tsconfig.generator.js +1 -1
  14. package/dist/backend-core/template/.gitignore.template +1 -0
  15. package/dist/backend-core/template/tsconfig.types.json +13 -0
  16. package/dist/backend-e2e/generators/e2e-service.generator.js +3 -4
  17. package/dist/backend-e2e/generators/e2e-service.generator.js.map +1 -1
  18. package/dist/backend-update/model-update-service.generator.d.ts +8 -1
  19. package/dist/backend-update/model-update-service.generator.js +62 -14
  20. package/dist/backend-update/model-update-service.generator.js.map +1 -1
  21. package/dist/backend-update/update-service.generator.d.ts +7 -0
  22. package/dist/backend-update/update-service.generator.js +31 -3
  23. package/dist/backend-update/update-service.generator.js.map +1 -1
  24. package/dist/backend-update/update.generator.d.ts +16 -0
  25. package/dist/backend-update/update.generator.js +8 -0
  26. package/dist/backend-update/update.generator.js.map +1 -1
  27. package/dist/backend-view/model-view-service.generator.d.ts +14 -0
  28. package/dist/backend-view/model-view-service.generator.js +186 -60
  29. package/dist/backend-view/model-view-service.generator.js.map +1 -1
  30. package/dist/backend-view/view.generator.d.ts +36 -0
  31. package/dist/backend-view/view.generator.js +103 -0
  32. package/dist/backend-view/view.generator.js.map +1 -1
  33. package/dist/base/base.generator.js +37 -2
  34. package/dist/base/base.generator.js.map +1 -1
  35. package/dist/base/generators/claudemd.generator.js +6 -2
  36. package/dist/base/generators/claudemd.generator.js.map +1 -1
  37. package/dist/base/template/.prettierignore +1 -0
  38. package/dist/base/template/eslint.config.mjs +1 -0
  39. package/dist/frontend-admin/admin.generator.d.ts +2 -1
  40. package/dist/frontend-admin/admin.generator.js +8 -1
  41. package/dist/frontend-admin/admin.generator.js.map +1 -1
  42. package/dist/frontend-admin/generators/admin-global-actions.generator.js +4 -1
  43. package/dist/frontend-admin/generators/admin-global-actions.generator.js.map +1 -1
  44. package/dist/frontend-admin/generators/model-admin-page.generator.js +35 -13
  45. package/dist/frontend-admin/generators/model-admin-page.generator.js.map +1 -1
  46. package/dist/frontend-admin/utils.d.ts +6 -1
  47. package/dist/frontend-admin/utils.js +2 -1
  48. package/dist/frontend-admin/utils.js.map +1 -1
  49. package/dist/frontend-core/frontend.generator.d.ts +43 -1
  50. package/dist/frontend-core/frontend.generator.js +101 -6
  51. package/dist/frontend-core/frontend.generator.js.map +1 -1
  52. package/dist/frontend-core/generators/tsconfig.generator.d.ts +15 -1
  53. package/dist/frontend-core/generators/tsconfig.generator.js +78 -21
  54. package/dist/frontend-core/generators/tsconfig.generator.js.map +1 -1
  55. package/dist/frontend-core/template/.storybook/main.ts +10 -0
  56. package/dist/frontend-core/template/public/site.webmanifest +1 -1
  57. package/dist/frontend-core/template/src/context-providers/auth-context-provider.tsx +6 -1
  58. package/dist/frontend-core/template/src/lib/router.tsx +6 -0
  59. package/dist/frontend-core/template/src/pages/dashboard/dashboard.page.tsx +3 -41
  60. package/dist/frontend-core/template/src/pages/dashboard/user-quick-edit.tsx +75 -0
  61. package/dist/frontend-core/template/src/pages/error/auth-error.page.tsx +4 -2
  62. package/dist/frontend-core/template/src/routes/__root.tsx +16 -5
  63. package/dist/frontend-core/template/vite.config.ts +70 -5
  64. package/dist/frontend-core/types.d.ts +22 -0
  65. package/dist/frontend-forms/forms.generator.d.ts +42 -0
  66. package/dist/frontend-forms/forms.generator.js +53 -9
  67. package/dist/frontend-forms/forms.generator.js.map +1 -1
  68. package/dist/frontend-forms/generators/model/forms.generator.js +38 -7
  69. package/dist/frontend-forms/generators/model/forms.generator.js.map +1 -1
  70. package/dist/frontend-forms/generators/model/inputs.generator.js +1 -1
  71. package/dist/frontend-forms/generators/model/inputs.generator.js.map +1 -1
  72. package/dist/frontend-forms/index.d.ts +8 -0
  73. package/dist/frontend-forms/index.js +3 -1
  74. package/dist/frontend-forms/index.js.map +1 -1
  75. package/dist/frontend-tables/generators/model-table.generator.js +20 -15
  76. package/dist/frontend-tables/generators/model-table.generator.js.map +1 -1
  77. package/dist/seed-data/generator/data-file-utils.generator.d.ts +8 -0
  78. package/dist/seed-data/generator/data-file-utils.generator.js +54 -0
  79. package/dist/seed-data/generator/data-file-utils.generator.js.map +1 -0
  80. package/dist/seed-data/generator/excel-template.generator.js +8 -2
  81. package/dist/seed-data/generator/excel-template.generator.js.map +1 -1
  82. package/dist/seed-data/generator/model-seed-data.generator.js +293 -37
  83. package/dist/seed-data/generator/model-seed-data.generator.js.map +1 -1
  84. package/dist/seed-data/generator/seed-migrations.generator.js +7 -9
  85. package/dist/seed-data/generator/seed-migrations.generator.js.map +1 -1
  86. package/dist/seed-data/generator/sheet-name.d.ts +90 -0
  87. package/dist/seed-data/generator/sheet-name.js +244 -0
  88. package/dist/seed-data/generator/sheet-name.js.map +1 -0
  89. package/dist/seed-data/seed-data.generator.d.ts +36 -15
  90. package/dist/seed-data/seed-data.generator.js +37 -14
  91. package/dist/seed-data/seed-data.generator.js.map +1 -1
  92. package/dist/skailify/generators/app-id.helper.d.ts +33 -0
  93. package/dist/skailify/generators/app-id.helper.js +60 -0
  94. package/dist/skailify/generators/app-id.helper.js.map +1 -0
  95. package/dist/skailify/generators/preview-json.generator.d.ts +11 -1
  96. package/dist/skailify/generators/preview-json.generator.js +11 -3
  97. package/dist/skailify/generators/preview-json.generator.js.map +1 -1
  98. package/dist/skailify/generators/skaile-app-file.generator.d.ts +9 -1
  99. package/dist/skailify/generators/skaile-app-file.generator.js +68 -29
  100. package/dist/skailify/generators/skaile-app-file.generator.js.map +1 -1
  101. package/dist/skailify/index.d.ts +1 -0
  102. package/dist/skailify/index.js +4 -1
  103. package/dist/skailify/index.js.map +1 -1
  104. package/dist/skailify/skailify.generator.d.ts +8 -0
  105. package/dist/skailify/skailify.generator.js +8 -2
  106. package/dist/skailify/skailify.generator.js.map +1 -1
  107. package/dist/types/generators/model-type.generator.js +10 -4
  108. package/dist/types/generators/model-type.generator.js.map +1 -1
  109. package/package.json +4 -4
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EXCEL_SHEET_NAME_MAX_LENGTH = void 0;
37
+ exports.resolveExcelSheetNames = resolveExcelSheetNames;
38
+ exports.toSheetFormulaReference = toSheetFormulaReference;
39
+ exports.warnAboutAdjustedSheetNames = warnAboutAdjustedSheetNames;
40
+ const crypto = __importStar(require("node:crypto"));
41
+ const utils_1 = require("@postxl/utils");
42
+ /**
43
+ * Excel's hard cap on a worksheet name. PXL used to truncate at 30, leaving the
44
+ * last character unspent; the disambiguation scheme below uses all 31.
45
+ */
46
+ exports.EXCEL_SHEET_NAME_MAX_LENGTH = 31;
47
+ /**
48
+ * Characters Excel rejects anywhere in a worksheet name (`exceljs` enforces the
49
+ * same set in its `Worksheet#name` setter). They are also exactly the characters
50
+ * that would break a `='<sheet>'!A1` reference, which is the other consumer of
51
+ * these names.
52
+ */
53
+ const ILLEGAL_SHEET_NAME_CHARACTERS = /[*?:/\\[\]]/g;
54
+ /** Excel reserves this one name outright. Compared case-insensitively, as Excel does. */
55
+ const RESERVED_SHEET_NAME = 'History';
56
+ /** Length of the hash appended to a name too long to fit. */
57
+ const HASH_LENGTH = 4;
58
+ /** `~` + hash, e.g. `~3f2a`. */
59
+ const SUFFIX_LENGTH = HASH_LENGTH + 1;
60
+ /**
61
+ * Assigns each model a worksheet name that Excel accepts and that is unique within
62
+ * one workbook.
63
+ *
64
+ * ## Why this is one function and not a per-name sanitizer
65
+ *
66
+ * Uniqueness cannot be established one name at a time: there are unboundedly many
67
+ * model names and only finitely many 31-character sheet names, so *some* pair must
68
+ * collide, and only a function that sees the whole set can notice. Exposing a
69
+ * "sanitize this one name" helper would invite exactly the call that reintroduces
70
+ * issue #863, so the set-wide resolution is the only entry point.
71
+ *
72
+ * ## The scheme
73
+ *
74
+ * 1. A name that already fits (<= 31 characters, no illegal characters, not
75
+ * reserved) is used verbatim. This is every model in every sample schema but
76
+ * three, so the common case produces a sheet named exactly after its model.
77
+ * 2. A name that does not fit is shortened to `<first 26 chars>~<4 hex digits>`,
78
+ * where the hex digits are the head of a SHA-256 of the **full, original** model
79
+ * name. Exactly 31 characters.
80
+ * 3. Whatever comes out of 1-2 is then forced unique across the set, case-
81
+ * insensitively (Excel and `exceljs` both compare that way), by replacing the
82
+ * tail with `~2`, `~3`, ... until free.
83
+ *
84
+ * ## Determinism
85
+ *
86
+ * Step 2 depends on nothing but the model's own name, so a model's sheet name is
87
+ * independent of which other models exist and of the order they are visited in --
88
+ * adding or renaming a model never silently renames another model's sheet. Step 3
89
+ * does depend on the set, so it walks the names in a fixed code-unit order
90
+ * (deliberately *not* `localeCompare`, which varies with the host's ICU data) and
91
+ * is in practice unreachable: it needs two names that survive step 1 identically
92
+ * (impossible -- model names are unique and compared case-insensitively only here)
93
+ * or two long names sharing both a 26-character prefix and a 16-bit hash. It exists
94
+ * so "unique" is a property of the output rather than an argument about likelihood.
95
+ *
96
+ * ## Why a hash rather than a counter
97
+ *
98
+ * A counter (`...Long`, `...Long~2`) reads better, but it makes a model's sheet
99
+ * name a function of the whole model set: adding a model that sorts earlier
100
+ * renames an existing sheet, silently, in a file a human has already filled in.
101
+ * The hash costs legibility once and buys stability forever.
102
+ */
103
+ function resolveExcelSheetNames(modelNames) {
104
+ const sorted = [...new Set(modelNames)].sort(compareCodeUnits);
105
+ const byModelName = new Map();
106
+ const adjusted = [];
107
+ // Excel/exceljs treat `Foo` and `foo` as the same sheet, so uniqueness is tracked
108
+ // on the lower-cased form.
109
+ const taken = new Set();
110
+ for (const modelName of sorted) {
111
+ const preferred = preferredSheetName(modelName);
112
+ const sheetName = makeUnique(preferred.name, taken);
113
+ taken.add(sheetName.toLowerCase());
114
+ byModelName.set(modelName, sheetName);
115
+ if (sheetName !== modelName) {
116
+ const reason = sheetName !== preferred.name ? 'deduplicated' : preferred.truncated ? 'truncated' : 'sanitized';
117
+ adjusted.push({ modelName, sheetName, reason });
118
+ }
119
+ }
120
+ return { byModelName, adjusted };
121
+ }
122
+ /**
123
+ * Renders a sheet name as it must appear inside a formula reference
124
+ * (`='Some Sheet'!A6:A100`). Excel escapes a literal apostrophe in a quoted sheet
125
+ * reference by doubling it; without this, a name containing one silently produces a
126
+ * reference to a different (usually nonexistent) sheet.
127
+ *
128
+ * A model name cannot currently contain an apostrophe -- `zModelNameJSON` requires
129
+ * `name === toPascalCase(name)`, which drops one -- so this is defence against a
130
+ * future loosening of that rule, not a live bug.
131
+ */
132
+ function toSheetFormulaReference(sheetName) {
133
+ return `'${sheetName.replace(/'/g, "''")}'`;
134
+ }
135
+ /**
136
+ * The name a model would get if it were alone in the workbook: legal for Excel and
137
+ * within the length cap, derived from nothing but the model's own name.
138
+ */
139
+ function preferredSheetName(modelName) {
140
+ const legal = toLegalSheetName(modelName);
141
+ if (legal.length <= exports.EXCEL_SHEET_NAME_MAX_LENGTH) {
142
+ return { name: legal, truncated: false };
143
+ }
144
+ // The hash covers the *original* model name, not the sanitized one, so two names
145
+ // that sanitize to the same string still get different hashes.
146
+ const head = legal.slice(0, exports.EXCEL_SHEET_NAME_MAX_LENGTH - SUFFIX_LENGTH);
147
+ return { name: `${head}~${shortHash(modelName)}`, truncated: true };
148
+ }
149
+ /**
150
+ * Strips what Excel refuses outright. Model names are PascalCase
151
+ * (`zModelNameJSON`), so none of this fires today; it is here because
152
+ * `Schema.ModelName` itself is an unvalidated branded string, and a name that
153
+ * reaches `addWorksheet` with a `[` in it aborts the whole run the same way a
154
+ * duplicate does.
155
+ */
156
+ function toLegalSheetName(modelName) {
157
+ // Illegal characters are dropped rather than substituted: a substitute would
158
+ // consume budget from the 31 characters and could itself collide.
159
+ let name = modelName.replace(ILLEGAL_SHEET_NAME_CHARACTERS, '');
160
+ // Excel forbids a leading or trailing apostrophe (it would terminate the quoted
161
+ // form of a reference).
162
+ name = name.replace(/^'+/, '').replace(/'+$/, '');
163
+ if (name.length === 0) {
164
+ return 'Sheet';
165
+ }
166
+ if (name.toLowerCase() === RESERVED_SHEET_NAME.toLowerCase()) {
167
+ return `${name}_`;
168
+ }
169
+ return name;
170
+ }
171
+ /**
172
+ * Returns `candidate` if free, otherwise the first of `<candidate>~2`,
173
+ * `<candidate>~3`, ... that is, with the head trimmed as needed to stay inside the
174
+ * length cap.
175
+ *
176
+ * The search is bounded: the pool of 31-character names is finite, so an unbounded
177
+ * loop could in principle hang the generator. `taken.size + 2` attempts is more than
178
+ * enough whenever the attempts are distinct (they are, for every counter width), and
179
+ * exhausting it means something is wrong with this function rather than with the
180
+ * schema - so it throws with the whole story rather than spinning.
181
+ */
182
+ function makeUnique(candidate, taken) {
183
+ if (!taken.has(candidate.toLowerCase())) {
184
+ return candidate;
185
+ }
186
+ const limit = taken.size + 2;
187
+ for (let counter = 2; counter <= limit; counter++) {
188
+ const suffix = `~${counter}`;
189
+ const head = candidate.slice(0, exports.EXCEL_SHEET_NAME_MAX_LENGTH - suffix.length);
190
+ const next = `${head}${suffix}`;
191
+ if (!taken.has(next.toLowerCase())) {
192
+ return next;
193
+ }
194
+ }
195
+ throw new Error(`Could not find a free Excel worksheet name for "${candidate}" after ${limit - 1} attempts. ` +
196
+ `This should be unreachable; please report it with the model names involved.`);
197
+ }
198
+ /** Lower-case hex head of a SHA-256. Stable across runs, machines and Node versions. */
199
+ function shortHash(input) {
200
+ return crypto.createHash('sha256').update(input, 'utf8').digest('hex').slice(0, HASH_LENGTH);
201
+ }
202
+ /**
203
+ * Code-unit ordering. `Array#sort`'s default comparator already does this, but
204
+ * naming it makes the "not `localeCompare`" decision visible at the call site: the
205
+ * fallback in `makeUnique` is order-sensitive, and `localeCompare` would make its
206
+ * output depend on the host's ICU data.
207
+ */
208
+ function compareCodeUnits(a, b) {
209
+ return a < b ? -1 : a > b ? 1 : 0;
210
+ }
211
+ /**
212
+ * One `console.warn` describing every model whose worksheet is not named after it,
213
+ * or nothing at all when they all are.
214
+ *
215
+ * Follows `warnAboutMissingLabelQualifiers` in `backend-view`: a pure function that
216
+ * returns the lines (so the content is testable without capturing console output)
217
+ * and a single grouped `console.warn`, rather than one warning per model.
218
+ */
219
+ function warnAboutAdjustedSheetNames(adjusted) {
220
+ if (adjusted.length === 0) {
221
+ return [];
222
+ }
223
+ const lines = adjusted.map(({ modelName, sheetName, reason }) => ` - ${modelName}: sheet "${sheetName}" (${explain(reason)})`);
224
+ const modelNoun = adjusted.length === 1 ? 'model cannot have' : 'models cannot have';
225
+ console.warn(`[seed-data] ${adjusted.length} ${modelNoun} an Excel worksheet named after it, so the corresponding tab in ` +
226
+ `seed-data.xlsx carries a different name. Relation dropdowns still point at the right sheet; only the tab ` +
227
+ `label differs:\n${lines.join('\n')}`);
228
+ return lines;
229
+ }
230
+ function explain(reason) {
231
+ switch (reason) {
232
+ case 'truncated':
233
+ return `longer than Excel's ${exports.EXCEL_SHEET_NAME_MAX_LENGTH}-character sheet-name limit`;
234
+ case 'sanitized':
235
+ return 'contains a character Excel does not allow in a sheet name';
236
+ // Deliberately does not say "shortened": a name that already fits can land here
237
+ // too, by colliding case-insensitively with another model's (`Foo` and `foo`).
238
+ case 'deduplicated':
239
+ return 'would have duplicated another sheet name, so it was renamed';
240
+ default:
241
+ throw new utils_1.ExhaustiveSwitchCheck(reason);
242
+ }
243
+ }
244
+ //# sourceMappingURL=sheet-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet-name.js","sourceRoot":"","sources":["../../../src/seed-data/generator/sheet-name.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,wDAwBC;AAYD,0DAEC;AAqGD,kEAiBC;AA1PD,oDAAqC;AAErC,yCAAqD;AAErD;;;GAGG;AACU,QAAA,2BAA2B,GAAG,EAAE,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,6BAA6B,GAAG,cAAc,CAAA;AAEpD,yFAAyF;AACzF,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAErC,6DAA6D;AAC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,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CACxB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,OAAO,SAAS,YAAY,SAAS,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CACpG,CAAA;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oBAAoB,CAAA;IACpF,OAAO,CAAC,IAAI,CACV,eAAe,QAAQ,CAAC,MAAM,IAAI,SAAS,kEAAkE;QAC3G,2GAA2G;QAC3G,mBAAmB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxC,CAAA;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,OAAO,CAAC,MAA2B;IAC1C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,uBAAuB,mCAA2B,6BAA6B,CAAA;QACxF,KAAK,WAAW;YACd,OAAO,2DAA2D,CAAA;QACpE,gFAAgF;QAChF,+EAA+E;QAC/E,KAAK,cAAc;YACjB,OAAO,6DAA6D,CAAA;QACtE;YACE,MAAM,IAAI,6BAAqB,CAAC,MAAM,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC"}
@@ -13,31 +13,43 @@ export type WithSeedData<Context> = Generator.ExtendContextAndModel<Context, {
13
13
  }, {
14
14
  seedData: SeedDataModelContext;
15
15
  }>;
16
+ /**
17
+ * A data file that is written into the backend package and read back at runtime.
18
+ *
19
+ * Two spellings of the same file are kept because they are anchored differently:
20
+ * generation writes into the project-root-relative VFS, while the generated code
21
+ * resolves against the backend package root it discovers at runtime.
22
+ */
23
+ export type SeedDataFile = {
24
+ /**
25
+ * The path to the file, relative to the project root. Used to write the file.
26
+ */
27
+ projectRootPath: Generator.FilePath;
28
+ /**
29
+ * The path to the file, relative to the backend package root. Used by the generated
30
+ * code, which anchors on that root instead of counting `../` from `__dirname` (#861).
31
+ */
32
+ backendPath: Generator.FilePath;
33
+ };
16
34
  export type SeedDataContext = {
17
35
  /**
18
36
  * The Excel template that contains all seed data
19
37
  */
20
- excelTemplate: {
21
- /**
22
- * The path to the Excel file, relative to the project root
23
- */
24
- projectRootPath: Generator.FilePath;
25
- };
26
- xlportTemplate: {
27
- projectRootPath: Generator.FilePath;
28
- };
38
+ excelTemplate: SeedDataFile;
39
+ xlportTemplate: SeedDataFile;
29
40
  /**
30
41
  * The JSON seed data file that contains all seed data (combined across all models)
31
42
  */
32
- jsonSeedTemplate: {
33
- projectRootPath: Generator.FilePath;
34
- };
43
+ jsonSeedTemplate: SeedDataFile;
35
44
  /**
36
45
  * The JSON test data file with scenario-based test datasets for E2E testing
37
46
  */
38
- testDataTemplate: {
39
- projectRootPath: Generator.FilePath;
40
- };
47
+ testDataTemplate: SeedDataFile;
48
+ /**
49
+ * Resolves a data file that ships inside the backend package to an absolute path,
50
+ * anchored on the package root rather than counted from `__dirname`.
51
+ */
52
+ dataFileResolver: Generator.ImportableFunction;
41
53
  /**
42
54
  * Type definitions for seed migrations
43
55
  */
@@ -87,6 +99,15 @@ export type SeedDataModelContext = {
87
99
  */
88
100
  data: SeedDataRecord[];
89
101
  excel: {
102
+ /**
103
+ * The worksheet this model lives on. Unique within the workbook and within Excel's
104
+ * 31-character limit, so it is not always the model name — see
105
+ * {@link resolveExcelSheetNames}.
106
+ *
107
+ * This is the single source of truth for the name: the workbook writer names the
108
+ * sheet from it and the cross-sheet data-validation formulas reference it, so a
109
+ * relation dropdown always points at a sheet that exists.
110
+ */
90
111
  sheetName: string;
91
112
  tableName: string;
92
113
  };
@@ -39,11 +39,21 @@ const backend_actions_1 = require("../backend-actions");
39
39
  const backend_core_1 = require("../backend-core");
40
40
  const base_1 = require("../base");
41
41
  const types_1 = require("../types");
42
+ const data_file_utils_generator_1 = require("./generator/data-file-utils.generator");
42
43
  const excel_template_generator_1 = require("./generator/excel-template.generator");
43
44
  const json_seed_data_generator_1 = require("./generator/json-seed-data.generator");
44
45
  const model_seed_data_generator_1 = require("./generator/model-seed-data.generator");
45
46
  const seed_migration_types_generator_1 = require("./generator/seed-migration-types.generator");
46
47
  const seed_migrations_generator_1 = require("./generator/seed-migrations.generator");
48
+ const sheet_name_1 = require("./generator/sheet-name");
49
+ /**
50
+ * Both spellings of a backend data file derived from one source of truth, so the path the
51
+ * generator writes and the path the generated code reads can never drift apart.
52
+ */
53
+ const toSeedDataFile = (backendPath) => ({
54
+ projectRootPath: Generator.toFilePath(`./backend/${backendPath}`),
55
+ backendPath: Generator.toFilePath(backendPath),
56
+ });
47
57
  exports.generatorId = Generator.toGeneratorInterfaceId('seed-data');
48
58
  const moduleName = Generator.toBackendModuleName('seedData');
49
59
  exports.generator = {
@@ -54,17 +64,13 @@ exports.generator = {
54
64
  context.backend.modules.push(seedDataModule);
55
65
  const typesLocation = Generator.toBackendModuleLocation(`@seedData/seed-migration.types`);
56
66
  const seedData = {
57
- excelTemplate: {
58
- projectRootPath: Generator.toFilePath(`./backend/seed-data.xlsx`),
59
- },
60
- xlportTemplate: {
61
- projectRootPath: Generator.toFilePath(`./backend/xlport/data-model.xlsx`),
62
- },
63
- jsonSeedTemplate: {
64
- projectRootPath: Generator.toFilePath(`./backend/seed-data.json`),
65
- },
66
- testDataTemplate: {
67
- projectRootPath: Generator.toFilePath(`./backend/test-data.json`),
67
+ excelTemplate: toSeedDataFile(`seed-data.xlsx`),
68
+ xlportTemplate: toSeedDataFile(`xlport/data-model.xlsx`),
69
+ jsonSeedTemplate: toSeedDataFile(`seed-data.json`),
70
+ testDataTemplate: toSeedDataFile(`test-data.json`),
71
+ dataFileResolver: {
72
+ name: Generator.toFunctionName(`resolveBackendDataFile`),
73
+ location: Generator.toBackendModuleLocation(`@${moduleName}/data-file.utils`),
68
74
  },
69
75
  migrationTypes: {
70
76
  summary: {
@@ -102,9 +108,25 @@ exports.generator = {
102
108
  },
103
109
  };
104
110
  const modelData = (0, model_seed_data_generator_1.generateSeedDataForModels)(context);
111
+ // Resolved over `context.models` (every model), never `context.targetModels`, so a
112
+ // `-m Country` run assigns the same names a full run does. That also makes the
113
+ // per-model single-sheet workbooks written in `generate()` agree with the combined
114
+ // one: they are built from these same already-resolved model contexts.
115
+ const sheetNames = (0, sheet_name_1.resolveExcelSheetNames)(context.models.keys());
116
+ // The base-reconstruction pass re-runs `register()` against the *previous* schema
117
+ // snapshot, so a warning fired there would describe a schema the developer is not
118
+ // generating (see `backend-view`'s label-qualifier advisory for the same guard).
119
+ if (!context.options.isBaseReconstruction) {
120
+ (0, sheet_name_1.warnAboutAdjustedSheetNames)(sheetNames.adjusted);
121
+ }
105
122
  const models = new Map();
106
123
  for (const [modelName, model] of context.models) {
107
- const modelWithSeedData = registerModelSeedData({ context, modelData, model });
124
+ const modelWithSeedData = registerModelSeedData({
125
+ context,
126
+ modelData,
127
+ model,
128
+ sheetName: sheetNames.byModelName.get(modelName),
129
+ });
108
130
  models.set(modelName, modelWithSeedData);
109
131
  }
110
132
  return { ...context, seedData, models };
@@ -118,6 +140,7 @@ exports.generator = {
118
140
  vfsSrc.write(Generator.toLocalFile({ location: model.seedData.dataVariable.location, extension: 'json' }), (0, model_seed_data_generator_1.generateModelSeedDataJson)({ model, context }));
119
141
  vfsSrc.write(Generator.toLocalFile(model.seedData.dataVariable), (0, model_seed_data_generator_1.generateModelSeedDataTypescript)({ model, context }));
120
142
  }
143
+ vfsSrc.write(Generator.toLocalFile(context.seedData.dataFileResolver), (0, data_file_utils_generator_1.generateSeedDataFileUtils)());
121
144
  vfsSrc.write(Generator.toLocalFile(context.seedData.migrationTypes.summary), (0, seed_migration_types_generator_1.generateSeedMigrationTypes)(context));
122
145
  vfsSrc.write(Generator.toLocalFile(context.seedData.seedMigrations), (0, seed_migrations_generator_1.generateSeedMigrations)(context));
123
146
  const vfs = new Generator.VirtualFileSystem();
@@ -175,7 +198,7 @@ exports.generator = {
175
198
  return context;
176
199
  },
177
200
  };
178
- function registerModelSeedData({ modelData, model, }) {
201
+ function registerModelSeedData({ modelData, model, sheetName, }) {
179
202
  const data = modelData.get(model.name);
180
203
  const seedData = {
181
204
  dataVariable: {
@@ -185,7 +208,7 @@ function registerModelSeedData({ modelData, model, }) {
185
208
  data,
186
209
  excel: {
187
210
  tableName: model.excelName,
188
- sheetName: model.name.substring(0, 30),
211
+ sheetName,
189
212
  },
190
213
  };
191
214
  return { ...model, seedData };
@@ -1 +1 @@
1
- {"version":3,"file":"seed-data.generator.js","sourceRoot":"","sources":["../../src/seed-data/seed-data.generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAG9C,wDAA2E;AAC3E,kDAA+E;AAC/E,kCAAmD;AACnD,oCAAsD;AAEtD,mFAAgF;AAChF,mFAAyG;AACzG,qFAK8C;AAC9C,+FAAuF;AACvF,qFAA8E;AAgGjE,QAAA,WAAW,GAAG,SAAS,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;AACxE,MAAM,UAAU,GAAG,SAAS,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;AAE/C,QAAA,SAAS,GAAiC;IACrD,EAAE,EAAE,mBAAW;IACf,QAAQ,EAAE,CAAC,iCAAkB,EAAE,sBAAe,EAAE,wBAAgB,EAAE,2CAAyB,CAAC;IAE5F,QAAQ,EAAE,CAAsC,OAAgB,EAAiB,EAAE;QACjF,MAAM,cAAc,GAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;QACzD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC5C,MAAM,aAAa,GAAG,SAAS,CAAC,uBAAuB,CAAC,gCAAgC,CAAC,CAAA;QAEzF,MAAM,QAAQ,GAAoB;YAChC,aAAa,EAAE;gBACb,eAAe,EAAE,SAAS,CAAC,UAAU,CAAC,0BAA0B,CAAC;aAClE;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AED,KAAK,MAAM,QAAQ,IAAI,oBAAoB,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAA;QAEvE,OAAO,OAAO,CAAA;IAChB,CAAC;CACF,CAAA;AAED,SAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,KAAK,EACL,SAAS,GAMV;IACC,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAA;IAEvC,MAAM,QAAQ,GAAyB;QACrC,YAAY,EAAE;YACZ,IAAI,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;YACtE,QAAQ,EAAE,SAAS,CAAC,uBAAuB,CAAC,kBAAkB,KAAK,CAAC,WAAW,CAAC,SAAS,YAAY,CAAC;SACvG;QACD,IAAI;QACJ,KAAK,EAAE;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS;SACV;KACF,CAAA;IACD,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAA;AAC/B,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * App ids the Skaile platform reserves for its own routing.
3
+ *
4
+ * `frontend` is the one a generated project used to collide with: it was the
5
+ * hardcoded default on both sides of the preview contract, and the platform
6
+ * rejects it. The rejection only ever surfaced as a failed handshake on the app
7
+ * channel - swallowed at `debug` - so a generated app silently never connected
8
+ * (#848).
9
+ */
10
+ export declare const RESERVED_SKAILE_APP_IDS: ReadonlySet<string>;
11
+ /**
12
+ * The single source of truth for the preview app id.
13
+ *
14
+ * `skaile-app.ts` bakes the result into `APP_ID` and `skaile.preview.json`
15
+ * declares it as the frontend app's `id`. The comment the generator writes into
16
+ * `skaile-app.ts` ("Must match the `id` of the frontend app in
17
+ * skaile.preview.json") makes that coupling a correctness requirement, so both
18
+ * emitters are handed the value this returns rather than each deriving its own -
19
+ * the two cannot drift apart because there is only one computation.
20
+ *
21
+ * The default is `<slug>-frontend`: derived from the project, and non-reserved by
22
+ * construction, since appending the suffix means it can never equal a bare
23
+ * reserved role name like `frontend`.
24
+ *
25
+ * An explicit `appId` is validated loudly - it is hand-written config, and a bad
26
+ * value fails at runtime in a way that is expensive to diagnose. The slug-derived
27
+ * path never throws: the schema already guarantees a well-formed slug, which is
28
+ * used as-is, and anything else is normalised quietly (see below).
29
+ */
30
+ export declare function resolveSkaileAppId(options: {
31
+ slug: string;
32
+ appId?: string | undefined;
33
+ }): string;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESERVED_SKAILE_APP_IDS = void 0;
4
+ exports.resolveSkaileAppId = resolveSkaileAppId;
5
+ const utils_1 = require("@postxl/utils");
6
+ /**
7
+ * App ids the Skaile platform reserves for its own routing.
8
+ *
9
+ * `frontend` is the one a generated project used to collide with: it was the
10
+ * hardcoded default on both sides of the preview contract, and the platform
11
+ * rejects it. The rejection only ever surfaced as a failed handshake on the app
12
+ * channel - swallowed at `debug` - so a generated app silently never connected
13
+ * (#848).
14
+ */
15
+ exports.RESERVED_SKAILE_APP_IDS = new Set(['frontend']);
16
+ /** The shape a Skaile app id must have - the same one the schema enforces for `slug`. */
17
+ const SKAILE_APP_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
18
+ /** Suffix that distinguishes the frontend app from the project it belongs to. */
19
+ const FRONTEND_APP_ID_SUFFIX = 'frontend';
20
+ /** Last-resort stem, only reachable if a project slug slugifies to nothing. */
21
+ const FALLBACK_APP_ID_STEM = 'app';
22
+ /**
23
+ * The single source of truth for the preview app id.
24
+ *
25
+ * `skaile-app.ts` bakes the result into `APP_ID` and `skaile.preview.json`
26
+ * declares it as the frontend app's `id`. The comment the generator writes into
27
+ * `skaile-app.ts` ("Must match the `id` of the frontend app in
28
+ * skaile.preview.json") makes that coupling a correctness requirement, so both
29
+ * emitters are handed the value this returns rather than each deriving its own -
30
+ * the two cannot drift apart because there is only one computation.
31
+ *
32
+ * The default is `<slug>-frontend`: derived from the project, and non-reserved by
33
+ * construction, since appending the suffix means it can never equal a bare
34
+ * reserved role name like `frontend`.
35
+ *
36
+ * An explicit `appId` is validated loudly - it is hand-written config, and a bad
37
+ * value fails at runtime in a way that is expensive to diagnose. The slug-derived
38
+ * path never throws: the schema already guarantees a well-formed slug, which is
39
+ * used as-is, and anything else is normalised quietly (see below).
40
+ */
41
+ function resolveSkaileAppId(options) {
42
+ const explicit = options.appId?.trim();
43
+ if (explicit !== undefined && explicit !== '') {
44
+ if (!SKAILE_APP_ID_PATTERN.test(explicit)) {
45
+ throw new Error(`skailify: appId "${explicit}" is not a valid Skaile app id - use lowercase letters and digits separated by single dashes.`);
46
+ }
47
+ if (exports.RESERVED_SKAILE_APP_IDS.has(explicit)) {
48
+ throw new Error(`skailify: appId "${explicit}" is reserved by the Skaile platform and would be rejected - choose another id.`);
49
+ }
50
+ return explicit;
51
+ }
52
+ // Only normalise a slug that is not already well-formed. `slugify` is not
53
+ // idempotent on valid slugs - it splits letter/digit boundaries, so it would
54
+ // turn `client1-crm` into `client-1-crm` - and the app id should be the
55
+ // project's actual slug, not a re-derived variant of it.
56
+ const slug = options.slug.trim();
57
+ const stem = SKAILE_APP_ID_PATTERN.test(slug) ? slug : (0, utils_1.slugify)(slug) || FALLBACK_APP_ID_STEM;
58
+ return `${stem}-${FRONTEND_APP_ID_SUFFIX}`;
59
+ }
60
+ //# sourceMappingURL=app-id.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-id.helper.js","sourceRoot":"","sources":["../../../src/skailify/generators/app-id.helper.ts"],"names":[],"mappings":";;;AAyCA,gDAwBC;AAjED,yCAAuC;AAEvC;;;;;;;;GAQG;AACU,QAAA,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AAEjF,yFAAyF;AACzF,MAAM,qBAAqB,GAAG,4BAA4B,CAAA;AAE1D,iFAAiF;AACjF,MAAM,sBAAsB,GAAG,UAAU,CAAA;AAEzC,+EAA+E;AAC/E,MAAM,oBAAoB,GAAG,KAAK,CAAA;AAElC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,kBAAkB,CAAC,OAAqD;IACtF,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;IAEtC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QAC9C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,oBAAoB,QAAQ,+FAA+F,CAC5H,CAAA;QACH,CAAC;QACD,IAAI,+BAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,oBAAoB,QAAQ,iFAAiF,CAC9G,CAAA;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,0EAA0E;IAC1E,6EAA6E;IAC7E,wEAAwE;IACxE,yDAAyD;IACzD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,IAAI,CAAC,IAAI,oBAAoB,CAAA;IAC5F,OAAO,GAAG,IAAI,IAAI,sBAAsB,EAAE,CAAA;AAC5C,CAAC"}
@@ -1 +1,11 @@
1
- export declare function generateSkailePreviewJson(): string;
1
+ /**
2
+ * `appId` is the id of the frontend app, and must be the same value
3
+ * `generateSkaileAppFile` bakes into `APP_ID`. Both come from
4
+ * `resolveSkaileAppId` via a single call in `skailify.generator.ts` - see the
5
+ * note there. Only `id`/`defaultAppId` are derived: `path` stays `frontend`
6
+ * because it is the directory the app is served from, and `role` stays
7
+ * `frontend` because it is the platform's role enum, not an identifier.
8
+ */
9
+ export declare function generateSkailePreviewJson({ appId }: {
10
+ appId: string;
11
+ }): string;
@@ -1,14 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateSkailePreviewJson = generateSkailePreviewJson;
4
- function generateSkailePreviewJson() {
4
+ /**
5
+ * `appId` is the id of the frontend app, and must be the same value
6
+ * `generateSkaileAppFile` bakes into `APP_ID`. Both come from
7
+ * `resolveSkaileAppId` via a single call in `skailify.generator.ts` - see the
8
+ * note there. Only `id`/`defaultAppId` are derived: `path` stays `frontend`
9
+ * because it is the directory the app is served from, and `role` stays
10
+ * `frontend` because it is the platform's role enum, not an identifier.
11
+ */
12
+ function generateSkailePreviewJson({ appId }) {
5
13
  const content = {
6
14
  version: 1,
7
15
  apps: [
8
- { id: 'frontend', label: 'Frontend', path: 'frontend', role: 'frontend', protocol: true },
16
+ { id: appId, label: 'Frontend', path: 'frontend', role: 'frontend', protocol: true },
9
17
  { id: 'backend', label: 'Backend', path: 'backend', role: 'backend' },
10
18
  ],
11
- defaultAppId: 'frontend',
19
+ defaultAppId: appId,
12
20
  };
13
21
  return `${JSON.stringify(content, null, 2)}\n`;
14
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preview-json.generator.js","sourceRoot":"","sources":["../../../src/skailify/generators/preview-json.generator.ts"],"names":[],"mappings":";;AAAA,8DAUC;AAVD,SAAgB,yBAAyB;IACvC,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,CAAC;QACV,IAAI,EAAE;YACJ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;YACzF,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACtE;QACD,YAAY,EAAE,UAAU;KACzB,CAAA;IACD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAA;AAChD,CAAC"}
1
+ {"version":3,"file":"preview-json.generator.js","sourceRoot":"","sources":["../../../src/skailify/generators/preview-json.generator.ts"],"names":[],"mappings":";;AAQA,8DAUC;AAlBD;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAqB;IACpE,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,CAAC;QACV,IAAI,EAAE;YACJ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;YACpF,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACtE;QACD,YAAY,EAAE,KAAK;KACpB,CAAA;IACD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAA;AAChD,CAAC"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * `appId` must be the same value `generateSkailePreviewJson` writes as the
3
+ * frontend app's `id`; both are handed the result of a single
4
+ * `resolveSkaileAppId` call in `skailify.generator.ts`, which is what keeps the
5
+ * "Must match the `id` ..." comment below true by construction.
6
+ */
1
7
  export declare function generateSkaileAppFile(models: {
2
8
  camelCase: string;
3
- }[]): string;
9
+ }[], { appId }: {
10
+ appId: string;
11
+ }): string;