@microsoft/apps 0.0.1 → 0.4.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/dist/app/App.Types.d.ts +28 -0
- package/dist/app/App.Types.d.ts.map +1 -0
- package/dist/app/App.Types.js +5 -0
- package/dist/app/App.Types.js.map +1 -0
- package/dist/app/Config.d.ts +6 -0
- package/dist/app/Config.d.ts.map +1 -0
- package/dist/app/Config.js +10 -0
- package/dist/app/Config.js.map +1 -0
- package/dist/app/ContextProvider.d.ts +6 -0
- package/dist/app/ContextProvider.d.ts.map +1 -0
- package/dist/app/ContextProvider.js +36 -0
- package/dist/app/ContextProvider.js.map +1 -0
- package/dist/app/index.d.ts +7 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +6 -0
- package/dist/app/index.js.map +1 -0
- package/dist/data/getClient.d.ts +6 -0
- package/dist/data/getClient.d.ts.map +1 -0
- package/dist/data/getClient.js +14 -0
- package/dist/data/getClient.js.map +1 -0
- package/dist/data/index.d.ts +7 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +6 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/metadata/dataverse/dataverseMetadata.d.ts +408 -0
- package/dist/data/metadata/dataverse/dataverseMetadata.d.ts.map +1 -0
- package/dist/data/metadata/dataverse/dataverseMetadata.js +118 -0
- package/dist/data/metadata/dataverse/dataverseMetadata.js.map +1 -0
- package/dist/data/metadata/dataverse/index.d.ts +6 -0
- package/dist/data/metadata/dataverse/index.d.ts.map +1 -0
- package/dist/data/metadata/dataverse/index.js +5 -0
- package/dist/data/metadata/dataverse/index.js.map +1 -0
- package/dist/data/multiSelectPicklistUtils.d.ts +34 -0
- package/dist/data/multiSelectPicklistUtils.d.ts.map +1 -0
- package/dist/data/multiSelectPicklistUtils.js +51 -0
- package/dist/data/multiSelectPicklistUtils.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/communication/getAppConnections.d.ts +11 -0
- package/dist/internal/communication/getAppConnections.d.ts.map +1 -0
- package/dist/internal/communication/getAppConnections.js +20 -0
- package/dist/internal/communication/getAppConnections.js.map +1 -0
- package/dist/internal/communication/index.d.ts +11 -0
- package/dist/internal/communication/index.d.ts.map +1 -0
- package/dist/internal/communication/index.js +11 -0
- package/dist/internal/communication/index.js.map +1 -0
- package/dist/internal/communication/sendHttpRequest.d.ts +17 -0
- package/dist/internal/communication/sendHttpRequest.d.ts.map +1 -0
- package/dist/internal/communication/sendHttpRequest.js +21 -0
- package/dist/internal/communication/sendHttpRequest.js.map +1 -0
- package/dist/internal/communication/trackEvent.d.ts +11 -0
- package/dist/internal/communication/trackEvent.d.ts.map +1 -0
- package/dist/internal/communication/trackEvent.js +21 -0
- package/dist/internal/communication/trackEvent.js.map +1 -0
- package/dist/internal/sdkChannel.d.ts +18 -0
- package/dist/internal/sdkChannel.d.ts.map +1 -0
- package/dist/internal/sdkChannel.js +42 -0
- package/dist/internal/sdkChannel.js.map +1 -0
- package/dist/internal/telemetry.d.ts +11 -0
- package/dist/internal/telemetry.d.ts.map +1 -0
- package/dist/internal/telemetry.js +17 -0
- package/dist/internal/telemetry.js.map +1 -0
- package/dist/telemetry/Logger.types.d.ts +16 -0
- package/dist/telemetry/Logger.types.d.ts.map +1 -0
- package/dist/telemetry/Logger.types.js +5 -0
- package/dist/telemetry/Logger.types.js.map +1 -0
- package/dist/telemetry/LoggerManager.d.ts +17 -0
- package/dist/telemetry/LoggerManager.d.ts.map +1 -0
- package/dist/telemetry/LoggerManager.js +40 -0
- package/dist/telemetry/LoggerManager.js.map +1 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/index.js.map +1 -0
- package/package.json +38 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
const entityClusterModeEnum = {
|
|
5
|
+
0: 'Partitioned',
|
|
6
|
+
1: 'Replicated',
|
|
7
|
+
2: 'Local',
|
|
8
|
+
};
|
|
9
|
+
export function getEntityClusterModeName(value) {
|
|
10
|
+
return entityClusterModeEnum[value];
|
|
11
|
+
}
|
|
12
|
+
const ownershipTypeEnum = {
|
|
13
|
+
0: 'None',
|
|
14
|
+
1: 'UserOwned',
|
|
15
|
+
2: 'TeamOwned',
|
|
16
|
+
4: 'BusinessOwned',
|
|
17
|
+
8: 'OrganizationOwned',
|
|
18
|
+
16: 'BusinessParented',
|
|
19
|
+
32: 'Filtered',
|
|
20
|
+
};
|
|
21
|
+
export function getOwnershipTypeName(value) {
|
|
22
|
+
return ownershipTypeEnum[value];
|
|
23
|
+
}
|
|
24
|
+
const privilegeTypeEnum = {
|
|
25
|
+
0: 'None',
|
|
26
|
+
1: 'Create',
|
|
27
|
+
2: 'Read',
|
|
28
|
+
3: 'Write',
|
|
29
|
+
4: 'Delete',
|
|
30
|
+
5: 'Assign',
|
|
31
|
+
6: 'Share',
|
|
32
|
+
7: 'Append',
|
|
33
|
+
8: 'AppendTo',
|
|
34
|
+
};
|
|
35
|
+
export function getPrivilegeTypeName(value) {
|
|
36
|
+
return privilegeTypeEnum[value];
|
|
37
|
+
}
|
|
38
|
+
const attributeTypeCodeEnum = {
|
|
39
|
+
0: 'Boolean',
|
|
40
|
+
1: 'Customer',
|
|
41
|
+
2: 'DateTime',
|
|
42
|
+
3: 'Decimal',
|
|
43
|
+
4: 'Double',
|
|
44
|
+
5: 'Integer',
|
|
45
|
+
6: 'Lookup',
|
|
46
|
+
7: 'Memo',
|
|
47
|
+
8: 'Money',
|
|
48
|
+
9: 'Owner',
|
|
49
|
+
10: 'PartyList',
|
|
50
|
+
11: 'Picklist',
|
|
51
|
+
12: 'State',
|
|
52
|
+
13: 'Status',
|
|
53
|
+
14: 'String',
|
|
54
|
+
15: 'Uniqueidentifier',
|
|
55
|
+
16: 'CalendarRules',
|
|
56
|
+
17: 'Virtual',
|
|
57
|
+
18: 'BigInt',
|
|
58
|
+
19: 'ManagedProperty',
|
|
59
|
+
20: 'EntityName',
|
|
60
|
+
};
|
|
61
|
+
export function getAttributeTypeCodeName(value) {
|
|
62
|
+
return attributeTypeCodeEnum[value];
|
|
63
|
+
}
|
|
64
|
+
const attributeRequiredLevelEnum = {
|
|
65
|
+
0: 'None',
|
|
66
|
+
1: 'SystemRequired',
|
|
67
|
+
2: 'ApplicationRequired',
|
|
68
|
+
3: 'Recommended',
|
|
69
|
+
};
|
|
70
|
+
export function getAttributeRequiredLevelName(value) {
|
|
71
|
+
return attributeRequiredLevelEnum[value];
|
|
72
|
+
}
|
|
73
|
+
const relationshipTypeEnum = {
|
|
74
|
+
0: 'OneToManyRelationship',
|
|
75
|
+
1: 'ManyToManyRelationship',
|
|
76
|
+
};
|
|
77
|
+
export function getRelationshipTypeName(value) {
|
|
78
|
+
return relationshipTypeEnum[value];
|
|
79
|
+
}
|
|
80
|
+
const securityTypesEnum = {
|
|
81
|
+
0: 'None', // No security privileges are checked during create or update operations.
|
|
82
|
+
1: 'Append', // The Append and AppendTo privileges are checked for create or update operations.
|
|
83
|
+
2: 'ParentChild', // Security for the referencing entity record is derived from the referenced entity record.
|
|
84
|
+
8: 'Pointer', // Security for the referencing entity record is derived from a pointer record.
|
|
85
|
+
16: 'Inheritance', // The referencing entity record inherits security from the referenced security record.
|
|
86
|
+
};
|
|
87
|
+
export function getSecurityTypesName(value) {
|
|
88
|
+
return securityTypesEnum[value];
|
|
89
|
+
}
|
|
90
|
+
const associatedMenuBehaviorEnum = {
|
|
91
|
+
0: 'UseCollectionName',
|
|
92
|
+
1: 'UseLabel',
|
|
93
|
+
2: 'DoNotDisplay',
|
|
94
|
+
};
|
|
95
|
+
export function getAssociatedMenuBehaviorName(value) {
|
|
96
|
+
return associatedMenuBehaviorEnum[value];
|
|
97
|
+
}
|
|
98
|
+
const associatedMenuGroupEnum = {
|
|
99
|
+
0: 'Details',
|
|
100
|
+
1: 'Sales',
|
|
101
|
+
2: 'Service',
|
|
102
|
+
3: 'Marketing',
|
|
103
|
+
};
|
|
104
|
+
export function getAssociatedMenuGroupName(value) {
|
|
105
|
+
return associatedMenuGroupEnum[value];
|
|
106
|
+
}
|
|
107
|
+
const cascadeTypeEnum = {
|
|
108
|
+
0: 'NoCascade', // Do nothing.
|
|
109
|
+
1: 'Cascade', // Perform the action on all referencing entity records associated with the referenced entity record.
|
|
110
|
+
2: 'Active', // Perform the action on all active referencing entity records associated with the referenced entity record.
|
|
111
|
+
3: 'UserOwned', // Perform the action on all referencing entity records owned by the same user as the referenced entity record.
|
|
112
|
+
4: 'RemoveLink', // Remove the value of the referencing attribute for all referencing entity records associated with the referenced entity record.
|
|
113
|
+
5: 'Restrict', // Prevent the Referenced entity record from being deleted when referencing entities exist.
|
|
114
|
+
};
|
|
115
|
+
export function getCascadeTypeName(value) {
|
|
116
|
+
return cascadeTypeEnum[value];
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=dataverseMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataverseMetadata.js","sourceRoot":"","sources":["../../../../src/data/metadata/dataverse/dataverseMetadata.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export type { EntityMetadata, GetEntityMetadataOptions } from './dataverseMetadata';
|
|
5
|
+
export { getAssociatedMenuBehaviorName, getAssociatedMenuGroupName, getAttributeRequiredLevelName, getAttributeTypeCodeName, getCascadeTypeName, getEntityClusterModeName, getOwnershipTypeName, getPrivilegeTypeName, getRelationshipTypeName, getSecurityTypesName, } from './dataverseMetadata';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data/metadata/dataverse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export { getAssociatedMenuBehaviorName, getAssociatedMenuGroupName, getAttributeRequiredLevelName, getAttributeTypeCodeName, getCascadeTypeName, getEntityClusterModeName, getOwnershipTypeName, getPrivilegeTypeName, getRelationshipTypeName, getSecurityTypesName, } from './dataverseMetadata';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/metadata/dataverse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Serializes MultiSelectPicklist fields in a Dataverse record before sending to the API.
|
|
6
|
+
*
|
|
7
|
+
* The Dataverse Web API expects MultiSelectPicklist values as comma-separated strings
|
|
8
|
+
* (e.g. `"100,200,300"`), but the generated TypeScript types represent them as number arrays
|
|
9
|
+
* (e.g. `[100, 200, 300]`). This function converts any listed field whose current value is an
|
|
10
|
+
* array into that wire format. An empty array is serialized as `null` because Dataverse rejects
|
|
11
|
+
* an empty string for this column type — `null` is the correct way to clear the field.
|
|
12
|
+
*
|
|
13
|
+
* A shallow copy of the record is returned so the caller's object is not mutated.
|
|
14
|
+
*
|
|
15
|
+
* @param record - The record being sent to `createRecordAsync` or `updateRecordAsync`.
|
|
16
|
+
* @param fields - Names of all MultiSelectPicklist columns declared on this entity.
|
|
17
|
+
* @returns A new record object with array-valued picklist fields replaced by comma-separated strings,
|
|
18
|
+
* or `null` for empty arrays.
|
|
19
|
+
*/
|
|
20
|
+
export declare function serializeMultiSelectPicklistFields(record: Record<string, unknown>, fields: readonly string[]): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Deserializes MultiSelectPicklist fields in a Dataverse record returned from the API.
|
|
23
|
+
*
|
|
24
|
+
* The Dataverse Web API returns MultiSelectPicklist values as comma-separated strings
|
|
25
|
+
* (e.g. `"100,200,300"`), but the generated TypeScript types represent them as number arrays.
|
|
26
|
+
* This function mutates the record in place, converting each listed field from its wire format
|
|
27
|
+
* back to an array. An empty string (`""`) is treated as an empty array.
|
|
28
|
+
*
|
|
29
|
+
* @param record - The record returned by `retrieveRecordAsync` or `retrieveMultipleRecordsAsync`.
|
|
30
|
+
* Mutated in place.
|
|
31
|
+
* @param fields - Names of all MultiSelectPicklist columns declared on this entity.
|
|
32
|
+
*/
|
|
33
|
+
export declare function deserializeMultiSelectPicklistFields(record: Record<string, unknown>, fields: readonly string[]): void;
|
|
34
|
+
//# sourceMappingURL=multiSelectPicklistUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiSelectPicklistUtils.d.ts","sourceRoot":"","sources":["../../src/data/multiSelectPicklistUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,IAAI,CAON"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Serializes MultiSelectPicklist fields in a Dataverse record before sending to the API.
|
|
6
|
+
*
|
|
7
|
+
* The Dataverse Web API expects MultiSelectPicklist values as comma-separated strings
|
|
8
|
+
* (e.g. `"100,200,300"`), but the generated TypeScript types represent them as number arrays
|
|
9
|
+
* (e.g. `[100, 200, 300]`). This function converts any listed field whose current value is an
|
|
10
|
+
* array into that wire format. An empty array is serialized as `null` because Dataverse rejects
|
|
11
|
+
* an empty string for this column type — `null` is the correct way to clear the field.
|
|
12
|
+
*
|
|
13
|
+
* A shallow copy of the record is returned so the caller's object is not mutated.
|
|
14
|
+
*
|
|
15
|
+
* @param record - The record being sent to `createRecordAsync` or `updateRecordAsync`.
|
|
16
|
+
* @param fields - Names of all MultiSelectPicklist columns declared on this entity.
|
|
17
|
+
* @returns A new record object with array-valued picklist fields replaced by comma-separated strings,
|
|
18
|
+
* or `null` for empty arrays.
|
|
19
|
+
*/
|
|
20
|
+
export function serializeMultiSelectPicklistFields(record, fields) {
|
|
21
|
+
const result = { ...record };
|
|
22
|
+
for (const field of fields) {
|
|
23
|
+
if (Array.isArray(result[field])) {
|
|
24
|
+
const arr = result[field];
|
|
25
|
+
// Dataverse requires null (not an empty string) to clear a MultiSelectPicklist field.
|
|
26
|
+
result[field] = arr.length > 0 ? arr.join(',') : null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Deserializes MultiSelectPicklist fields in a Dataverse record returned from the API.
|
|
33
|
+
*
|
|
34
|
+
* The Dataverse Web API returns MultiSelectPicklist values as comma-separated strings
|
|
35
|
+
* (e.g. `"100,200,300"`), but the generated TypeScript types represent them as number arrays.
|
|
36
|
+
* This function mutates the record in place, converting each listed field from its wire format
|
|
37
|
+
* back to an array. An empty string (`""`) is treated as an empty array.
|
|
38
|
+
*
|
|
39
|
+
* @param record - The record returned by `retrieveRecordAsync` or `retrieveMultipleRecordsAsync`.
|
|
40
|
+
* Mutated in place.
|
|
41
|
+
* @param fields - Names of all MultiSelectPicklist columns declared on this entity.
|
|
42
|
+
*/
|
|
43
|
+
export function deserializeMultiSelectPicklistFields(record, fields) {
|
|
44
|
+
for (const field of fields) {
|
|
45
|
+
const value = record[field];
|
|
46
|
+
if (typeof value === 'string') {
|
|
47
|
+
record[field] = value !== '' ? value.split(',').map(Number) : [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=multiSelectPicklistUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiSelectPicklistUtils.js","sourceRoot":"","sources":["../../src/data/multiSelectPicklistUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kCAAkC,CAChD,MAA+B,EAC/B,MAAyB;IAEzB,MAAM,MAAM,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACtD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAa,CAAC;YACtC,sFAAsF;YACtF,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAA+B,EAC/B,MAAyB;IAEzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import * as app from './app/index';
|
|
5
|
+
import * as data from './data/index';
|
|
6
|
+
import * as telemetry from './telemetry/index';
|
|
7
|
+
export { app, data, telemetry };
|
|
8
|
+
//# 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,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import * as app from './app/index';
|
|
5
|
+
import * as data from './data/index';
|
|
6
|
+
import * as telemetry from './telemetry/index';
|
|
7
|
+
export { app, data, telemetry };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { type AppDataSourceConfig } from '@microsoft/apps-common/communication';
|
|
5
|
+
/**
|
|
6
|
+
* Fetch the app's resolved connection configs from the host, keyed by entity
|
|
7
|
+
* (data source) name. Keys are normalized to lowercase to match existing SDK
|
|
8
|
+
* lookup conventions.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAppConnections(): Promise<Record<string, AppDataSourceConfig>>;
|
|
11
|
+
//# sourceMappingURL=getAppConnections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAppConnections.d.ts","sourceRoot":"","sources":["../../../src/internal/communication/getAppConnections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,sCAAsC,CAAC;AAIzF;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAStF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Methods } from '@microsoft/apps-common/communication';
|
|
5
|
+
import { getSdkChannel } from '../sdkChannel';
|
|
6
|
+
/**
|
|
7
|
+
* Fetch the app's resolved connection configs from the host, keyed by entity
|
|
8
|
+
* (data source) name. Keys are normalized to lowercase to match existing SDK
|
|
9
|
+
* lookup conventions.
|
|
10
|
+
*/
|
|
11
|
+
export async function getAppConnections() {
|
|
12
|
+
const channel = await getSdkChannel();
|
|
13
|
+
const result = await channel.send(Methods.Data.getAppConnections);
|
|
14
|
+
const lowercased = {};
|
|
15
|
+
for (const [key, value] of Object.entries(result)) {
|
|
16
|
+
lowercased[key.toLowerCase()] = value;
|
|
17
|
+
}
|
|
18
|
+
return lowercased;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=getAppConnections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAppConnections.js","sourceRoot":"","sources":["../../../src/internal/communication/getAppConnections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA4B,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEzF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAElE,MAAM,UAAU,GAAwC,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IACxC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Centralized JSON-RPC channel helpers. All host-facing calls in this package
|
|
6
|
+
* should go through this folder so the channel surface stays auditable.
|
|
7
|
+
*/
|
|
8
|
+
export { getAppConnections } from './getAppConnections';
|
|
9
|
+
export { sendHttpRequest } from './sendHttpRequest';
|
|
10
|
+
export { trackEvent } from './trackEvent';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/communication/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Centralized JSON-RPC channel helpers. All host-facing calls in this package
|
|
6
|
+
* should go through this folder so the channel surface stays auditable.
|
|
7
|
+
*/
|
|
8
|
+
export { getAppConnections } from './getAppConnections';
|
|
9
|
+
export { sendHttpRequest } from './sendHttpRequest';
|
|
10
|
+
export { trackEvent } from './trackEvent';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/communication/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { type HttpSendParams, type HttpSendResult } from '@microsoft/apps-common/communication';
|
|
5
|
+
/**
|
|
6
|
+
* Send an HTTP request through the host's JSON-RPC channel.
|
|
7
|
+
*
|
|
8
|
+
* The host validates the URL against resolved connection origins, injects
|
|
9
|
+
* the appropriate Authorization header via its auth middleware, and runs
|
|
10
|
+
* the request through retry/circuit-breaker/tracking middleware. Network
|
|
11
|
+
* metrics are reported automatically — the SDK does not need to track them.
|
|
12
|
+
*
|
|
13
|
+
* Binary request bodies should be passed as base64 with `bodyEncoding: 'base64'`.
|
|
14
|
+
* Binary response bodies arrive base64-encoded with `bodyEncoding: 'base64'`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sendHttpRequest(params: HttpSendParams): Promise<HttpSendResult>;
|
|
17
|
+
//# sourceMappingURL=sendHttpRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendHttpRequest.d.ts","sourceRoot":"","sources":["../../../src/internal/communication/sendHttpRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEpB,MAAM,sCAAsC,CAAC;AAI9C;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAGrF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Methods, } from '@microsoft/apps-common/communication';
|
|
5
|
+
import { getSdkChannel } from '../sdkChannel';
|
|
6
|
+
/**
|
|
7
|
+
* Send an HTTP request through the host's JSON-RPC channel.
|
|
8
|
+
*
|
|
9
|
+
* The host validates the URL against resolved connection origins, injects
|
|
10
|
+
* the appropriate Authorization header via its auth middleware, and runs
|
|
11
|
+
* the request through retry/circuit-breaker/tracking middleware. Network
|
|
12
|
+
* metrics are reported automatically — the SDK does not need to track them.
|
|
13
|
+
*
|
|
14
|
+
* Binary request bodies should be passed as base64 with `bodyEncoding: 'base64'`.
|
|
15
|
+
* Binary response bodies arrive base64-encoded with `bodyEncoding: 'base64'`.
|
|
16
|
+
*/
|
|
17
|
+
export async function sendHttpRequest(params) {
|
|
18
|
+
const channel = await getSdkChannel();
|
|
19
|
+
return channel.send(Methods.Http.send, params);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sendHttpRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendHttpRequest.js","sourceRoot":"","sources":["../../../src/internal/communication/sendHttpRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,OAAO,GACR,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAsB;IAC1D,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;IACtC,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Send a structured telemetry event to the host.
|
|
6
|
+
*
|
|
7
|
+
* Fire-and-forget. Errors during the call (channel unavailable, etc.) are
|
|
8
|
+
* swallowed so logger failures never break the app.
|
|
9
|
+
*/
|
|
10
|
+
export declare function trackEvent(eventName: string, properties?: Record<string, unknown>): void;
|
|
11
|
+
//# sourceMappingURL=trackEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackEvent.d.ts","sourceRoot":"","sources":["../../../src/internal/communication/trackEvent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAQxF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Methods } from '@microsoft/apps-common/communication';
|
|
5
|
+
import { getSdkChannel } from '../sdkChannel';
|
|
6
|
+
/**
|
|
7
|
+
* Send a structured telemetry event to the host.
|
|
8
|
+
*
|
|
9
|
+
* Fire-and-forget. Errors during the call (channel unavailable, etc.) are
|
|
10
|
+
* swallowed so logger failures never break the app.
|
|
11
|
+
*/
|
|
12
|
+
export function trackEvent(eventName, properties) {
|
|
13
|
+
getSdkChannel()
|
|
14
|
+
.then((channel) => {
|
|
15
|
+
channel.notify(Methods.Telemetry.trackEvent, { eventName, properties });
|
|
16
|
+
})
|
|
17
|
+
.catch(() => {
|
|
18
|
+
// Channel unavailable — silently degrade.
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=trackEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackEvent.js","sourceRoot":"","sources":["../../../src/internal/communication/trackEvent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,UAAoC;IAChF,aAAa,EAAE;SACZ,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAChB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,0CAA0C;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { type Channel } from '@microsoft/apps-common/communication';
|
|
5
|
+
/**
|
|
6
|
+
* Get or create the App SDK's dedicated channel to the host.
|
|
7
|
+
*
|
|
8
|
+
* When `window.__platformBridge` is available (runtime — bridge script injected
|
|
9
|
+
* by the gateway), the bridge's `initialize()` method creates the channel.
|
|
10
|
+
*
|
|
11
|
+
* When the bridge is absent (authoring — no bridge script), the SDK falls back
|
|
12
|
+
* to creating a MessageChannel directly and transferring a port to the host
|
|
13
|
+
* via `window.parent.postMessage`.
|
|
14
|
+
*
|
|
15
|
+
* The channel is cached — subsequent calls return the same instance.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSdkChannel(): Promise<Channel>;
|
|
18
|
+
//# sourceMappingURL=sdkChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkChannel.d.ts","sourceRoot":"","sources":["../../src/internal/sdkChannel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,sCAAsC,CAAC;AAI9C;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAKhD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { createChannelReceiver, MessagePortChannel, PortTransferType, transferPort, } from '@microsoft/apps-common/communication';
|
|
5
|
+
let sdkChannelPromise = null;
|
|
6
|
+
/**
|
|
7
|
+
* Get or create the App SDK's dedicated channel to the host.
|
|
8
|
+
*
|
|
9
|
+
* When `window.__platformBridge` is available (runtime — bridge script injected
|
|
10
|
+
* by the gateway), the bridge's `initialize()` method creates the channel.
|
|
11
|
+
*
|
|
12
|
+
* When the bridge is absent (authoring — no bridge script), the SDK falls back
|
|
13
|
+
* to creating a MessageChannel directly and transferring a port to the host
|
|
14
|
+
* via `window.parent.postMessage`.
|
|
15
|
+
*
|
|
16
|
+
* The channel is cached — subsequent calls return the same instance.
|
|
17
|
+
*/
|
|
18
|
+
export function getSdkChannel() {
|
|
19
|
+
if (!sdkChannelPromise) {
|
|
20
|
+
sdkChannelPromise = initSdkChannel();
|
|
21
|
+
}
|
|
22
|
+
return sdkChannelPromise;
|
|
23
|
+
}
|
|
24
|
+
async function initSdkChannel() {
|
|
25
|
+
// Create a receiver for host → SDK actions (subscriptions, push updates)
|
|
26
|
+
const sdkReceiver = createChannelReceiver();
|
|
27
|
+
if (window.__platformBridge) {
|
|
28
|
+
// Runtime: bridge script is injected, use it
|
|
29
|
+
return window.__platformBridge.connect(sdkReceiver);
|
|
30
|
+
}
|
|
31
|
+
// Authoring fallback: no bridge script, self-initialize via window.parent
|
|
32
|
+
const { port1, port2 } = new MessageChannel();
|
|
33
|
+
transferPort(window.parent, port2, PortTransferType.SdkPort, '*');
|
|
34
|
+
const channel = new MessagePortChannel(port1, {
|
|
35
|
+
receiver: sdkReceiver,
|
|
36
|
+
component: 'app-sdk',
|
|
37
|
+
componentVersion: '0.1.0',
|
|
38
|
+
});
|
|
39
|
+
await channel.connect();
|
|
40
|
+
return channel;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=sdkChannel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkChannel.js","sourceRoot":"","sources":["../../src/internal/sdkChannel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,sCAAsC,CAAC;AAE9C,IAAI,iBAAiB,GAA4B,IAAI,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,iBAAiB,GAAG,cAAc,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,KAAK,UAAU,cAAc;IAC3B,yEAAyE;IACzE,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,6CAA6C;QAC7C,OAAO,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC;IAED,0EAA0E;IAC1E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,cAAc,EAAE,CAAC;IAE9C,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,KAAK,EAAE;QAC5C,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Send a telemetry event to the host.
|
|
6
|
+
*
|
|
7
|
+
* Fire-and-forget — does not await channel readiness synchronously.
|
|
8
|
+
* The event is queued if the channel isn't ready yet.
|
|
9
|
+
*/
|
|
10
|
+
export declare function trackEvent(eventName: string, properties?: Record<string, unknown>): void;
|
|
11
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/internal/telemetry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAIxF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Methods } from '@microsoft/apps-common/communication';
|
|
5
|
+
import { getSdkChannel } from './sdkChannel';
|
|
6
|
+
/**
|
|
7
|
+
* Send a telemetry event to the host.
|
|
8
|
+
*
|
|
9
|
+
* Fire-and-forget — does not await channel readiness synchronously.
|
|
10
|
+
* The event is queued if the channel isn't ready yet.
|
|
11
|
+
*/
|
|
12
|
+
export function trackEvent(eventName, properties) {
|
|
13
|
+
getSdkChannel().then((channel) => {
|
|
14
|
+
channel.notify(Methods.Telemetry.trackEvent, { eventName, properties });
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/internal/telemetry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,UAAoC;IAChF,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAC/B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { Metric } from '@microsoft/apps-common/metrics';
|
|
5
|
+
/**
|
|
6
|
+
* Developer-facing logger interface.
|
|
7
|
+
*
|
|
8
|
+
* App developers provide an implementation via initializeLogger() or setConfig().
|
|
9
|
+
* The logger receives structured metrics streamed from the host (session load,
|
|
10
|
+
* network requests, data request summaries).
|
|
11
|
+
*/
|
|
12
|
+
export interface ILogger {
|
|
13
|
+
/** Receive a structured metric from the host. */
|
|
14
|
+
logMetric?(value: Metric): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Logger.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.types.d.ts","sourceRoot":"","sources":["../../src/telemetry/Logger.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,iDAAiD;IACjD,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.types.js","sourceRoot":"","sources":["../../src/telemetry/Logger.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { ILogger } from './Logger.types';
|
|
5
|
+
/**
|
|
6
|
+
* Initialize the developer logger and subscribe to host metric streaming.
|
|
7
|
+
*
|
|
8
|
+
* When called, the SDK subscribes to Telemetry.subscribeMetrics via the
|
|
9
|
+
* channel's stream() method. The host yields metrics as they're collected
|
|
10
|
+
* (network requests, session load, data request summaries). Each metric
|
|
11
|
+
* is forwarded to the developer's ILogger.logMetric().
|
|
12
|
+
*
|
|
13
|
+
* The subscription runs in the background — this function starts the
|
|
14
|
+
* stream consumer and returns immediately.
|
|
15
|
+
*/
|
|
16
|
+
export declare function initializeLogger(logger: ILogger): void;
|
|
17
|
+
//# sourceMappingURL=LoggerManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoggerManager.d.ts","sourceRoot":"","sources":["../../src/telemetry/LoggerManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAKtD"}
|