@microsoft/managed-apps-codegen 0.2.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.
Files changed (119) hide show
  1. package/LICENSE +153 -0
  2. package/README.md +37 -0
  3. package/dist/CodegenProject.d.ts +26 -0
  4. package/dist/CodegenProject.d.ts.map +1 -0
  5. package/dist/CodegenProject.js +140 -0
  6. package/dist/CodegenProject.js.map +1 -0
  7. package/dist/Connector/generateConnectorModel.d.ts +13 -0
  8. package/dist/Connector/generateConnectorModel.d.ts.map +1 -0
  9. package/dist/Connector/generateConnectorModel.js +163 -0
  10. package/dist/Connector/generateConnectorModel.js.map +1 -0
  11. package/dist/Connector/generateConnectorService.d.ts +15 -0
  12. package/dist/Connector/generateConnectorService.d.ts.map +1 -0
  13. package/dist/Connector/generateConnectorService.js +331 -0
  14. package/dist/Connector/generateConnectorService.js.map +1 -0
  15. package/dist/Connector/index.d.ts +6 -0
  16. package/dist/Connector/index.d.ts.map +1 -0
  17. package/dist/Connector/index.js +6 -0
  18. package/dist/Connector/index.js.map +1 -0
  19. package/dist/Dataverse/generateDataverseModel.d.ts +18 -0
  20. package/dist/Dataverse/generateDataverseModel.d.ts.map +1 -0
  21. package/dist/Dataverse/generateDataverseModel.js +226 -0
  22. package/dist/Dataverse/generateDataverseModel.js.map +1 -0
  23. package/dist/Dataverse/generateDataverseService.d.ts +17 -0
  24. package/dist/Dataverse/generateDataverseService.d.ts.map +1 -0
  25. package/dist/Dataverse/generateDataverseService.js +323 -0
  26. package/dist/Dataverse/generateDataverseService.js.map +1 -0
  27. package/dist/Dataverse/index.d.ts +6 -0
  28. package/dist/Dataverse/index.d.ts.map +1 -0
  29. package/dist/Dataverse/index.js +6 -0
  30. package/dist/Dataverse/index.js.map +1 -0
  31. package/dist/SharePointTabular/generateSharepointTabularModel.d.ts +16 -0
  32. package/dist/SharePointTabular/generateSharepointTabularModel.d.ts.map +1 -0
  33. package/dist/SharePointTabular/generateSharepointTabularModel.js +130 -0
  34. package/dist/SharePointTabular/generateSharepointTabularModel.js.map +1 -0
  35. package/dist/SharePointTabular/index.d.ts +5 -0
  36. package/dist/SharePointTabular/index.d.ts.map +1 -0
  37. package/dist/SharePointTabular/index.js +5 -0
  38. package/dist/SharePointTabular/index.js.map +1 -0
  39. package/dist/SqlStoredProc/generateSqlStoredProcModel.d.ts +16 -0
  40. package/dist/SqlStoredProc/generateSqlStoredProcModel.d.ts.map +1 -0
  41. package/dist/SqlStoredProc/generateSqlStoredProcModel.js +38 -0
  42. package/dist/SqlStoredProc/generateSqlStoredProcModel.js.map +1 -0
  43. package/dist/SqlStoredProc/generateSqlStoredProcService.d.ts +16 -0
  44. package/dist/SqlStoredProc/generateSqlStoredProcService.d.ts.map +1 -0
  45. package/dist/SqlStoredProc/generateSqlStoredProcService.js +89 -0
  46. package/dist/SqlStoredProc/generateSqlStoredProcService.js.map +1 -0
  47. package/dist/SqlStoredProc/index.d.ts +6 -0
  48. package/dist/SqlStoredProc/index.d.ts.map +1 -0
  49. package/dist/SqlStoredProc/index.js +6 -0
  50. package/dist/SqlStoredProc/index.js.map +1 -0
  51. package/dist/Tabular/generateCommonModels.d.ts +11 -0
  52. package/dist/Tabular/generateCommonModels.d.ts.map +1 -0
  53. package/dist/Tabular/generateCommonModels.js +27 -0
  54. package/dist/Tabular/generateCommonModels.js.map +1 -0
  55. package/dist/Tabular/generateTabularModel.d.ts +15 -0
  56. package/dist/Tabular/generateTabularModel.d.ts.map +1 -0
  57. package/dist/Tabular/generateTabularModel.js +31 -0
  58. package/dist/Tabular/generateTabularModel.js.map +1 -0
  59. package/dist/Tabular/generateTabularService.d.ts +19 -0
  60. package/dist/Tabular/generateTabularService.d.ts.map +1 -0
  61. package/dist/Tabular/generateTabularService.js +165 -0
  62. package/dist/Tabular/generateTabularService.js.map +1 -0
  63. package/dist/Tabular/index.d.ts +7 -0
  64. package/dist/Tabular/index.d.ts.map +1 -0
  65. package/dist/Tabular/index.js +7 -0
  66. package/dist/Tabular/index.js.map +1 -0
  67. package/dist/defaultPrettierConfig.d.ts +6 -0
  68. package/dist/defaultPrettierConfig.d.ts.map +1 -0
  69. package/dist/defaultPrettierConfig.js +10 -0
  70. package/dist/defaultPrettierConfig.js.map +1 -0
  71. package/dist/index.d.ts +13 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +11 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/shared/constants.d.ts +9 -0
  76. package/dist/shared/constants.d.ts.map +1 -0
  77. package/dist/shared/constants.js +9 -0
  78. package/dist/shared/constants.js.map +1 -0
  79. package/dist/shared/dataverseUtils.d.ts +61 -0
  80. package/dist/shared/dataverseUtils.d.ts.map +1 -0
  81. package/dist/shared/dataverseUtils.js +138 -0
  82. package/dist/shared/dataverseUtils.js.map +1 -0
  83. package/dist/shared/flowUtils.d.ts +11 -0
  84. package/dist/shared/flowUtils.d.ts.map +1 -0
  85. package/dist/shared/flowUtils.js +16 -0
  86. package/dist/shared/flowUtils.js.map +1 -0
  87. package/dist/shared/nameUtils.d.ts +33 -0
  88. package/dist/shared/nameUtils.d.ts.map +1 -0
  89. package/dist/shared/nameUtils.js +180 -0
  90. package/dist/shared/nameUtils.js.map +1 -0
  91. package/dist/shared/project.d.ts +22 -0
  92. package/dist/shared/project.d.ts.map +1 -0
  93. package/dist/shared/project.js +5 -0
  94. package/dist/shared/project.js.map +1 -0
  95. package/dist/shared/schemaUtils.d.ts +32 -0
  96. package/dist/shared/schemaUtils.d.ts.map +1 -0
  97. package/dist/shared/schemaUtils.js +110 -0
  98. package/dist/shared/schemaUtils.js.map +1 -0
  99. package/dist/shared/sqlStoredProcUtils.d.ts +11 -0
  100. package/dist/shared/sqlStoredProcUtils.d.ts.map +1 -0
  101. package/dist/shared/sqlStoredProcUtils.js +19 -0
  102. package/dist/shared/sqlStoredProcUtils.js.map +1 -0
  103. package/dist/shared/swaggerUtils.d.ts +12 -0
  104. package/dist/shared/swaggerUtils.d.ts.map +1 -0
  105. package/dist/shared/swaggerUtils.js +12 -0
  106. package/dist/shared/swaggerUtils.js.map +1 -0
  107. package/dist/shared/typeUtils.d.ts +22 -0
  108. package/dist/shared/typeUtils.d.ts.map +1 -0
  109. package/dist/shared/typeUtils.js +94 -0
  110. package/dist/shared/typeUtils.js.map +1 -0
  111. package/dist/shared/types.d.ts +24 -0
  112. package/dist/shared/types.d.ts.map +1 -0
  113. package/dist/shared/types.js +5 -0
  114. package/dist/shared/types.js.map +1 -0
  115. package/dist/types.d.ts +5 -0
  116. package/dist/types.d.ts.map +1 -0
  117. package/dist/types.js +5 -0
  118. package/dist/types.js.map +1 -0
  119. package/package.json +61 -0
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ICodegenContext } from '../shared/types.js';
5
+ import type { JsonObject } from '../types.js';
6
+ interface GenerateSqlStoredProcServiceContext {
7
+ parentContext: ICodegenContext;
8
+ schema: JsonObject;
9
+ serviceFilePath: string;
10
+ dataSourcesFilePath: string;
11
+ requestModelName: string | null;
12
+ responseModelName: string;
13
+ }
14
+ export declare function generateSqlStoredProcService({ parentContext, schema, serviceFilePath, dataSourcesFilePath, requestModelName, responseModelName, }: GenerateSqlStoredProcServiceContext): Promise<void>;
15
+ export default generateSqlStoredProcService;
16
+ //# sourceMappingURL=generateSqlStoredProcService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSqlStoredProcService.d.ts","sourceRoot":"","sources":["../../src/SqlStoredProc/generateSqlStoredProcService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,mCAAmC;IAC3C,aAAa,EAAE,eAAe,CAAC;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,4BAA4B,CAAC,EACjD,aAAa,EACb,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,EAAE,mCAAmC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFrD;AAED,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,89 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { Scope } from 'ts-morph';
5
+ import { convertToValidIdentifier, sanitizeName } from '../shared/nameUtils.js';
6
+ import { getNameNode } from '../shared/schemaUtils.js';
7
+ import { getSqlStoredProcApiKey } from '../shared/sqlStoredProcUtils.js';
8
+ export async function generateSqlStoredProcService({ parentContext, schema, serviceFilePath, dataSourcesFilePath, requestModelName, responseModelName, }) {
9
+ const { modelName, dataSourceName, project } = parentContext;
10
+ const operationId = getSqlStoredProcApiKey(getNameNode(schema));
11
+ const methodName = sanitizeName(operationId);
12
+ const serviceName = `${convertToValidIdentifier(modelName)}Service`;
13
+ const sourceFile = await project.createFile('service', serviceFilePath, '');
14
+ sourceFile.addImportDeclaration({
15
+ moduleSpecifier: '@microsoft/managed-apps/data',
16
+ namedImports: ['getClient'],
17
+ });
18
+ sourceFile.addImportDeclaration({
19
+ moduleSpecifier: '@microsoft/managed-apps/data',
20
+ namedImports: ['IOperationResult'],
21
+ isTypeOnly: true,
22
+ });
23
+ sourceFile.addImportDeclaration({
24
+ moduleSpecifier: dataSourcesFilePath,
25
+ defaultImport: 'dataSources',
26
+ });
27
+ const modelImports = requestModelName
28
+ ? [responseModelName, requestModelName]
29
+ : [responseModelName];
30
+ sourceFile.addImportDeclaration({
31
+ moduleSpecifier: sourceFile.getRelativePathAsModuleSpecifierTo(project.getSourceFile('model')),
32
+ namedImports: modelImports,
33
+ isTypeOnly: true,
34
+ });
35
+ const methodStatements = requestModelName
36
+ ? [
37
+ `const params: { inputParameters: ${requestModelName} } = { inputParameters };`,
38
+ `const result = await ${serviceName}.client.executeAsync<{ inputParameters: ${requestModelName} }, ${responseModelName}>({`,
39
+ ` connectorOperation: {`,
40
+ ` tableName: ${serviceName}.dataSourceName,`,
41
+ ` operationName: '${operationId}',`,
42
+ ` parameters: params,`,
43
+ ` },`,
44
+ `});`,
45
+ `return result;`,
46
+ ]
47
+ : [
48
+ `const result = await ${serviceName}.client.executeAsync<void, ${responseModelName}>({`,
49
+ ` connectorOperation: {`,
50
+ ` tableName: ${serviceName}.dataSourceName,`,
51
+ ` operationName: '${operationId}',`,
52
+ ` },`,
53
+ `});`,
54
+ `return result;`,
55
+ ];
56
+ sourceFile.addClass({
57
+ name: serviceName,
58
+ isExported: true,
59
+ properties: [
60
+ {
61
+ name: 'dataSourceName',
62
+ isStatic: true,
63
+ isReadonly: true,
64
+ scope: Scope.Private,
65
+ initializer: `'${dataSourceName.toLowerCase()}'`,
66
+ },
67
+ {
68
+ name: 'client',
69
+ isStatic: true,
70
+ isReadonly: true,
71
+ scope: Scope.Private,
72
+ initializer: 'getClient(dataSources)',
73
+ },
74
+ ],
75
+ methods: [
76
+ {
77
+ name: methodName,
78
+ isStatic: true,
79
+ isAsync: true,
80
+ scope: Scope.Public,
81
+ parameters: requestModelName ? [{ name: 'inputParameters', type: requestModelName }] : [],
82
+ returnType: `Promise<IOperationResult<${responseModelName}>>`,
83
+ statements: methodStatements,
84
+ },
85
+ ],
86
+ });
87
+ }
88
+ export default generateSqlStoredProcService;
89
+ //# sourceMappingURL=generateSqlStoredProcService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSqlStoredProcService.js","sourceRoot":"","sources":["../../src/SqlStoredProc/generateSqlStoredProcService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,YAAY,EA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F,UAAU,EAAE,4BAA4B,iBAAiB,IAAI;gBAC7D,UAAU,EAAE,gBAAgB;aAC7B;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { default as generateSqlStoredProcModel } from './generateSqlStoredProcModel.js';
5
+ export { default as generateSqlStoredProcService } from './generateSqlStoredProcService.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SqlStoredProc/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { default as generateSqlStoredProcModel } from './generateSqlStoredProcModel.js';
5
+ export { default as generateSqlStoredProcService } from './generateSqlStoredProcService.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SqlStoredProc/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ICodegenContext } from '../shared/types.js';
5
+ interface GenerateCommonModelsContext {
6
+ parentContext: ICodegenContext;
7
+ commonModelsFilePath: string;
8
+ }
9
+ export declare function generateCommonModels({ parentContext, commonModelsFilePath, }: GenerateCommonModelsContext): Promise<void>;
10
+ export default generateCommonModels;
11
+ //# sourceMappingURL=generateCommonModels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCommonModels.d.ts","sourceRoot":"","sources":["../../src/Tabular/generateCommonModels.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,UAAU,2BAA2B;IACnC,aAAa,EAAE,eAAe,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,oBAAoB,CAAC,EACzC,aAAa,EACb,oBAAoB,GACrB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB7C;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export async function generateCommonModels({ parentContext, commonModelsFilePath, }) {
5
+ const { project } = parentContext;
6
+ const sourceFile = await project.createFile('commonModel', commonModelsFilePath, '');
7
+ sourceFile.addInterface({
8
+ name: 'IGetOptions',
9
+ isExported: true,
10
+ properties: [{ name: 'select', type: 'string[]', hasQuestionToken: true }],
11
+ });
12
+ sourceFile.addInterface({
13
+ name: 'IGetAllOptions',
14
+ isExported: true,
15
+ properties: [
16
+ { name: 'maxPageSize', type: 'number', hasQuestionToken: true },
17
+ { name: 'select', type: 'string[]', hasQuestionToken: true },
18
+ { name: 'filter', type: 'string', hasQuestionToken: true },
19
+ { name: 'orderBy', type: 'string[]', hasQuestionToken: true },
20
+ { name: 'top', type: 'number', hasQuestionToken: true },
21
+ { name: 'skip', type: 'number', hasQuestionToken: true },
22
+ { name: 'skipToken', type: 'string', hasQuestionToken: true },
23
+ ],
24
+ });
25
+ }
26
+ export default generateCommonModels;
27
+ //# sourceMappingURL=generateCommonModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCommonModels.js","sourceRoot":"","sources":["../../src/Tabular/generateCommonModels.ts"],"names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"}
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ICodegenContext } from '../shared/types.js';
5
+ import type { JsonObject } from '../types.js';
6
+ interface GenerateTabularModelContext {
7
+ parentContext: ICodegenContext;
8
+ schema: JsonObject;
9
+ modelFilePath: string;
10
+ }
11
+ export declare function generateTabularModel({ parentContext, schema, modelFilePath, }: GenerateTabularModelContext): Promise<{
12
+ primaryKey: string;
13
+ }>;
14
+ export default generateTabularModel;
15
+ //# sourceMappingURL=generateTabularModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateTabularModel.d.ts","sourceRoot":"","sources":["../../src/Tabular/generateTabularModel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,2BAA2B;IACnC,aAAa,EAAE,eAAe,CAAC;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,oBAAoB,CAAC,EACzC,aAAa,EACb,MAAM,EACN,aAAa,GACd,EAAE,2BAA2B,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B/D;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { convertToValidIdentifier } from '../shared/nameUtils.js';
5
+ import { getRequiredFields, getTabularItemsFromSchema, isJsonObject } from '../shared/schemaUtils.js';
6
+ import { buildInterfaceProperties } from '../shared/typeUtils.js';
7
+ export async function generateTabularModel({ parentContext, schema, modelFilePath, }) {
8
+ const { modelName, project } = parentContext;
9
+ const items = getTabularItemsFromSchema(schema);
10
+ let propertiesNode = {};
11
+ if (isJsonObject(items.properties)) {
12
+ propertiesNode = items.properties;
13
+ }
14
+ const requiredFields = getRequiredFields(items);
15
+ let primaryKey = '';
16
+ for (const [propName, propValue] of Object.entries(propertiesNode)) {
17
+ if (isJsonObject(propValue) && propValue['x-ms-keyType'] === 'primary') {
18
+ primaryKey = propName;
19
+ break;
20
+ }
21
+ }
22
+ const sourceFile = await project.createFile('model', modelFilePath, '');
23
+ sourceFile.addInterface({
24
+ name: convertToValidIdentifier(modelName),
25
+ isExported: true,
26
+ properties: buildInterfaceProperties(propertiesNode, requiredFields, modelName),
27
+ });
28
+ return { primaryKey };
29
+ }
30
+ export default generateTabularModel;
31
+ //# sourceMappingURL=generateTabularModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateTabularModel.js","sourceRoot":"","sources":["../../src/Tabular/generateTabularModel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAS/D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,aAAa,EACb,MAAM,EACN,aAAa,GACe;IAC5B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;IAE7C,MAAM,KAAK,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAEhD,IAAI,cAAc,GAAe,EAAE,CAAC;IACpC,IAAI,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACnC,cAAc,GAAG,KAAK,CAAC,UAAwB,CAAC;IAClD,CAAC;IAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEhD,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnE,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE,CAAC;YACvE,UAAU,GAAG,QAAQ,CAAC;YACtB,MAAM;QACR,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IAExE,UAAU,CAAC,YAAY,CAAC;QACtB,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC;QACzC,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,wBAAwB,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,CAAC;KAChF,CAAC,CAAC;IAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ICodegenContext } from '../shared/types.js';
5
+ interface GenerateTabularServiceContext {
6
+ parentContext: ICodegenContext;
7
+ serviceFilePath: string;
8
+ dataSourcesFilePath: string;
9
+ primaryKey: string;
10
+ /** Override write-side type name. Defaults to `modelName` (pure tabular). SharePoint passes `${modelName}Write` or `${modelName}Base`. */
11
+ writeType?: string;
12
+ /** Override read-side type name. Defaults to `modelName` (pure tabular). SharePoint passes `${modelName}Read` or `${modelName}Base`. */
13
+ readType?: string;
14
+ /** Emit the SharePoint-only `getReferencedEntity` method. Always true for SharePoint schemas, never for tabular. */
15
+ addGetReferencedEntity?: boolean;
16
+ }
17
+ export declare function generateTabularService({ parentContext, serviceFilePath, dataSourcesFilePath, primaryKey, writeType, readType, addGetReferencedEntity, }: GenerateTabularServiceContext): Promise<void>;
18
+ export default generateTabularService;
19
+ //# sourceMappingURL=generateTabularService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateTabularService.d.ts","sourceRoot":"","sources":["../../src/Tabular/generateTabularService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,UAAU,6BAA6B;IACrC,aAAa,EAAE,eAAe,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,0IAA0I;IAC1I,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wIAAwI;IACxI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oHAAoH;IACpH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,sBAAsB,GACvB,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CA0K/C;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,165 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { Scope } from 'ts-morph';
5
+ import { convertToValidIdentifier } from '../shared/nameUtils.js';
6
+ export async function generateTabularService({ parentContext, serviceFilePath, dataSourcesFilePath, primaryKey, writeType, readType, addGetReferencedEntity, }) {
7
+ const { modelName, dataSourceName, project } = parentContext;
8
+ const resolvedWriteType = writeType ?? convertToValidIdentifier(modelName);
9
+ const resolvedReadType = readType ?? convertToValidIdentifier(modelName);
10
+ const isSharepoint = addGetReferencedEntity === true;
11
+ const serviceName = `${convertToValidIdentifier(modelName)}Service`;
12
+ const createParamType = primaryKey !== '' ? `Omit<${resolvedWriteType}, '${primaryKey}'>` : resolvedWriteType;
13
+ const updateParamType = primaryKey !== ''
14
+ ? `Partial<Omit<${resolvedWriteType}, '${primaryKey}'>>`
15
+ : isSharepoint
16
+ ? resolvedWriteType
17
+ : `Partial<${resolvedWriteType}>`;
18
+ const sourceFile = await project.createFile('service', serviceFilePath, '');
19
+ sourceFile.addImportDeclaration({
20
+ moduleSpecifier: '@microsoft/managed-apps/data',
21
+ namedImports: ['getClient'],
22
+ });
23
+ sourceFile.addImportDeclaration({
24
+ moduleSpecifier: '@microsoft/managed-apps/data',
25
+ namedImports: ['IOperationResult'],
26
+ isTypeOnly: true,
27
+ });
28
+ sourceFile.addImportDeclaration({
29
+ moduleSpecifier: dataSourcesFilePath,
30
+ defaultImport: 'dataSources',
31
+ });
32
+ sourceFile.addImportDeclaration({
33
+ moduleSpecifier: sourceFile.getRelativePathAsModuleSpecifierTo(project.getSourceFile('commonModel')),
34
+ namedImports: ['IGetAllOptions', 'IGetOptions'],
35
+ isTypeOnly: true,
36
+ });
37
+ const modelTypeImports = resolvedWriteType !== resolvedReadType
38
+ ? [resolvedWriteType, resolvedReadType]
39
+ : [resolvedReadType];
40
+ sourceFile.addImportDeclaration({
41
+ moduleSpecifier: sourceFile.getRelativePathAsModuleSpecifierTo(project.getSourceFile('model')),
42
+ namedImports: modelTypeImports,
43
+ isTypeOnly: true,
44
+ });
45
+ sourceFile.addClass({
46
+ name: serviceName,
47
+ isExported: true,
48
+ properties: [
49
+ {
50
+ name: 'dataSourceName',
51
+ isStatic: true,
52
+ isReadonly: true,
53
+ scope: Scope.Private,
54
+ initializer: `'${dataSourceName.toLowerCase()}'`,
55
+ },
56
+ {
57
+ name: 'client',
58
+ isStatic: true,
59
+ isReadonly: true,
60
+ scope: Scope.Private,
61
+ initializer: 'getClient(dataSources)',
62
+ },
63
+ ],
64
+ methods: [
65
+ {
66
+ name: 'create',
67
+ isStatic: true,
68
+ isAsync: true,
69
+ scope: Scope.Public,
70
+ parameters: [{ name: 'record', type: createParamType }],
71
+ returnType: `Promise<IOperationResult<${resolvedReadType}>>`,
72
+ statements: [
73
+ `const result = await ${serviceName}.client.createRecordAsync<${createParamType}, ${resolvedReadType}>(${serviceName}.dataSourceName, record);`,
74
+ 'return result;',
75
+ ],
76
+ },
77
+ {
78
+ name: 'update',
79
+ isStatic: true,
80
+ isAsync: true,
81
+ scope: Scope.Public,
82
+ parameters: [
83
+ { name: 'id', type: 'string' },
84
+ { name: 'changedFields', type: updateParamType },
85
+ ],
86
+ returnType: `Promise<IOperationResult<${resolvedReadType}>>`,
87
+ statements: [
88
+ `const result = await ${serviceName}.client.updateRecordAsync<${updateParamType}, ${resolvedReadType}>(${serviceName}.dataSourceName, id, changedFields);`,
89
+ 'return result;',
90
+ ],
91
+ },
92
+ {
93
+ name: 'delete',
94
+ isStatic: true,
95
+ isAsync: true,
96
+ scope: Scope.Public,
97
+ parameters: [{ name: 'id', type: 'string' }],
98
+ returnType: 'Promise<void>',
99
+ statements: [
100
+ `await ${serviceName}.client.deleteRecordAsync(${serviceName}.dataSourceName, id);`,
101
+ ],
102
+ },
103
+ {
104
+ name: 'get',
105
+ isStatic: true,
106
+ isAsync: true,
107
+ scope: Scope.Public,
108
+ parameters: [
109
+ { name: 'id', type: 'string' },
110
+ { name: 'options', type: 'IGetOptions', hasQuestionToken: true },
111
+ ],
112
+ returnType: `Promise<IOperationResult<${resolvedReadType}>>`,
113
+ statements: [
114
+ `const result = await ${serviceName}.client.retrieveRecordAsync<${resolvedReadType}>(${serviceName}.dataSourceName, id, options);`,
115
+ 'return result;',
116
+ ],
117
+ },
118
+ {
119
+ name: 'getAll',
120
+ isStatic: true,
121
+ isAsync: true,
122
+ scope: Scope.Public,
123
+ parameters: [{ name: 'options', type: 'IGetAllOptions', hasQuestionToken: true }],
124
+ returnType: `Promise<IOperationResult<${resolvedReadType}[]>>`,
125
+ statements: [
126
+ `const result = await ${serviceName}.client.retrieveMultipleRecordsAsync<${resolvedReadType}>(${serviceName}.dataSourceName, options);`,
127
+ 'return result;',
128
+ ],
129
+ },
130
+ ...(addGetReferencedEntity
131
+ ? [
132
+ {
133
+ name: 'getReferencedEntity',
134
+ isStatic: true,
135
+ isAsync: true,
136
+ scope: Scope.Public,
137
+ parameters: [
138
+ { name: 'search', type: 'string' },
139
+ { name: 'referencedEntityKeyNormalized', type: 'string' },
140
+ ],
141
+ returnType: 'Promise<IOperationResult<unknown>>',
142
+ statements: [
143
+ `const params: { search: string } = { search };`,
144
+ `const result = await ${serviceName}.client.executeAsync<{ search: string }, unknown>({`,
145
+ ` connectorOperation: {`,
146
+ ` tableName: ${serviceName}.dataSourceName,`,
147
+ ` operationName: 'Get' + referencedEntityKeyNormalized,`,
148
+ ` parameters: params,`,
149
+ ` },`,
150
+ `});`,
151
+ `return result;`,
152
+ ],
153
+ docs: [
154
+ {
155
+ description: 'Utility method to get possible values of a referenced entity by its name.',
156
+ },
157
+ ],
158
+ },
159
+ ]
160
+ : []),
161
+ ],
162
+ });
163
+ }
164
+ export default generateTabularService;
165
+ //# sourceMappingURL=generateTabularService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateTabularService.js","sourceRoot":"","sources":["../../src/Tabular/generateTabularService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAgB/D,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,EAC3C,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,sBAAsB,GACQ;IAC9B,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;IAE7D,MAAM,iBAAiB,GAAG,SAAS,IAAI,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,QAAQ,IAAI,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACzE,MAAM,YAAY,GAAG,sBAAsB,KAAK,IAAI,CAAC;IAErD,MAAM,WAAW,GAAG,GAAG,wBAAwB,CAAC,SAAS,CAAC,SAAS,CAAC;IAEpE,MAAM,eAAe,GACnB,UAAU,KAAK,EAAE,CAAC,C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AE,qBAAqB;wBAC3B,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,KAAK,CAAC,MAAM;wBACnB,UAAU,EAAE;4BACV,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAClC,EAAE,IAAI,EAAE,+BAA+B,EAAE,IAAI,EAAE,QAAQ,EAAE;yBAC1D;wBACD,UAAU,EAAE,oCAAoC;wBAChD,UAAU,EAAE;4BACV,gDAAgD;4BAChD,wBAAwB,WAAW,qDAAqD;4BACxF,yBAAyB;4BACzB,kBAAkB,WAAW,kBAAkB;4BAC/C,2DAA2D;4BAC3D,yBAAyB;4BACzB,MAAM;4BACN,KAAK;4BACL,gBAAgB;yBACjB;wBACD,IAAI,EAAE;4BACJ;gCACE,WAAW,EACT,2EAA2E;6BAC9E;yBACF;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { default as generateCommonModels } from './generateCommonModels.js';
5
+ export { default as generateTabularModel } from './generateTabularModel.js';
6
+ export { default as generateTabularService } from './generateTabularService.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tabular/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { default as generateCommonModels } from './generateCommonModels.js';
5
+ export { default as generateTabularModel } from './generateTabularModel.js';
6
+ export { default as generateTabularService } from './generateTabularService.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Tabular/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type prettier from 'prettier';
5
+ export declare const defaultPrettierConfig: prettier.Options;
6
+ //# sourceMappingURL=defaultPrettierConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultPrettierConfig.d.ts","sourceRoot":"","sources":["../src/defaultPrettierConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,OAK5C,CAAC"}
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export const defaultPrettierConfig = {
5
+ endOfLine: 'auto',
6
+ printWidth: 100,
7
+ singleQuote: true,
8
+ trailingComma: 'es5',
9
+ };
10
+ //# sourceMappingURL=defaultPrettierConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultPrettierConfig.js","sourceRoot":"","sources":["../src/defaultPrettierConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;CACrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { CodegenProject } from './CodegenProject.js';
5
+ export { defaultPrettierConfig } from './defaultPrettierConfig.js';
6
+ export { GENERATED_FOLDERNAME } from './shared/constants.js';
7
+ export { isLogicFlowSchema, LOGIC_FLOWS_API_ID } from './shared/flowUtils.js';
8
+ export type { FileIdentifier, ICodegenProject } from './shared/project.js';
9
+ export { getTabularItemsFromSchema, isJsonObject, isSharepointChoiceColumn, isSharepointSchema, } from './shared/schemaUtils.js';
10
+ export { getSqlStoredProcApiKey, isSqlStoredProcedure } from './shared/sqlStoredProcUtils.js';
11
+ export { hasPaths } from './shared/swaggerUtils.js';
12
+ export type { ICodegenContext } from './shared/types.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ export { CodegenProject } from './CodegenProject.js';
5
+ export { defaultPrettierConfig } from './defaultPrettierConfig.js';
6
+ export { GENERATED_FOLDERNAME } from './shared/constants.js';
7
+ export { isLogicFlowSchema, LOGIC_FLOWS_API_ID } from './shared/flowUtils.js';
8
+ export { getTabularItemsFromSchema, isJsonObject, isSharepointChoiceColumn, isSharepointSchema, } from './shared/schemaUtils.js';
9
+ export { getSqlStoredProcApiKey, isSqlStoredProcedure } from './shared/sqlStoredProcUtils.js';
10
+ export { hasPaths } from './shared/swaggerUtils.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Name of the folder where codegen output (models, services, dataSources.ts) is written.
6
+ * Located directly under the project root (e.g. `<projectRoot>/generated/`).
7
+ */
8
+ export declare const GENERATED_FOLDERNAME = "generated";
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Name of the folder where codegen output (models, services, dataSources.ts) is written.
6
+ * Located directly under the project root (e.g. `<projectRoot>/generated/`).
7
+ */
8
+ export const GENERATED_FOLDERNAME = 'generated';
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC"}
@@ -0,0 +1,61 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { JsonObject } from '../types.js';
5
+ /** Returns true if the schema root represents a Dataverse entity table. */
6
+ export declare function isDataverseEntity(root: unknown): boolean;
7
+ /** Returns the Dataverse entity set name for a schema (used as the OData API path), or null if not defined. */
8
+ export declare function getDataverseEntitySetName(root: unknown): string | null;
9
+ /** Returns true if the property is a Dataverse lookup relationship to another table. */
10
+ export declare function isDataverseLookupProperty(propValue: JsonObject): boolean;
11
+ /** Collects all lookup relationship columns from a properties node, keyed by property name. */
12
+ export declare function getDataverseLookupColumns(propertiesNode: JsonObject): Map<string, JsonObject>;
13
+ /** Returns true if the property is an auto-generated name field for a lookup column (e.g. `owneridname` for `ownerid`). */
14
+ export declare function isLookupRelatedProperty(propName: string, lookupColumns: Map<string, unknown>): boolean;
15
+ /** Returns the write-form property name for a lookup column, used when creating or updating Dataverse records. */
16
+ export declare function generateODataBindPropertyName(schemaName: string): string;
17
+ /** Returns the read-form property name for a lookup's resolved GUID value. */
18
+ export declare function generateLookupValuePropertyName(lookupPropertyName: string): string;
19
+ /**
20
+ * Returns true if the property is a Dataverse boolean (yes/no) field.
21
+ * These fields have enum/x-ms-enum-values in the schema but must be typed as `boolean`,
22
+ * not as a numeric optionset, because the Dataverse Web API expects true/false.
23
+ */
24
+ export declare function isDataverseBooleanProperty(propValue: JsonObject): boolean;
25
+ /**
26
+ * Returns true if the property is a Dataverse numeric field (integer, decimal, double, money, bigint).
27
+ * These fields have `"type": "string"` in the schema but must be typed as `number` because
28
+ * the Dataverse Web API sends and receives them as JSON numbers.
29
+ */
30
+ export declare function isDataverseNumericProperty(propValue: JsonObject): boolean;
31
+ /**
32
+ * Returns true if the property is a Dataverse multi-select picklist (multi-choice) field.
33
+ * These fields allow multiple selections and should be typed as an array of the enum type.
34
+ */
35
+ export declare function isDataverseMultiSelectPicklistProperty(propValue: JsonObject): boolean;
36
+ /**
37
+ * Returns the names of all MultiSelectPicklist (multi-choice) properties in a Dataverse entity
38
+ * properties node — i.e., properties that have optionset data AND are typed as MultiSelectPicklistType.
39
+ * These fields require serialization (array → comma-separated string) when writing to the Dataverse API
40
+ * and deserialization (comma-separated string → array) when reading back from it.
41
+ */
42
+ export declare function getDataverseMultiSelectPicklistFields(propertiesNode: JsonObject): string[];
43
+ /** Returns true if the property represents an optionset (choice) column with enumerable values. */
44
+ export declare function hasOptionsetData(propValue: JsonObject): boolean;
45
+ type GenericColumn = {
46
+ type: 'lookupRelated' | 'normal';
47
+ propName: string;
48
+ propValue: JsonObject;
49
+ readOnly: boolean;
50
+ };
51
+ type LookupColumn = {
52
+ type: 'lookup';
53
+ propName: string;
54
+ propValue: JsonObject;
55
+ readOnly: boolean;
56
+ schemaName: string;
57
+ };
58
+ /** Yields each property in a Dataverse entity's properties node, tagged by its role and mutability, for use in interface generation. */
59
+ export declare function iterateDataverseProperties(propertiesNode: JsonObject, lookupColumns: Map<string, JsonObject>): Generator<GenericColumn | LookupColumn>;
60
+ export {};
61
+ //# sourceMappingURL=dataverseUtils.d.ts.map