@azure/communication-common 2.4.2-alpha.20260210.1 → 2.4.2

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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  3. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  4. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  5. package/dist/browser/entraTokenCredential.d.ts.map +1 -1
  6. package/dist/browser/entraTokenCredential.js +12 -7
  7. package/dist/browser/entraTokenCredential.js.map +1 -1
  8. package/dist/browser/index.d.ts +3 -3
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/commonjs/autoRefreshTokenCredential.js +110 -95
  12. package/dist/commonjs/autoRefreshTokenCredential.js.map +7 -1
  13. package/dist/commonjs/azureCommunicationTokenCredential.js +64 -47
  14. package/dist/commonjs/azureCommunicationTokenCredential.js.map +7 -1
  15. package/dist/commonjs/communicationTokenCredential.js +16 -5
  16. package/dist/commonjs/communicationTokenCredential.js.map +7 -1
  17. package/dist/commonjs/credential/clientArguments.js +46 -40
  18. package/dist/commonjs/credential/clientArguments.js.map +7 -1
  19. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  20. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js +53 -42
  21. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js.map +7 -1
  22. package/dist/commonjs/credential/communicationAuthPolicy.js +39 -26
  23. package/dist/commonjs/credential/communicationAuthPolicy.js.map +7 -1
  24. package/dist/commonjs/credential/connectionString.js +39 -28
  25. package/dist/commonjs/credential/connectionString.js.map +7 -1
  26. package/dist/commonjs/credential/index.js +28 -10
  27. package/dist/commonjs/credential/index.js.map +7 -1
  28. package/dist/commonjs/entraTokenCredential.d.ts.map +1 -1
  29. package/dist/commonjs/entraTokenCredential.js +137 -113
  30. package/dist/commonjs/entraTokenCredential.js.map +7 -1
  31. package/dist/commonjs/identifierModelSerializer.js +172 -159
  32. package/dist/commonjs/identifierModelSerializer.js.map +7 -1
  33. package/dist/commonjs/identifierModels.js +183 -205
  34. package/dist/commonjs/identifierModels.js.map +7 -1
  35. package/dist/commonjs/index.d.ts +3 -3
  36. package/dist/commonjs/index.d.ts.map +1 -1
  37. package/dist/commonjs/index.js +35 -12
  38. package/dist/commonjs/index.js.map +7 -1
  39. package/dist/commonjs/staticTokenCredential.js +36 -20
  40. package/dist/commonjs/staticTokenCredential.js.map +7 -1
  41. package/dist/commonjs/tokenParser.js +33 -13
  42. package/dist/commonjs/tokenParser.js.map +7 -1
  43. package/dist/commonjs/tsdoc-metadata.json +1 -1
  44. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  45. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  46. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  47. package/dist/esm/entraTokenCredential.d.ts.map +1 -1
  48. package/dist/esm/entraTokenCredential.js +12 -7
  49. package/dist/esm/entraTokenCredential.js.map +1 -1
  50. package/dist/esm/index.d.ts +3 -3
  51. package/dist/esm/index.d.ts.map +1 -1
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  54. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  55. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  56. package/dist/react-native/entraTokenCredential.d.ts.map +1 -1
  57. package/dist/react-native/entraTokenCredential.js +12 -7
  58. package/dist/react-native/entraTokenCredential.js.map +1 -1
  59. package/dist/react-native/index.d.ts +3 -3
  60. package/dist/react-native/index.d.ts.map +1 -1
  61. package/dist/react-native/index.js.map +1 -1
  62. package/package.json +30 -37
  63. package/dist/browser/credential/cryptoUtils-browser.d.mts.map +0 -1
  64. package/dist/browser/credential/cryptoUtils-browser.mjs.map +0 -1
  65. package/dist/browser/credential/cryptoUtils.d.ts +0 -3
  66. package/dist/browser/credential/cryptoUtils.js +0 -19
  67. package/dist/browser/credential/encodeUtils-browser.d.mts +0 -4
  68. package/dist/browser/credential/encodeUtils-browser.d.mts.map +0 -1
  69. package/dist/browser/credential/encodeUtils-browser.mjs +0 -19
  70. package/dist/browser/credential/encodeUtils-browser.mjs.map +0 -1
  71. package/dist/commonjs/credential/cryptoUtils.d.ts +0 -3
  72. package/dist/commonjs/credential/cryptoUtils.d.ts.map +0 -1
  73. package/dist/commonjs/credential/cryptoUtils.js +0 -14
  74. package/dist/commonjs/credential/cryptoUtils.js.map +0 -1
  75. package/dist/esm/credential/cryptoUtils.d.ts +0 -3
  76. package/dist/esm/credential/cryptoUtils.d.ts.map +0 -1
  77. package/dist/esm/credential/cryptoUtils.js +0 -9
  78. package/dist/esm/credential/cryptoUtils.js.map +0 -1
  79. package/dist/esm/credential/encodeUtils-browser.d.mts +0 -4
  80. package/dist/esm/credential/encodeUtils-browser.d.mts.map +0 -1
  81. package/dist/esm/credential/encodeUtils-browser.mjs +0 -19
  82. package/dist/esm/credential/encodeUtils-browser.mjs.map +0 -1
  83. package/dist/react-native/credential/cryptoUtils.d.ts +0 -3
  84. package/dist/react-native/credential/cryptoUtils.d.ts.map +0 -1
  85. package/dist/react-native/credential/cryptoUtils.js +0 -9
  86. package/dist/react-native/credential/cryptoUtils.js.map +0 -1
  87. package/dist/react-native/credential/encodeUtils-browser.d.mts +0 -4
  88. package/dist/react-native/credential/encodeUtils-browser.d.mts.map +0 -1
  89. package/dist/react-native/credential/encodeUtils-browser.mjs +0 -19
  90. package/dist/react-native/credential/encodeUtils-browser.mjs.map +0 -1
@@ -1,235 +1,213 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createIdentifierFromRawId = exports.getIdentifierRawId = exports.getIdentifierKind = exports.isUnknownIdentifier = exports.isTeamsExtensionUserIdentifier = exports.isMicrosoftTeamsAppIdentifier = exports.isMicrosoftTeamsUserIdentifier = exports.isPhoneNumberIdentifier = exports.isCommunicationUserIdentifier = void 0;
6
- /**
7
- * Tests an Identifier to determine whether it implements CommunicationUserIdentifier.
8
- *
9
- * @param identifier - The assumed CommunicationUserIdentifier to be tested.
10
- */
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var identifierModels_exports = {};
19
+ __export(identifierModels_exports, {
20
+ createIdentifierFromRawId: () => createIdentifierFromRawId,
21
+ getIdentifierKind: () => getIdentifierKind,
22
+ getIdentifierRawId: () => getIdentifierRawId,
23
+ isCommunicationUserIdentifier: () => isCommunicationUserIdentifier,
24
+ isMicrosoftTeamsAppIdentifier: () => isMicrosoftTeamsAppIdentifier,
25
+ isMicrosoftTeamsUserIdentifier: () => isMicrosoftTeamsUserIdentifier,
26
+ isPhoneNumberIdentifier: () => isPhoneNumberIdentifier,
27
+ isTeamsExtensionUserIdentifier: () => isTeamsExtensionUserIdentifier,
28
+ isUnknownIdentifier: () => isUnknownIdentifier
29
+ });
30
+ module.exports = __toCommonJS(identifierModels_exports);
11
31
  const isCommunicationUserIdentifier = (identifier) => {
12
- return typeof identifier.communicationUserId === "string";
32
+ return typeof identifier.communicationUserId === "string";
13
33
  };
14
- exports.isCommunicationUserIdentifier = isCommunicationUserIdentifier;
15
- /**
16
- * Tests an Identifier to determine whether it implements PhoneNumberIdentifier.
17
- *
18
- * @param identifier - The assumed PhoneNumberIdentifier to be tested.
19
- */
20
34
  const isPhoneNumberIdentifier = (identifier) => {
21
- return typeof identifier.phoneNumber === "string";
35
+ return typeof identifier.phoneNumber === "string";
22
36
  };
23
- exports.isPhoneNumberIdentifier = isPhoneNumberIdentifier;
24
- /**
25
- * Tests an Identifier to determine whether it implements MicrosoftTeamsUserIdentifier.
26
- *
27
- * @param identifier - The assumed available to be tested.
28
- */
29
37
  const isMicrosoftTeamsUserIdentifier = (identifier) => {
30
- return typeof identifier.microsoftTeamsUserId === "string";
38
+ return typeof identifier.microsoftTeamsUserId === "string";
31
39
  };
32
- exports.isMicrosoftTeamsUserIdentifier = isMicrosoftTeamsUserIdentifier;
33
- /**
34
- * Tests an Identifier to determine whether it implements MicrosoftTeamsAppIdentifier.
35
- *
36
- * @param identifier - The assumed available to be tested.
37
- */
38
40
  const isMicrosoftTeamsAppIdentifier = (identifier) => {
39
- return typeof identifier.teamsAppId === "string";
41
+ return typeof identifier.teamsAppId === "string";
40
42
  };
41
- exports.isMicrosoftTeamsAppIdentifier = isMicrosoftTeamsAppIdentifier;
42
- /**
43
- * Tests an Identifier to determine whether it implements TeamsExtensionUserIdentifier.
44
- *
45
- * @param identifier - The assumed available to be tested.
46
- */
47
43
  const isTeamsExtensionUserIdentifier = (identifier) => {
48
- const userIdExists = typeof identifier.userId === "string";
49
- const tenantIdExists = typeof identifier.tenantId === "string";
50
- const resourceIdExists = typeof identifier.resourceId === "string";
51
- return userIdExists && tenantIdExists && resourceIdExists;
44
+ const userIdExists = typeof identifier.userId === "string";
45
+ const tenantIdExists = typeof identifier.tenantId === "string";
46
+ const resourceIdExists = typeof identifier.resourceId === "string";
47
+ return userIdExists && tenantIdExists && resourceIdExists;
52
48
  };
53
- exports.isTeamsExtensionUserIdentifier = isTeamsExtensionUserIdentifier;
54
- /**
55
- * Tests an Identifier to determine whether it implements UnknownIdentifier.
56
- *
57
- * @param identifier - The assumed UnknownIdentifier to be tested.
58
- */
59
49
  const isUnknownIdentifier = (identifier) => {
60
- return typeof identifier.id === "string";
50
+ return typeof identifier.id === "string";
61
51
  };
62
- exports.isUnknownIdentifier = isUnknownIdentifier;
63
- /**
64
- * Returns the CommunicationIdentifierKind for a given CommunicationIdentifier. Returns undefined if the kind couldn't be inferred.
65
- *
66
- * @param identifier - The identifier whose kind is to be inferred.
67
- */
68
52
  const getIdentifierKind = (identifier) => {
69
- if ((0, exports.isCommunicationUserIdentifier)(identifier)) {
70
- return { ...identifier, kind: "communicationUser" };
53
+ if (isCommunicationUserIdentifier(identifier)) {
54
+ return { ...identifier, kind: "communicationUser" };
55
+ }
56
+ if (isPhoneNumberIdentifier(identifier)) {
57
+ return { ...identifier, kind: "phoneNumber" };
58
+ }
59
+ if (isMicrosoftTeamsUserIdentifier(identifier)) {
60
+ return { ...identifier, kind: "microsoftTeamsUser" };
61
+ }
62
+ if (isMicrosoftTeamsAppIdentifier(identifier)) {
63
+ return { ...identifier, kind: "microsoftTeamsApp" };
64
+ }
65
+ if (isTeamsExtensionUserIdentifier(identifier)) {
66
+ return { ...identifier, kind: "teamsExtensionUser" };
67
+ }
68
+ return { ...identifier, kind: "unknown" };
69
+ };
70
+ const getIdentifierRawId = (identifier) => {
71
+ const identifierKind = getIdentifierKind(identifier);
72
+ switch (identifierKind.kind) {
73
+ case "communicationUser":
74
+ return identifierKind.communicationUserId;
75
+ case "microsoftTeamsUser": {
76
+ const { microsoftTeamsUserId, rawId, cloud, isAnonymous } = identifierKind;
77
+ if (rawId) return rawId;
78
+ if (isAnonymous) return `8:teamsvisitor:${microsoftTeamsUserId}`;
79
+ switch (cloud) {
80
+ case "dod":
81
+ return `8:dod:${microsoftTeamsUserId}`;
82
+ case "gcch":
83
+ return `8:gcch:${microsoftTeamsUserId}`;
84
+ case "public":
85
+ return `8:orgid:${microsoftTeamsUserId}`;
86
+ }
87
+ return `8:orgid:${microsoftTeamsUserId}`;
71
88
  }
72
- if ((0, exports.isPhoneNumberIdentifier)(identifier)) {
73
- return { ...identifier, kind: "phoneNumber" };
89
+ case "microsoftTeamsApp": {
90
+ const { teamsAppId, rawId, cloud } = identifierKind;
91
+ if (rawId) return rawId;
92
+ switch (cloud) {
93
+ case "dod":
94
+ return `28:dod:${teamsAppId}`;
95
+ case "gcch":
96
+ return `28:gcch:${teamsAppId}`;
97
+ }
98
+ return `28:orgid:${teamsAppId}`;
74
99
  }
75
- if ((0, exports.isMicrosoftTeamsUserIdentifier)(identifier)) {
76
- return { ...identifier, kind: "microsoftTeamsUser" };
100
+ case "phoneNumber": {
101
+ const { phoneNumber, rawId } = identifierKind;
102
+ if (rawId) return rawId;
103
+ return `4:${phoneNumber}`;
77
104
  }
78
- if ((0, exports.isMicrosoftTeamsAppIdentifier)(identifier)) {
79
- return { ...identifier, kind: "microsoftTeamsApp" };
105
+ case "teamsExtensionUser": {
106
+ const { userId, tenantId, resourceId, rawId, cloud } = identifierKind;
107
+ if (rawId) return rawId;
108
+ switch (cloud) {
109
+ case "dod":
110
+ return `8:dod-acs:${resourceId}_${tenantId}_${userId}`;
111
+ case "gcch":
112
+ return `8:gcch-acs:${resourceId}_${tenantId}_${userId}`;
113
+ }
114
+ return `8:acs:${resourceId}_${tenantId}_${userId}`;
80
115
  }
81
- if ((0, exports.isTeamsExtensionUserIdentifier)(identifier)) {
82
- return { ...identifier, kind: "teamsExtensionUser" };
116
+ case "unknown": {
117
+ return identifierKind.id;
83
118
  }
84
- return { ...identifier, kind: "unknown" };
119
+ }
85
120
  };
86
- exports.getIdentifierKind = getIdentifierKind;
87
- /**
88
- * Returns the rawId for a given CommunicationIdentifier. You can use the rawId for encoding the identifier and then use it as a key in a database.
89
- *
90
- * @param identifier - The identifier to be translated to its rawId.
91
- */
92
- const getIdentifierRawId = (identifier) => {
93
- const identifierKind = (0, exports.getIdentifierKind)(identifier);
94
- switch (identifierKind.kind) {
95
- case "communicationUser":
96
- return identifierKind.communicationUserId;
97
- case "microsoftTeamsUser": {
98
- const { microsoftTeamsUserId, rawId, cloud, isAnonymous } = identifierKind;
99
- if (rawId)
100
- return rawId;
101
- if (isAnonymous)
102
- return `8:teamsvisitor:${microsoftTeamsUserId}`;
103
- switch (cloud) {
104
- case "dod":
105
- return `8:dod:${microsoftTeamsUserId}`;
106
- case "gcch":
107
- return `8:gcch:${microsoftTeamsUserId}`;
108
- case "public":
109
- return `8:orgid:${microsoftTeamsUserId}`;
110
- }
111
- return `8:orgid:${microsoftTeamsUserId}`;
112
- }
113
- case "microsoftTeamsApp": {
114
- const { teamsAppId, rawId, cloud } = identifierKind;
115
- if (rawId)
116
- return rawId;
117
- switch (cloud) {
118
- case "dod":
119
- return `28:dod:${teamsAppId}`;
120
- case "gcch":
121
- return `28:gcch:${teamsAppId}`;
122
- }
123
- return `28:orgid:${teamsAppId}`;
124
- }
125
- case "phoneNumber": {
126
- const { phoneNumber, rawId } = identifierKind;
127
- if (rawId)
128
- return rawId;
129
- return `4:${phoneNumber}`;
130
- }
131
- case "teamsExtensionUser": {
132
- const { userId, tenantId, resourceId, rawId, cloud } = identifierKind;
133
- if (rawId)
134
- return rawId;
135
- switch (cloud) {
136
- case "dod":
137
- return `8:dod-acs:${resourceId}_${tenantId}_${userId}`;
138
- case "gcch":
139
- return `8:gcch-acs:${resourceId}_${tenantId}_${userId}`;
140
- }
141
- return `8:acs:${resourceId}_${tenantId}_${userId}`;
142
- }
143
- case "unknown": {
144
- return identifierKind.id;
145
- }
146
- }
147
- };
148
- exports.getIdentifierRawId = getIdentifierRawId;
149
121
  const buildMicrosoftTeamsAppIdentifier = (teamsAppId, cloud) => {
150
- return {
151
- kind: "microsoftTeamsApp",
152
- teamsAppId: teamsAppId,
153
- cloud: cloud,
154
- };
122
+ return {
123
+ kind: "microsoftTeamsApp",
124
+ teamsAppId,
125
+ cloud
126
+ };
155
127
  };
156
128
  const buildMicrosoftTeamsUserIdentifier = (id, cloud, isAnonymous) => {
157
- return {
158
- kind: "microsoftTeamsUser",
159
- microsoftTeamsUserId: id,
160
- isAnonymous: isAnonymous,
161
- cloud: cloud,
162
- };
129
+ return {
130
+ kind: "microsoftTeamsUser",
131
+ microsoftTeamsUserId: id,
132
+ isAnonymous,
133
+ cloud
134
+ };
163
135
  };
164
136
  const buildTeamsExtensionUserOrCommunicationUserIdentifier = (rawId, suffix, cloud) => {
165
- const segments = suffix.split("_");
166
- if (segments.length !== 3) {
167
- return { kind: "communicationUser", communicationUserId: rawId };
168
- }
169
- const resourceId = segments[0];
170
- const tenantId = segments[1];
171
- const userId = segments[2];
172
- return {
173
- kind: "teamsExtensionUser",
174
- userId: userId,
175
- tenantId: tenantId,
176
- resourceId: resourceId,
177
- cloud: cloud,
178
- };
137
+ const segments = suffix.split("_");
138
+ if (segments.length !== 3) {
139
+ return { kind: "communicationUser", communicationUserId: rawId };
140
+ }
141
+ const resourceId = segments[0];
142
+ const tenantId = segments[1];
143
+ const userId = segments[2];
144
+ return {
145
+ kind: "teamsExtensionUser",
146
+ userId,
147
+ tenantId,
148
+ resourceId,
149
+ cloud
150
+ };
179
151
  };
180
152
  const buildPhoneNumberIdentifier = (rawId) => {
181
- const phoneNumber = rawId.substring("4:".length);
182
- const isAnonymous = phoneNumber === "anonymous";
183
- const assertedIdIndex = isAnonymous ? -1 : phoneNumber.lastIndexOf("_") + 1;
184
- const hasAssertedId = assertedIdIndex > 0 && assertedIdIndex < phoneNumber.length;
185
- const assertedId = hasAssertedId ? phoneNumber.substring(assertedIdIndex) : undefined;
186
- return {
187
- kind: "phoneNumber",
188
- phoneNumber: phoneNumber,
189
- isAnonymous: isAnonymous,
190
- assertedId: assertedId,
191
- };
153
+ const phoneNumber = rawId.substring("4:".length);
154
+ const isAnonymous = phoneNumber === "anonymous";
155
+ const assertedIdIndex = isAnonymous ? -1 : phoneNumber.lastIndexOf("_") + 1;
156
+ const hasAssertedId = assertedIdIndex > 0 && assertedIdIndex < phoneNumber.length;
157
+ const assertedId = hasAssertedId ? phoneNumber.substring(assertedIdIndex) : void 0;
158
+ return {
159
+ kind: "phoneNumber",
160
+ phoneNumber,
161
+ isAnonymous,
162
+ assertedId
163
+ };
192
164
  };
193
- /**
194
- * Creates a CommunicationIdentifierKind from a given rawId. When storing rawIds use this function to restore the identifier that was encoded in the rawId.
195
- *
196
- * @param rawId - The rawId to be translated to its identifier representation.
197
- */
198
165
  const createIdentifierFromRawId = (rawId) => {
199
- if (rawId.startsWith("4:")) {
200
- return buildPhoneNumberIdentifier(rawId);
201
- }
202
- const segments = rawId.split(":");
203
- if (segments.length !== 3) {
204
- return { kind: "unknown", id: rawId };
205
- }
206
- const prefix = `${segments[0]}:${segments[1]}:`;
207
- const suffix = segments[2];
208
- switch (prefix) {
209
- case "8:teamsvisitor:":
210
- return { kind: "microsoftTeamsUser", microsoftTeamsUserId: suffix, isAnonymous: true };
211
- case "8:orgid:":
212
- return buildMicrosoftTeamsUserIdentifier(suffix, "public", false);
213
- case "8:dod:":
214
- return buildMicrosoftTeamsUserIdentifier(suffix, "dod", false);
215
- case "8:gcch:":
216
- return buildMicrosoftTeamsUserIdentifier(suffix, "gcch", false);
217
- case "8:acs:":
218
- return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "public");
219
- case "8:dod-acs:":
220
- return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "dod");
221
- case "8:gcch-acs:":
222
- return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "gcch");
223
- case "8:spool:":
224
- return { kind: "communicationUser", communicationUserId: rawId };
225
- case "28:orgid:":
226
- return buildMicrosoftTeamsAppIdentifier(suffix, "public");
227
- case "28:gcch:":
228
- return buildMicrosoftTeamsAppIdentifier(suffix, "gcch");
229
- case "28:dod:":
230
- return buildMicrosoftTeamsAppIdentifier(suffix, "dod");
231
- }
166
+ if (rawId.startsWith("4:")) {
167
+ return buildPhoneNumberIdentifier(rawId);
168
+ }
169
+ const segments = rawId.split(":");
170
+ if (segments.length !== 3) {
232
171
  return { kind: "unknown", id: rawId };
172
+ }
173
+ const prefix = `${segments[0]}:${segments[1]}:`;
174
+ const suffix = segments[2];
175
+ switch (prefix) {
176
+ case "8:teamsvisitor:":
177
+ return { kind: "microsoftTeamsUser", microsoftTeamsUserId: suffix, isAnonymous: true };
178
+ case "8:orgid:":
179
+ return buildMicrosoftTeamsUserIdentifier(suffix, "public", false);
180
+ case "8:dod:":
181
+ return buildMicrosoftTeamsUserIdentifier(suffix, "dod", false);
182
+ case "8:gcch:":
183
+ return buildMicrosoftTeamsUserIdentifier(suffix, "gcch", false);
184
+ case "8:acs:":
185
+ return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "public");
186
+ case "8:dod-acs:":
187
+ return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "dod");
188
+ case "8:gcch-acs:":
189
+ return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, "gcch");
190
+ case "8:spool:":
191
+ return { kind: "communicationUser", communicationUserId: rawId };
192
+ case "28:orgid:":
193
+ return buildMicrosoftTeamsAppIdentifier(suffix, "public");
194
+ case "28:gcch:":
195
+ return buildMicrosoftTeamsAppIdentifier(suffix, "gcch");
196
+ case "28:dod:":
197
+ return buildMicrosoftTeamsAppIdentifier(suffix, "dod");
198
+ }
199
+ return { kind: "unknown", id: rawId };
233
200
  };
234
- exports.createIdentifierFromRawId = createIdentifierFromRawId;
235
- //# sourceMappingURL=identifierModels.js.map
201
+ // Annotate the CommonJS export names for ESM import in node:
202
+ 0 && (module.exports = {
203
+ createIdentifierFromRawId,
204
+ getIdentifierKind,
205
+ getIdentifierRawId,
206
+ isCommunicationUserIdentifier,
207
+ isMicrosoftTeamsAppIdentifier,
208
+ isMicrosoftTeamsUserIdentifier,
209
+ isPhoneNumberIdentifier,
210
+ isTeamsExtensionUserIdentifier,
211
+ isUnknownIdentifier
212
+ });
213
+ //# sourceMappingURL=identifierModels.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"identifierModels.js","sourceRoot":"","sources":["../../src/identifierModels.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAoIlC;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,CAC3C,UAAmC,EACQ,EAAE;IAC7C,OAAO,OAAQ,UAAkB,CAAC,mBAAmB,KAAK,QAAQ,CAAC;AACrE,CAAC,CAAC;AAJW,QAAA,6BAA6B,iCAIxC;AAEF;;;;GAIG;AACI,MAAM,uBAAuB,GAAG,CACrC,UAAmC,EACE,EAAE;IACvC,OAAO,OAAQ,UAAkB,CAAC,WAAW,KAAK,QAAQ,CAAC;AAC7D,CAAC,CAAC;AAJW,QAAA,uBAAuB,2BAIlC;AAEF;;;;GAIG;AACI,MAAM,8BAA8B,GAAG,CAC5C,UAAmC,EACS,EAAE;IAC9C,OAAO,OAAQ,UAAkB,CAAC,oBAAoB,KAAK,QAAQ,CAAC;AACtE,CAAC,CAAC;AAJW,QAAA,8BAA8B,kCAIzC;AAEF;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,CAC3C,UAAmC,EACQ,EAAE;IAC7C,OAAO,OAAQ,UAAkB,CAAC,UAAU,KAAK,QAAQ,CAAC;AAC5D,CAAC,CAAC;AAJW,QAAA,6BAA6B,iCAIxC;AAEF;;;;GAIG;AACI,MAAM,8BAA8B,GAAG,CAC5C,UAAmC,EACS,EAAE;IAC9C,MAAM,YAAY,GAAG,OAAQ,UAAkB,CAAC,MAAM,KAAK,QAAQ,CAAC;IACpE,MAAM,cAAc,GAAG,OAAQ,UAAkB,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACxE,MAAM,gBAAgB,GAAG,OAAQ,UAAkB,CAAC,UAAU,KAAK,QAAQ,CAAC;IAC5E,OAAO,YAAY,IAAI,cAAc,IAAI,gBAAgB,CAAC;AA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IAC3D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC,CAAC;AAtCW,QAAA,yBAAyB,6BAsCpC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Identifies a communication participant.\n */\nexport type CommunicationIdentifier =\n | CommunicationUserIdentifier\n | PhoneNumberIdentifier\n | MicrosoftTeamsUserIdentifier\n | MicrosoftTeamsAppIdentifier\n | TeamsExtensionUserIdentifier\n | UnknownIdentifier;\n\n/**\n * An Azure Communication user.\n */\nexport interface CommunicationUserIdentifier {\n /**\n * Id of the CommunicationUser as returned from the Communication Service.\n */\n communicationUserId: string;\n}\n\n/**\n * A phone number.\n */\nexport interface PhoneNumberIdentifier {\n /**\n * Optional raw id of the phone number.\n */\n rawId?: string;\n /**\n * The phone number in E.164 format.\n */\n phoneNumber: string;\n\n /**\n * The asserted Id is set on a phone number that is already in the same call to distinguish from other connections made through the same number.\n */\n assertedId?: string;\n\n /**\n * True if the phone number is anonymous.\n */\n isAnonymous?: boolean;\n}\n\n/**\n * A Microsoft Teams user.\n */\nexport interface MicrosoftTeamsUserIdentifier {\n /**\n * Optional raw id of the Microsoft Teams user.\n */\n rawId?: string;\n\n /**\n * Id of the Microsoft Teams user. If the user isn't anonymous, the id is the Entra ID object id of the user.\n */\n microsoftTeamsUserId: string;\n\n /**\n * True if the user is anonymous, for example when joining a meeting with a share link. If missing, the user is not anonymous.\n */\n isAnonymous?: boolean;\n\n /**\n * The cloud that the Microsoft Teams user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * A Microsoft Teams App.\n */\nexport interface MicrosoftTeamsAppIdentifier {\n /**\n * Optional raw id of the Microsoft Teams App.\n */\n rawId?: string;\n\n /**\n * The unique Microsoft Teams app ID.\n */\n teamsAppId: string;\n\n /**\n * The cloud that the Microsoft Teams App belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * A Microsoft Teams Phone user who is using the Azure Communication Services resource to extend their Teams Phone set up.\n */\nexport interface TeamsExtensionUserIdentifier {\n /**\n * Optional raw id of the Microsoft Teams Extension user.\n */\n rawId?: string;\n\n /**\n * The Id of the Microsoft Teams Extension user, i.e. the Entra ID object Id of the user.\n */\n userId: string;\n\n /**\n * The tenant Id of the Microsoft Teams Extension user.\n */\n tenantId: string;\n\n /**\n * The Azure Communication Services resource Id.\n */\n resourceId: string;\n\n /**\n * The cloud that the Microsoft Teams Extension user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * An unknown identifier that doesn't fit any of the other identifier types.\n */\nexport interface UnknownIdentifier {\n /**\n * Id of the UnknownIdentifier.\n */\n id: string;\n}\n\n/**\n * Tests an Identifier to determine whether it implements CommunicationUserIdentifier.\n *\n * @param identifier - The assumed CommunicationUserIdentifier to be tested.\n */\nexport const isCommunicationUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is CommunicationUserIdentifier => {\n return typeof (identifier as any).communicationUserId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements PhoneNumberIdentifier.\n *\n * @param identifier - The assumed PhoneNumberIdentifier to be tested.\n */\nexport const isPhoneNumberIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is PhoneNumberIdentifier => {\n return typeof (identifier as any).phoneNumber === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements MicrosoftTeamsUserIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isMicrosoftTeamsUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is MicrosoftTeamsUserIdentifier => {\n return typeof (identifier as any).microsoftTeamsUserId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements MicrosoftTeamsAppIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isMicrosoftTeamsAppIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is MicrosoftTeamsAppIdentifier => {\n return typeof (identifier as any).teamsAppId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements TeamsExtensionUserIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isTeamsExtensionUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is TeamsExtensionUserIdentifier => {\n const userIdExists = typeof (identifier as any).userId === \"string\";\n const tenantIdExists = typeof (identifier as any).tenantId === \"string\";\n const resourceIdExists = typeof (identifier as any).resourceId === \"string\";\n return userIdExists && tenantIdExists && resourceIdExists;\n};\n\n/**\n * Tests an Identifier to determine whether it implements UnknownIdentifier.\n *\n * @param identifier - The assumed UnknownIdentifier to be tested.\n */\nexport const isUnknownIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is UnknownIdentifier => {\n return typeof (identifier as any).id === \"string\";\n};\n\n/**\n * The CommunicationIdentifierKind is a discriminated union that adds a property `kind` to an Identifier.\n */\nexport type CommunicationIdentifierKind =\n | CommunicationUserKind\n | PhoneNumberKind\n | MicrosoftTeamsUserKind\n | MicrosoftTeamsAppKind\n | TeamsExtensionUserKind\n | UnknownIdentifierKind;\n\n/**\n * IdentifierKind for a CommunicationUserIdentifier.\n */\nexport interface CommunicationUserKind extends CommunicationUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"communicationUser\";\n}\n\n/**\n * IdentifierKind for a PhoneNumberIdentifier.\n */\nexport interface PhoneNumberKind extends PhoneNumberIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"phoneNumber\";\n}\n\n/**\n * IdentifierKind for a MicrosoftTeamsUserIdentifier.\n */\nexport interface MicrosoftTeamsUserKind extends MicrosoftTeamsUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"microsoftTeamsUser\";\n}\n\n/**\n * IdentifierKind for a MicrosoftTeamsAppIdentifier.\n */\nexport interface MicrosoftTeamsAppKind extends MicrosoftTeamsAppIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"microsoftTeamsApp\";\n}\n\n/**\n * IdentifierKind for a TeamsExtensionUserIdentifier.\n */\nexport interface TeamsExtensionUserKind extends TeamsExtensionUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"teamsExtensionUser\";\n}\n\n/**\n * IdentifierKind for UnknownIdentifier.\n */\nexport interface UnknownIdentifierKind extends UnknownIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"unknown\";\n}\n\n/**\n * Returns the CommunicationIdentifierKind for a given CommunicationIdentifier. Returns undefined if the kind couldn't be inferred.\n *\n * @param identifier - The identifier whose kind is to be inferred.\n */\nexport const getIdentifierKind = (\n identifier: CommunicationIdentifier,\n): CommunicationIdentifierKind => {\n if (isCommunicationUserIdentifier(identifier)) {\n return { ...identifier, kind: \"communicationUser\" };\n }\n if (isPhoneNumberIdentifier(identifier)) {\n return { ...identifier, kind: \"phoneNumber\" };\n }\n if (isMicrosoftTeamsUserIdentifier(identifier)) {\n return { ...identifier, kind: \"microsoftTeamsUser\" };\n }\n if (isMicrosoftTeamsAppIdentifier(identifier)) {\n return { ...identifier, kind: \"microsoftTeamsApp\" };\n }\n if (isTeamsExtensionUserIdentifier(identifier)) {\n return { ...identifier, kind: \"teamsExtensionUser\" };\n }\n return { ...identifier, kind: \"unknown\" };\n};\n\n/**\n * Returns the rawId for a given CommunicationIdentifier. You can use the rawId for encoding the identifier and then use it as a key in a database.\n *\n * @param identifier - The identifier to be translated to its rawId.\n */\nexport const getIdentifierRawId = (identifier: CommunicationIdentifier): string => {\n const identifierKind = getIdentifierKind(identifier);\n switch (identifierKind.kind) {\n case \"communicationUser\":\n return identifierKind.communicationUserId;\n case \"microsoftTeamsUser\": {\n const { microsoftTeamsUserId, rawId, cloud, isAnonymous } = identifierKind;\n if (rawId) return rawId;\n if (isAnonymous) return `8:teamsvisitor:${microsoftTeamsUserId}`;\n switch (cloud) {\n case \"dod\":\n return `8:dod:${microsoftTeamsUserId}`;\n case \"gcch\":\n return `8:gcch:${microsoftTeamsUserId}`;\n case \"public\":\n return `8:orgid:${microsoftTeamsUserId}`;\n }\n return `8:orgid:${microsoftTeamsUserId}`;\n }\n case \"microsoftTeamsApp\": {\n const { teamsAppId, rawId, cloud } = identifierKind;\n if (rawId) return rawId;\n switch (cloud) {\n case \"dod\":\n return `28:dod:${teamsAppId}`;\n case \"gcch\":\n return `28:gcch:${teamsAppId}`;\n }\n return `28:orgid:${teamsAppId}`;\n }\n case \"phoneNumber\": {\n const { phoneNumber, rawId } = identifierKind;\n if (rawId) return rawId;\n return `4:${phoneNumber}`;\n }\n case \"teamsExtensionUser\": {\n const { userId, tenantId, resourceId, rawId, cloud } = identifierKind;\n if (rawId) return rawId;\n switch (cloud) {\n case \"dod\":\n return `8:dod-acs:${resourceId}_${tenantId}_${userId}`;\n case \"gcch\":\n return `8:gcch-acs:${resourceId}_${tenantId}_${userId}`;\n }\n return `8:acs:${resourceId}_${tenantId}_${userId}`;\n }\n case \"unknown\": {\n return identifierKind.id;\n }\n }\n};\n\nconst buildMicrosoftTeamsAppIdentifier = (\n teamsAppId: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n): CommunicationIdentifierKind => {\n return {\n kind: \"microsoftTeamsApp\",\n teamsAppId: teamsAppId,\n cloud: cloud,\n };\n};\n\nconst buildMicrosoftTeamsUserIdentifier = (\n id: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n isAnonymous: boolean,\n): CommunicationIdentifierKind => {\n return {\n kind: \"microsoftTeamsUser\",\n microsoftTeamsUserId: id,\n isAnonymous: isAnonymous,\n cloud: cloud,\n };\n};\n\nconst buildTeamsExtensionUserOrCommunicationUserIdentifier = (\n rawId: string,\n suffix: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n): CommunicationIdentifierKind => {\n const segments = suffix.split(\"_\");\n if (segments.length !== 3) {\n return { kind: \"communicationUser\", communicationUserId: rawId };\n }\n\n const resourceId = segments[0];\n const tenantId = segments[1];\n const userId = segments[2];\n return {\n kind: \"teamsExtensionUser\",\n userId: userId,\n tenantId: tenantId,\n resourceId: resourceId,\n cloud: cloud,\n };\n};\n\nconst buildPhoneNumberIdentifier = (rawId: string): CommunicationIdentifierKind => {\n const phoneNumber = rawId.substring(\"4:\".length);\n const isAnonymous = phoneNumber === \"anonymous\";\n const assertedIdIndex = isAnonymous ? -1 : phoneNumber.lastIndexOf(\"_\") + 1;\n const hasAssertedId = assertedIdIndex > 0 && assertedIdIndex < phoneNumber.length;\n const assertedId = hasAssertedId ? phoneNumber.substring(assertedIdIndex) : undefined;\n\n return {\n kind: \"phoneNumber\",\n phoneNumber: phoneNumber,\n isAnonymous: isAnonymous,\n assertedId: assertedId,\n };\n};\n\n/**\n * Creates a CommunicationIdentifierKind from a given rawId. When storing rawIds use this function to restore the identifier that was encoded in the rawId.\n *\n * @param rawId - The rawId to be translated to its identifier representation.\n */\nexport const createIdentifierFromRawId = (rawId: string): CommunicationIdentifierKind => {\n if (rawId.startsWith(\"4:\")) {\n return buildPhoneNumberIdentifier(rawId);\n }\n\n const segments = rawId.split(\":\");\n if (segments.length !== 3) {\n return { kind: \"unknown\", id: rawId };\n }\n\n const prefix = `${segments[0]}:${segments[1]}:`;\n const suffix = segments[2];\n\n switch (prefix) {\n case \"8:teamsvisitor:\":\n return { kind: \"microsoftTeamsUser\", microsoftTeamsUserId: suffix, isAnonymous: true };\n case \"8:orgid:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"public\", false);\n case \"8:dod:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"dod\", false);\n case \"8:gcch:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"gcch\", false);\n case \"8:acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"public\");\n case \"8:dod-acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"dod\");\n case \"8:gcch-acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"gcch\");\n case \"8:spool:\":\n return { kind: \"communicationUser\", communicationUserId: rawId };\n case \"28:orgid:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"public\");\n case \"28:gcch:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"gcch\");\n case \"28:dod:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"dod\");\n }\n return { kind: \"unknown\", id: rawId };\n};\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/identifierModels.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Identifies a communication participant.\n */\nexport type CommunicationIdentifier =\n | CommunicationUserIdentifier\n | PhoneNumberIdentifier\n | MicrosoftTeamsUserIdentifier\n | MicrosoftTeamsAppIdentifier\n | TeamsExtensionUserIdentifier\n | UnknownIdentifier;\n\n/**\n * An Azure Communication user.\n */\nexport interface CommunicationUserIdentifier {\n /**\n * Id of the CommunicationUser as returned from the Communication Service.\n */\n communicationUserId: string;\n}\n\n/**\n * A phone number.\n */\nexport interface PhoneNumberIdentifier {\n /**\n * Optional raw id of the phone number.\n */\n rawId?: string;\n /**\n * The phone number in E.164 format.\n */\n phoneNumber: string;\n\n /**\n * The asserted Id is set on a phone number that is already in the same call to distinguish from other connections made through the same number.\n */\n assertedId?: string;\n\n /**\n * True if the phone number is anonymous.\n */\n isAnonymous?: boolean;\n}\n\n/**\n * A Microsoft Teams user.\n */\nexport interface MicrosoftTeamsUserIdentifier {\n /**\n * Optional raw id of the Microsoft Teams user.\n */\n rawId?: string;\n\n /**\n * Id of the Microsoft Teams user. If the user isn't anonymous, the id is the Entra ID object id of the user.\n */\n microsoftTeamsUserId: string;\n\n /**\n * True if the user is anonymous, for example when joining a meeting with a share link. If missing, the user is not anonymous.\n */\n isAnonymous?: boolean;\n\n /**\n * The cloud that the Microsoft Teams user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * A Microsoft Teams App.\n */\nexport interface MicrosoftTeamsAppIdentifier {\n /**\n * Optional raw id of the Microsoft Teams App.\n */\n rawId?: string;\n\n /**\n * The unique Microsoft Teams app ID.\n */\n teamsAppId: string;\n\n /**\n * The cloud that the Microsoft Teams App belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * A Microsoft Teams Phone user who is using the Azure Communication Services resource to extend their Teams Phone set up.\n */\nexport interface TeamsExtensionUserIdentifier {\n /**\n * Optional raw id of the Microsoft Teams Extension user.\n */\n rawId?: string;\n\n /**\n * The Id of the Microsoft Teams Extension user, i.e. the Entra ID object Id of the user.\n */\n userId: string;\n\n /**\n * The tenant Id of the Microsoft Teams Extension user.\n */\n tenantId: string;\n\n /**\n * The Azure Communication Services resource Id.\n */\n resourceId: string;\n\n /**\n * The cloud that the Microsoft Teams Extension user belongs to. If missing, the cloud is \"public\".\n */\n cloud?: \"public\" | \"dod\" | \"gcch\";\n}\n\n/**\n * An unknown identifier that doesn't fit any of the other identifier types.\n */\nexport interface UnknownIdentifier {\n /**\n * Id of the UnknownIdentifier.\n */\n id: string;\n}\n\n/**\n * Tests an Identifier to determine whether it implements CommunicationUserIdentifier.\n *\n * @param identifier - The assumed CommunicationUserIdentifier to be tested.\n */\nexport const isCommunicationUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is CommunicationUserIdentifier => {\n return typeof (identifier as any).communicationUserId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements PhoneNumberIdentifier.\n *\n * @param identifier - The assumed PhoneNumberIdentifier to be tested.\n */\nexport const isPhoneNumberIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is PhoneNumberIdentifier => {\n return typeof (identifier as any).phoneNumber === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements MicrosoftTeamsUserIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isMicrosoftTeamsUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is MicrosoftTeamsUserIdentifier => {\n return typeof (identifier as any).microsoftTeamsUserId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements MicrosoftTeamsAppIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isMicrosoftTeamsAppIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is MicrosoftTeamsAppIdentifier => {\n return typeof (identifier as any).teamsAppId === \"string\";\n};\n\n/**\n * Tests an Identifier to determine whether it implements TeamsExtensionUserIdentifier.\n *\n * @param identifier - The assumed available to be tested.\n */\nexport const isTeamsExtensionUserIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is TeamsExtensionUserIdentifier => {\n const userIdExists = typeof (identifier as any).userId === \"string\";\n const tenantIdExists = typeof (identifier as any).tenantId === \"string\";\n const resourceIdExists = typeof (identifier as any).resourceId === \"string\";\n return userIdExists && tenantIdExists && resourceIdExists;\n};\n\n/**\n * Tests an Identifier to determine whether it implements UnknownIdentifier.\n *\n * @param identifier - The assumed UnknownIdentifier to be tested.\n */\nexport const isUnknownIdentifier = (\n identifier: CommunicationIdentifier,\n): identifier is UnknownIdentifier => {\n return typeof (identifier as any).id === \"string\";\n};\n\n/**\n * The CommunicationIdentifierKind is a discriminated union that adds a property `kind` to an Identifier.\n */\nexport type CommunicationIdentifierKind =\n | CommunicationUserKind\n | PhoneNumberKind\n | MicrosoftTeamsUserKind\n | MicrosoftTeamsAppKind\n | TeamsExtensionUserKind\n | UnknownIdentifierKind;\n\n/**\n * IdentifierKind for a CommunicationUserIdentifier.\n */\nexport interface CommunicationUserKind extends CommunicationUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"communicationUser\";\n}\n\n/**\n * IdentifierKind for a PhoneNumberIdentifier.\n */\nexport interface PhoneNumberKind extends PhoneNumberIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"phoneNumber\";\n}\n\n/**\n * IdentifierKind for a MicrosoftTeamsUserIdentifier.\n */\nexport interface MicrosoftTeamsUserKind extends MicrosoftTeamsUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"microsoftTeamsUser\";\n}\n\n/**\n * IdentifierKind for a MicrosoftTeamsAppIdentifier.\n */\nexport interface MicrosoftTeamsAppKind extends MicrosoftTeamsAppIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"microsoftTeamsApp\";\n}\n\n/**\n * IdentifierKind for a TeamsExtensionUserIdentifier.\n */\nexport interface TeamsExtensionUserKind extends TeamsExtensionUserIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"teamsExtensionUser\";\n}\n\n/**\n * IdentifierKind for UnknownIdentifier.\n */\nexport interface UnknownIdentifierKind extends UnknownIdentifier {\n /**\n * The identifier kind.\n */\n kind: \"unknown\";\n}\n\n/**\n * Returns the CommunicationIdentifierKind for a given CommunicationIdentifier. Returns undefined if the kind couldn't be inferred.\n *\n * @param identifier - The identifier whose kind is to be inferred.\n */\nexport const getIdentifierKind = (\n identifier: CommunicationIdentifier,\n): CommunicationIdentifierKind => {\n if (isCommunicationUserIdentifier(identifier)) {\n return { ...identifier, kind: \"communicationUser\" };\n }\n if (isPhoneNumberIdentifier(identifier)) {\n return { ...identifier, kind: \"phoneNumber\" };\n }\n if (isMicrosoftTeamsUserIdentifier(identifier)) {\n return { ...identifier, kind: \"microsoftTeamsUser\" };\n }\n if (isMicrosoftTeamsAppIdentifier(identifier)) {\n return { ...identifier, kind: \"microsoftTeamsApp\" };\n }\n if (isTeamsExtensionUserIdentifier(identifier)) {\n return { ...identifier, kind: \"teamsExtensionUser\" };\n }\n return { ...identifier, kind: \"unknown\" };\n};\n\n/**\n * Returns the rawId for a given CommunicationIdentifier. You can use the rawId for encoding the identifier and then use it as a key in a database.\n *\n * @param identifier - The identifier to be translated to its rawId.\n */\nexport const getIdentifierRawId = (identifier: CommunicationIdentifier): string => {\n const identifierKind = getIdentifierKind(identifier);\n switch (identifierKind.kind) {\n case \"communicationUser\":\n return identifierKind.communicationUserId;\n case \"microsoftTeamsUser\": {\n const { microsoftTeamsUserId, rawId, cloud, isAnonymous } = identifierKind;\n if (rawId) return rawId;\n if (isAnonymous) return `8:teamsvisitor:${microsoftTeamsUserId}`;\n switch (cloud) {\n case \"dod\":\n return `8:dod:${microsoftTeamsUserId}`;\n case \"gcch\":\n return `8:gcch:${microsoftTeamsUserId}`;\n case \"public\":\n return `8:orgid:${microsoftTeamsUserId}`;\n }\n return `8:orgid:${microsoftTeamsUserId}`;\n }\n case \"microsoftTeamsApp\": {\n const { teamsAppId, rawId, cloud } = identifierKind;\n if (rawId) return rawId;\n switch (cloud) {\n case \"dod\":\n return `28:dod:${teamsAppId}`;\n case \"gcch\":\n return `28:gcch:${teamsAppId}`;\n }\n return `28:orgid:${teamsAppId}`;\n }\n case \"phoneNumber\": {\n const { phoneNumber, rawId } = identifierKind;\n if (rawId) return rawId;\n return `4:${phoneNumber}`;\n }\n case \"teamsExtensionUser\": {\n const { userId, tenantId, resourceId, rawId, cloud } = identifierKind;\n if (rawId) return rawId;\n switch (cloud) {\n case \"dod\":\n return `8:dod-acs:${resourceId}_${tenantId}_${userId}`;\n case \"gcch\":\n return `8:gcch-acs:${resourceId}_${tenantId}_${userId}`;\n }\n return `8:acs:${resourceId}_${tenantId}_${userId}`;\n }\n case \"unknown\": {\n return identifierKind.id;\n }\n }\n};\n\nconst buildMicrosoftTeamsAppIdentifier = (\n teamsAppId: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n): CommunicationIdentifierKind => {\n return {\n kind: \"microsoftTeamsApp\",\n teamsAppId: teamsAppId,\n cloud: cloud,\n };\n};\n\nconst buildMicrosoftTeamsUserIdentifier = (\n id: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n isAnonymous: boolean,\n): CommunicationIdentifierKind => {\n return {\n kind: \"microsoftTeamsUser\",\n microsoftTeamsUserId: id,\n isAnonymous: isAnonymous,\n cloud: cloud,\n };\n};\n\nconst buildTeamsExtensionUserOrCommunicationUserIdentifier = (\n rawId: string,\n suffix: string,\n cloud: \"public\" | \"dod\" | \"gcch\",\n): CommunicationIdentifierKind => {\n const segments = suffix.split(\"_\");\n if (segments.length !== 3) {\n return { kind: \"communicationUser\", communicationUserId: rawId };\n }\n\n const resourceId = segments[0];\n const tenantId = segments[1];\n const userId = segments[2];\n return {\n kind: \"teamsExtensionUser\",\n userId: userId,\n tenantId: tenantId,\n resourceId: resourceId,\n cloud: cloud,\n };\n};\n\nconst buildPhoneNumberIdentifier = (rawId: string): CommunicationIdentifierKind => {\n const phoneNumber = rawId.substring(\"4:\".length);\n const isAnonymous = phoneNumber === \"anonymous\";\n const assertedIdIndex = isAnonymous ? -1 : phoneNumber.lastIndexOf(\"_\") + 1;\n const hasAssertedId = assertedIdIndex > 0 && assertedIdIndex < phoneNumber.length;\n const assertedId = hasAssertedId ? phoneNumber.substring(assertedIdIndex) : undefined;\n\n return {\n kind: \"phoneNumber\",\n phoneNumber: phoneNumber,\n isAnonymous: isAnonymous,\n assertedId: assertedId,\n };\n};\n\n/**\n * Creates a CommunicationIdentifierKind from a given rawId. When storing rawIds use this function to restore the identifier that was encoded in the rawId.\n *\n * @param rawId - The rawId to be translated to its identifier representation.\n */\nexport const createIdentifierFromRawId = (rawId: string): CommunicationIdentifierKind => {\n if (rawId.startsWith(\"4:\")) {\n return buildPhoneNumberIdentifier(rawId);\n }\n\n const segments = rawId.split(\":\");\n if (segments.length !== 3) {\n return { kind: \"unknown\", id: rawId };\n }\n\n const prefix = `${segments[0]}:${segments[1]}:`;\n const suffix = segments[2];\n\n switch (prefix) {\n case \"8:teamsvisitor:\":\n return { kind: \"microsoftTeamsUser\", microsoftTeamsUserId: suffix, isAnonymous: true };\n case \"8:orgid:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"public\", false);\n case \"8:dod:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"dod\", false);\n case \"8:gcch:\":\n return buildMicrosoftTeamsUserIdentifier(suffix, \"gcch\", false);\n case \"8:acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"public\");\n case \"8:dod-acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"dod\");\n case \"8:gcch-acs:\":\n return buildTeamsExtensionUserOrCommunicationUserIdentifier(rawId, suffix, \"gcch\");\n case \"8:spool:\":\n return { kind: \"communicationUser\", communicationUserId: rawId };\n case \"28:orgid:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"public\");\n case \"28:gcch:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"gcch\");\n case \"28:dod:\":\n return buildMicrosoftTeamsAppIdentifier(suffix, \"dod\");\n }\n return { kind: \"unknown\", id: rawId };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0IO,MAAM,gCAAgC,CAC3C,eAC8C;AAC9C,SAAO,OAAQ,WAAmB,wBAAwB;AAC5D;AAOO,MAAM,0BAA0B,CACrC,eACwC;AACxC,SAAO,OAAQ,WAAmB,gBAAgB;AACpD;AAOO,MAAM,iCAAiC,CAC5C,eAC+C;AAC/C,SAAO,OAAQ,WAAmB,yBAAyB;AAC7D;AAOO,MAAM,gCAAgC,CAC3C,eAC8C;AAC9C,SAAO,OAAQ,WAAmB,eAAe;AACnD;AAOO,MAAM,iCAAiC,CAC5C,eAC+C;AAC/C,QAAM,eAAe,OAAQ,WAAmB,WAAW;AAC3D,QAAM,iBAAiB,OAAQ,WAAmB,aAAa;AAC/D,QAAM,mBAAmB,OAAQ,WAAmB,eAAe;AACnE,SAAO,gBAAgB,kBAAkB;AAC3C;AAOO,MAAM,sBAAsB,CACjC,eACoC;AACpC,SAAO,OAAQ,WAAmB,OAAO;AAC3C;AA8EO,MAAM,oBAAoB,CAC/B,eACgC;AAChC,MAAI,8BAA8B,UAAU,GAAG;AAC7C,WAAO,EAAE,GAAG,YAAY,MAAM,oBAAoB;AAAA,EACpD;AACA,MAAI,wBAAwB,UAAU,GAAG;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;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAOO,MAAM,4BAA4B,CAAC,UAA+C;AACvF,MAAI,MAAM,WAAW,IAAI,GAAG;AAC1B,WAAO,2BAA2B,KAAK;AAAA,EACzC;AAEA,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO,EAAE,MAAM,WAAW,IAAI,MAAM;AAAA,EACtC;AAEA,QAAM,SAAS,GAAG,SAAS,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;AAC5C,QAAM,SAAS,SAAS,CAAC;AAEzB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,EAAE,MAAM,sBAAsB,sBAAsB,QAAQ,aAAa,KAAK;AAAA,IACvF,KAAK;AACH,aAAO,kCAAkC,QAAQ,UAAU,KAAK;AAAA,IAClE,KAAK;AACH,aAAO,kCAAkC,QAAQ,OAAO,KAAK;AAAA,IAC/D,KAAK;AACH,aAAO,kCAAkC,QAAQ,QAAQ,KAAK;AAAA,IAChE,KAAK;AACH,aAAO,qDAAqD,OAAO,QAAQ,QAAQ;AAAA,IACrF,KAAK;AACH,aAAO,qDAAqD,OAAO,QAAQ,KAAK;AAAA,IAClF,KAAK;AACH,aAAO,qDAAqD,OAAO,QAAQ,MAAM;AAAA,IACnF,KAAK;AACH,aAAO,EAAE,MAAM,qBAAqB,qBAAqB,MAAM;AAAA,IACjE,KAAK;AACH,aAAO,iCAAiC,QAAQ,QAAQ;AAAA,IAC1D,KAAK;AACH,aAAO,iCAAiC,QAAQ,MAAM;AAAA,IACxD,KAAK;AACH,aAAO,iCAAiC,QAAQ,KAAK;AAAA,EACzD;AACA,SAAO,EAAE,MAAM,WAAW,IAAI,MAAM;AACtC;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
- export { CommunicationTokenCredential, CommunicationGetTokenOptions, } from "./communicationTokenCredential.js";
1
+ export type { CommunicationTokenCredential, CommunicationGetTokenOptions, } from "./communicationTokenCredential.js";
2
2
  export { AzureCommunicationTokenCredential } from "./azureCommunicationTokenCredential.js";
3
- export { CommunicationTokenRefreshOptions } from "./autoRefreshTokenCredential.js";
4
- export { EntraCommunicationTokenCredentialOptions } from "./entraTokenCredential.js";
3
+ export type { CommunicationTokenRefreshOptions } from "./autoRefreshTokenCredential.js";
4
+ export type { EntraCommunicationTokenCredentialOptions } from "./entraTokenCredential.js";
5
5
  export * from "./credential/index.js";
6
6
  export * from "./identifierModels.js";
7
7
  export * from "./identifierModelSerializer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAC;AACrF,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,YAAY,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACxF,YAAY,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAC;AAC1F,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC"}
@@ -1,12 +1,35 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.AzureCommunicationTokenCredential = void 0;
6
- const tslib_1 = require("tslib");
7
- var azureCommunicationTokenCredential_js_1 = require("./azureCommunicationTokenCredential.js");
8
- Object.defineProperty(exports, "AzureCommunicationTokenCredential", { enumerable: true, get: function () { return azureCommunicationTokenCredential_js_1.AzureCommunicationTokenCredential; } });
9
- tslib_1.__exportStar(require("./credential/index.js"), exports);
10
- tslib_1.__exportStar(require("./identifierModels.js"), exports);
11
- tslib_1.__exportStar(require("./identifierModelSerializer.js"), exports);
12
- //# sourceMappingURL=index.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var src_exports = {};
20
+ __export(src_exports, {
21
+ AzureCommunicationTokenCredential: () => import_azureCommunicationTokenCredential.AzureCommunicationTokenCredential
22
+ });
23
+ module.exports = __toCommonJS(src_exports);
24
+ var import_azureCommunicationTokenCredential = require("./azureCommunicationTokenCredential.js");
25
+ __reExport(src_exports, require("./credential/index.js"), module.exports);
26
+ __reExport(src_exports, require("./identifierModels.js"), module.exports);
27
+ __reExport(src_exports, require("./identifierModelSerializer.js"), module.exports);
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ AzureCommunicationTokenCredential,
31
+ ...require("./credential/index.js"),
32
+ ...require("./identifierModels.js"),
33
+ ...require("./identifierModelSerializer.js")
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAMlC,+FAA2F;AAAlF,yJAAA,iCAAiC,OAAA;AAG1C,gEAAsC;AACtC,gEAAsC;AACtC,yEAA+C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n CommunicationTokenCredential,\n CommunicationGetTokenOptions,\n} from \"./communicationTokenCredential.js\";\nexport { AzureCommunicationTokenCredential } from \"./azureCommunicationTokenCredential.js\";\nexport { CommunicationTokenRefreshOptions } from \"./autoRefreshTokenCredential.js\";\nexport { EntraCommunicationTokenCredentialOptions } from \"./entraTokenCredential.js\";\nexport * from \"./credential/index.js\";\nexport * from \"./identifierModels.js\";\nexport * from \"./identifierModelSerializer.js\";\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport type {\n CommunicationTokenCredential,\n CommunicationGetTokenOptions,\n} from \"./communicationTokenCredential.js\";\nexport { AzureCommunicationTokenCredential } from \"./azureCommunicationTokenCredential.js\";\nexport type { CommunicationTokenRefreshOptions } from \"./autoRefreshTokenCredential.js\";\nexport type { EntraCommunicationTokenCredentialOptions } from \"./entraTokenCredential.js\";\nexport * from \"./credential/index.js\";\nexport * from \"./identifierModels.js\";\nexport * from \"./identifierModelSerializer.js\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,+CAAkD;AAGlD,wBAAc,kCAVd;AAWA,wBAAc,kCAXd;AAYA,wBAAc,2CAZd;",
6
+ "names": []
7
+ }