@azure/notification-hubs 1.0.3-alpha.20230717.1 → 1.0.3-alpha.20230804.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 (78) hide show
  1. package/dist/index.js +31 -36
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/api/cancelScheduledNotification.js.map +1 -1
  4. package/dist-esm/src/api/clientContext.js +24 -17
  5. package/dist-esm/src/api/clientContext.js.map +1 -1
  6. package/dist-esm/src/api/createOrUpdateInstallation.js.map +1 -1
  7. package/dist-esm/src/api/createOrUpdateRegistration.js.map +1 -1
  8. package/dist-esm/src/api/createRegistration.js.map +1 -1
  9. package/dist-esm/src/api/createRegistrationId.js.map +1 -1
  10. package/dist-esm/src/api/deleteInstallation.js.map +1 -1
  11. package/dist-esm/src/api/getFeedbackContainerUrl.js.map +1 -1
  12. package/dist-esm/src/api/getInstallation.js.map +1 -1
  13. package/dist-esm/src/api/getNotificationHubJob.js.map +1 -1
  14. package/dist-esm/src/api/getNotificationOutcomeDetails.js.map +1 -1
  15. package/dist-esm/src/api/getRegistration.js.map +1 -1
  16. package/dist-esm/src/api/internal/_client.js.map +1 -1
  17. package/dist-esm/src/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -1
  18. package/dist-esm/src/api/listNotificationHubJobs.js.map +1 -1
  19. package/dist-esm/src/api/submitNotificationHubJob.js.map +1 -1
  20. package/dist-esm/src/api/updateInstallation.js.map +1 -1
  21. package/dist-esm/src/api/updateRegistration.js.map +1 -1
  22. package/dist-esm/src/auth/connectionStringUtils.js +5 -5
  23. package/dist-esm/src/auth/connectionStringUtils.js.map +1 -1
  24. package/dist-esm/src/auth/{sasTokenProvider.js → sasTokenCredential.js} +5 -18
  25. package/dist-esm/src/auth/sasTokenCredential.js.map +1 -0
  26. package/dist-esm/src/models/options.js.map +1 -1
  27. package/dist-esm/src/notificationHubsClient.js.map +1 -1
  28. package/package.json +3 -2
  29. package/types/3.1/notification-hubs.d.ts +3 -3
  30. package/types/latest/notification-hubs.d.ts +3 -3
  31. package/types/latest/tsdoc-metadata.json +1 -1
  32. package/types/src/api/cancelScheduledNotification.d.ts +1 -1
  33. package/types/src/api/cancelScheduledNotification.d.ts.map +1 -1
  34. package/types/src/api/clientContext.d.ts +0 -13
  35. package/types/src/api/clientContext.d.ts.map +1 -1
  36. package/types/src/api/createOrUpdateInstallation.d.ts +1 -1
  37. package/types/src/api/createOrUpdateInstallation.d.ts.map +1 -1
  38. package/types/src/api/createOrUpdateRegistration.d.ts +1 -1
  39. package/types/src/api/createOrUpdateRegistration.d.ts.map +1 -1
  40. package/types/src/api/createRegistration.d.ts +1 -1
  41. package/types/src/api/createRegistration.d.ts.map +1 -1
  42. package/types/src/api/createRegistrationId.d.ts +1 -1
  43. package/types/src/api/createRegistrationId.d.ts.map +1 -1
  44. package/types/src/api/deleteInstallation.d.ts +1 -1
  45. package/types/src/api/deleteInstallation.d.ts.map +1 -1
  46. package/types/src/api/getFeedbackContainerUrl.d.ts +1 -1
  47. package/types/src/api/getFeedbackContainerUrl.d.ts.map +1 -1
  48. package/types/src/api/getInstallation.d.ts +1 -1
  49. package/types/src/api/getInstallation.d.ts.map +1 -1
  50. package/types/src/api/getNotificationHubJob.d.ts +1 -1
  51. package/types/src/api/getNotificationHubJob.d.ts.map +1 -1
  52. package/types/src/api/getNotificationOutcomeDetails.d.ts +1 -1
  53. package/types/src/api/getNotificationOutcomeDetails.d.ts.map +1 -1
  54. package/types/src/api/getRegistration.d.ts +1 -1
  55. package/types/src/api/getRegistration.d.ts.map +1 -1
  56. package/types/src/api/internal/_client.d.ts +1 -1
  57. package/types/src/api/internal/_client.d.ts.map +1 -1
  58. package/types/src/api/internal/_createOrUpdateRegistrationDescription.d.ts +1 -1
  59. package/types/src/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -1
  60. package/types/src/api/listNotificationHubJobs.d.ts +1 -1
  61. package/types/src/api/listNotificationHubJobs.d.ts.map +1 -1
  62. package/types/src/api/submitNotificationHubJob.d.ts +1 -1
  63. package/types/src/api/submitNotificationHubJob.d.ts.map +1 -1
  64. package/types/src/api/updateInstallation.d.ts +1 -1
  65. package/types/src/api/updateInstallation.d.ts.map +1 -1
  66. package/types/src/api/updateRegistration.d.ts +1 -1
  67. package/types/src/api/updateRegistration.d.ts.map +1 -1
  68. package/types/src/auth/connectionStringUtils.d.ts +4 -4
  69. package/types/src/auth/connectionStringUtils.d.ts.map +1 -1
  70. package/types/src/auth/sasTokenCredential.d.ts +37 -0
  71. package/types/src/auth/sasTokenCredential.d.ts.map +1 -0
  72. package/types/src/models/options.d.ts +2 -2
  73. package/types/src/models/options.d.ts.map +1 -1
  74. package/types/src/notificationHubsClient.d.ts +1 -1
  75. package/types/src/notificationHubsClient.d.ts.map +1 -1
  76. package/dist-esm/src/auth/sasTokenProvider.js.map +0 -1
  77. package/types/src/auth/sasTokenProvider.d.ts +0 -77
  78. package/types/src/auth/sasTokenProvider.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"sasTokenProvider.js","sourceRoot":"","sources":["../../../src/auth/sasTokenProvider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAoD7C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAwB;IAC7D,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAC/B;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAOD;;;OAGG;IACH,YAAY,UAA8B;QACxC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,OAAO,WAAW,CAChB,IAAI,CAAC,WAAW,CAAC,mBAAmB,EACpC,IAAI,CAAC,WAAW,CAAC,eAAe,EAChC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,EACpC,QAAQ,CACT,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,WAAW,CACxB,OAAe,EACf,GAAW,EACX,MAAc,EACd,QAAgB;IAEhB,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;IAC9C,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEhD,OAAO;QACL,KAAK,EAAE,4BAA4B,QAAQ,QAAQ,GAAG,OAAO,MAAM,QAAQ,OAAO,EAAE;QACpF,kBAAkB,EAAE,MAAM;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { signString } from \"./hmacSha256.js\";\n\n/**\n * Represents a named key credential.\n */\nexport interface NamedKeyCredential {\n /**\n * The Shared Access Signature key name.\n */\n sharedAccessKeyName: string;\n\n /**\n * The Shared Access Signature key value.\n */\n sharedAccessKey: string;\n}\n\n/**\n * Represents an access token for a SAS Credential.\n */\nexport interface AccessToken {\n /**\n * The SAS Token.\n */\n token: string;\n\n /**\n * The expiration time of the token.\n */\n expiresOnTimestamp: number;\n}\n\n/**\n * A SasTokenProvider provides an alternative to TokenCredential for providing an `AccessToken`.\n * @hidden\n */\nexport interface SasTokenProvider {\n /**\n * Property used to distinguish SasTokenProvider from TokenCredential.\n */\n isSasTokenProvider: true;\n\n /**\n * Gets the token provided by this provider.\n *\n * This method is called automatically by Azure SDK client libraries.\n *\n * @param audience - The audience for which the token is desired.\n */\n getToken(audience: string): Promise<AccessToken>;\n}\n\n/**\n * Creates a token provider from the provided shared access data.\n * @param data - The sharedAccessKeyName/sharedAccessKey pair or the sharedAccessSignature.\n * @hidden\n */\nexport function createSasTokenProvider(data: NamedKeyCredential): SasTokenProvider {\n return new SasTokenProviderImpl(data);\n}\n\n/**\n * A TokenProvider that generates a Sas token:\n * `SharedAccessSignature sr=<resource>&sig=<signature>&se=<expiry>&skn=<keyname>`\n *\n * @internal\n */\nexport class SasTokenProviderImpl implements SasTokenProvider {\n /**\n * Property used to distinguish TokenProvider from TokenCredential.\n */\n get isSasTokenProvider(): true {\n return true;\n }\n\n /**\n * The SASCredential containing the key name and secret key value.\n */\n private _credential: NamedKeyCredential;\n\n /**\n * Initializes a new instance of SasTokenProvider\n * @param credential - The source `NamedKeyCredential` or `SASCredential`.\n */\n constructor(credential: NamedKeyCredential) {\n this._credential = credential;\n }\n\n /**\n * Gets the sas token for the specified audience\n * @param audience - The audience for which the token is desired.\n */\n async getToken(audience: string): Promise<AccessToken> {\n return createToken(\n this._credential.sharedAccessKeyName,\n this._credential.sharedAccessKey,\n Math.floor(Date.now() / 1000) + 3600,\n audience\n );\n }\n}\n\n/**\n * Creates the sas token based on the provided information.\n * @param keyName - The shared access key name.\n * @param key - The shared access key.\n * @param expiry - The time period in unix time after which the token will expire.\n * @param audience - The audience for which the token is desired.\n * @internal\n */\nasync function createToken(\n keyName: string,\n key: string,\n expiry: number,\n audience: string\n): Promise<AccessToken> {\n audience = encodeURIComponent(audience.toLowerCase());\n keyName = encodeURIComponent(keyName);\n const stringToSign = audience + \"\\n\" + expiry;\n const sig = await signString(key, stringToSign);\n\n return {\n token: `SharedAccessSignature sr=${audience}&sig=${sig}&se=${expiry}&skn=${keyName}`,\n expiresOnTimestamp: expiry,\n };\n}\n"]}
@@ -1,77 +0,0 @@
1
- /**
2
- * Represents a named key credential.
3
- */
4
- export interface NamedKeyCredential {
5
- /**
6
- * The Shared Access Signature key name.
7
- */
8
- sharedAccessKeyName: string;
9
- /**
10
- * The Shared Access Signature key value.
11
- */
12
- sharedAccessKey: string;
13
- }
14
- /**
15
- * Represents an access token for a SAS Credential.
16
- */
17
- export interface AccessToken {
18
- /**
19
- * The SAS Token.
20
- */
21
- token: string;
22
- /**
23
- * The expiration time of the token.
24
- */
25
- expiresOnTimestamp: number;
26
- }
27
- /**
28
- * A SasTokenProvider provides an alternative to TokenCredential for providing an `AccessToken`.
29
- * @hidden
30
- */
31
- export interface SasTokenProvider {
32
- /**
33
- * Property used to distinguish SasTokenProvider from TokenCredential.
34
- */
35
- isSasTokenProvider: true;
36
- /**
37
- * Gets the token provided by this provider.
38
- *
39
- * This method is called automatically by Azure SDK client libraries.
40
- *
41
- * @param audience - The audience for which the token is desired.
42
- */
43
- getToken(audience: string): Promise<AccessToken>;
44
- }
45
- /**
46
- * Creates a token provider from the provided shared access data.
47
- * @param data - The sharedAccessKeyName/sharedAccessKey pair or the sharedAccessSignature.
48
- * @hidden
49
- */
50
- export declare function createSasTokenProvider(data: NamedKeyCredential): SasTokenProvider;
51
- /**
52
- * A TokenProvider that generates a Sas token:
53
- * `SharedAccessSignature sr=<resource>&sig=<signature>&se=<expiry>&skn=<keyname>`
54
- *
55
- * @internal
56
- */
57
- export declare class SasTokenProviderImpl implements SasTokenProvider {
58
- /**
59
- * Property used to distinguish TokenProvider from TokenCredential.
60
- */
61
- get isSasTokenProvider(): true;
62
- /**
63
- * The SASCredential containing the key name and secret key value.
64
- */
65
- private _credential;
66
- /**
67
- * Initializes a new instance of SasTokenProvider
68
- * @param credential - The source `NamedKeyCredential` or `SASCredential`.
69
- */
70
- constructor(credential: NamedKeyCredential);
71
- /**
72
- * Gets the sas token for the specified audience
73
- * @param audience - The audience for which the token is desired.
74
- */
75
- getToken(audience: string): Promise<AccessToken>;
76
- }
77
- //# sourceMappingURL=sasTokenProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sasTokenProvider.d.ts","sourceRoot":"","sources":["../../../src/auth/sasTokenProvider.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,kBAAkB,EAAE,IAAI,CAAC;IAEzB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,GAAG,gBAAgB,CAEjF;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D;;OAEG;IACH,IAAI,kBAAkB,IAAI,IAAI,CAE7B;IAED;;OAEG;IACH,OAAO,CAAC,WAAW,CAAqB;IAExC;;;OAGG;gBACS,UAAU,EAAE,kBAAkB;IAI1C;;;OAGG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAQvD"}