@ms-cloudpack/remote-cache 0.10.10 → 0.10.12

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.
@@ -0,0 +1,19 @@
1
+ import type { AppRegistration, AppRegistrationVersion } from './types/AppRegistration.js';
2
+ import type { AppRegistryClient } from './types/AppRegistryClient.js';
3
+ import type { PageSettings } from '@azure/core-paging';
4
+ import type { TokenCredential } from '@azure/identity';
5
+ import type { PagedResult } from './types/PagedResult.js';
6
+ export declare class AzureAppRegistryClient implements AppRegistryClient {
7
+ readonly storageUrl: string;
8
+ readonly credential: TokenCredential;
9
+ private readonly appsTableClient;
10
+ private readonly appVersionsTableClient;
11
+ constructor(storageUrl: string, credential: TokenCredential);
12
+ /**
13
+ * Registers an application and its version details in the table storage.
14
+ */
15
+ registerApp({ name, version, description, ...rest }: AppRegistrationVersion & Pick<AppRegistration, 'description'>): Promise<void>;
16
+ getApps(appName?: string, pageSettings?: PageSettings): Promise<PagedResult<AppRegistration>>;
17
+ getVersions(appName: string, pageSettings: PageSettings): Promise<PagedResult<AppRegistrationVersion>>;
18
+ }
19
+ //# sourceMappingURL=AzureAppRegistryClient.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { TaskReporter } from '@ms-cloudpack/task-reporter';
2
+ import type { TelemetryClient } from '@ms-cloudpack/telemetry';
3
+ import type { LoginMethod } from './types/LoginMethod.js';
4
+ import type { RemoteCacheConfig } from '@ms-cloudpack/common-types';
5
+ import type { AppRegistryClient } from './index.js';
6
+ /**
7
+ * Parameters to create an instance of the AppRegistryClient.
8
+ */
9
+ export interface CreateAppRegistryClientParams {
10
+ options: Partial<Pick<RemoteCacheConfig, 'storageAccount' | 'tenantId'>> & {
11
+ loginMethod: LoginMethod;
12
+ cachePath: string;
13
+ };
14
+ context: {
15
+ reporter: TaskReporter;
16
+ telemetryClient: TelemetryClient;
17
+ };
18
+ }
19
+ /**
20
+ * Creates an instance of the AppRegistryClient. This client is used to interact with the Azure Table Storage
21
+ * that holds the application registration and version details.
22
+ */
23
+ export declare function createAppRegistryClient(params: CreateAppRegistryClientParams): Promise<AppRegistryClient>;
24
+ //# sourceMappingURL=createAppRegistryClient.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare function createBlobStorageUrl(storageAccount: string): string;
2
+ export declare function createTableStorageUrl(storageAccount: string): string;
3
+ //# sourceMappingURL=createStorageUrl.d.ts.map
package/lib/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  export { createRemoteCacheClient, type CreateRemoteCacheClientParams } from './createRemoteCacheClient.js';
2
+ export { createAppRegistryClient, type CreateAppRegistryClientParams } from './createAppRegistryClient.js';
2
3
  export type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult, } from './types/RemoteCacheClient.js';
3
4
  export type { LoginMethod } from './types/LoginMethod.js';
5
+ export type { AppRegistration, AppRegistrationVersion } from './types/AppRegistration.js';
6
+ export type { AppRegistryClient } from './types/AppRegistryClient.js';
7
+ export type { PagedResult } from './types/PagedResult.js';
8
+ export type { PageSettings } from '@azure/core-paging';
4
9
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,46 @@
1
+ import type { TableEntity } from '@azure/data-tables';
2
+ /**
3
+ * Represents an application registration entry.
4
+ */
5
+ export type AppRegistration = {
6
+ /** The name of the registered application. */
7
+ name: string;
8
+ /** The latest version of the registered application. */
9
+ latestVersion: string;
10
+ /** (Optional) Description of the application version. */
11
+ description?: string;
12
+ };
13
+ /**
14
+ * Represents a specific version of an application registration.
15
+ */
16
+ export type AppRegistrationVersion = {
17
+ /** The name of the registered application. */
18
+ name: string;
19
+ /** Unique resource identifier associated with the application version. */
20
+ resourceId: string;
21
+ /** Name of the Azure Storage account where the application version is stored. */
22
+ storageAccount: string;
23
+ /** Name of the container holding the application version. */
24
+ container: string;
25
+ /** (Optional) Tenant Id associated with the application version. */
26
+ tenantId?: string;
27
+ /** Name of the local bundle folder for the application version. */
28
+ localBundleFolderName: string;
29
+ /** The version of the application */
30
+ version: string;
31
+ };
32
+ /**
33
+ * Represents an application registration entry in the table storage.
34
+ *
35
+ * - `partitionKey`: Fixed value `'apps'`, categorizing all application registrations under a single partition.
36
+ * - `rowKey`: Encoded application name, ensuring uniqueness within the partition.
37
+ */
38
+ export type AppRegistrationTableEntity = TableEntity<Omit<AppRegistration, 'name'>>;
39
+ /**
40
+ * Represents a specific version entry of an application in the table storage.
41
+ *
42
+ * - `partitionKey`: Encoded application name, grouping all versions of an application under the same partition.
43
+ * - `rowKey`: Encoded identifier
44
+ */
45
+ export type AppRegistrationVersionTableEntity = TableEntity<Omit<AppRegistrationVersion, 'name'>>;
46
+ //# sourceMappingURL=AppRegistration.d.ts.map
@@ -0,0 +1,28 @@
1
+ import type { PageSettings } from '@azure/core-paging';
2
+ import type { AppRegistrationVersion, AppRegistration } from './AppRegistration.js';
3
+ import type { PagedResult } from './PagedResult.js';
4
+ /**
5
+ * Client interface for managing application registrations and their versions.
6
+ */
7
+ export interface AppRegistryClient {
8
+ /**
9
+ * Registers a new application version in the registry.
10
+ */
11
+ registerApp(app: AppRegistrationVersion & Pick<AppRegistration, 'description'>): Promise<void>;
12
+ /**
13
+ * Retrieves a paginated list of registered applications.
14
+ *
15
+ * @param {string} appName - The name of the application to retrieve.
16
+ * @param {PageSettings} paginationOptions - The pagination options.
17
+ * that provides access to all registered applications.
18
+ */
19
+ getApps(appName?: string, paginationOptions?: PageSettings): Promise<PagedResult<AppRegistration>>;
20
+ /**
21
+ * Retrieves a paginated list of all versions for a specific application.
22
+ *
23
+ * @param {string} appName - The name of the application.
24
+ * @param {PageSettings} paginationOptions - The pagination options.
25
+ */
26
+ getVersions(appName: string, paginationOptions?: PageSettings): Promise<PagedResult<AppRegistrationVersion>>;
27
+ }
28
+ //# sourceMappingURL=AppRegistryClient.d.ts.map
@@ -0,0 +1,5 @@
1
+ export interface PagedResult<T> {
2
+ items: T[];
3
+ continuationToken?: string;
4
+ }
5
+ //# sourceMappingURL=PagedResult.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function getReverseSortedTimestamp(): string;
2
+ //# sourceMappingURL=getReverseSortedTimestamp.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Safely decodes a string using decodeURIComponent, ensuring it is not decoded multiple times.
3
+ *
4
+ * - If the input is already decoded, it returns the original value.
5
+ * - If the input is encoded, it decodes it.
6
+ * - Handles malformed input gracefully by returning the original value if decoding fails.
7
+
8
+ * @param value - The input string to be decoded.
9
+ * @returns - A safely decoded string.
10
+ */
11
+ export declare function safeDecodeURIComponent(value: string): string;
12
+ //# sourceMappingURL=safeDecodeURIComponent.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Safely encodes a string using encodeURIComponent, ensuring it is not encoded multiple times.
3
+ *
4
+ * - If the input is already encoded, it returns the original value.
5
+ * - If the input is not encoded, it encodes it.
6
+ * - Handles malformed input gracefully by encoding it if decoding fails.
7
+ *
8
+ * @param value - The input string to be encoded.
9
+ * @returns - A safely encoded string.
10
+ */
11
+ export declare function safeEncodeURIComponent(value: string): string;
12
+ //# sourceMappingURL=safeEncodeURIComponent.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/remote-cache",
3
- "version": "0.10.10",
3
+ "version": "0.10.12",
4
4
  "description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,16 +27,18 @@
27
27
  "lib/**/*.d.ts"
28
28
  ],
29
29
  "dependencies": {
30
- "@ms-cloudpack/common-types": "^0.24.7",
30
+ "@ms-cloudpack/common-types": "^0.24.8",
31
31
  "@ms-cloudpack/environment": "^0.1.1",
32
32
  "@ms-cloudpack/retry": "^0.1.3",
33
33
  "@ms-cloudpack/task-reporter": "^0.15.1",
34
- "@ms-cloudpack/telemetry": "^0.10.14",
34
+ "@ms-cloudpack/telemetry": "^0.10.15",
35
35
  "@napi-rs/keyring": "^1.0.0",
36
36
  "mime-types": "^2.0.0",
37
37
  "node-dpapi-prebuilt": "^1.0.3"
38
38
  },
39
39
  "devDependencies": {
40
+ "@azure/core-paging": "^1.0.0",
41
+ "@azure/data-tables": "^13.0.0",
40
42
  "@azure/identity": "4.3.0",
41
43
  "@azure/logger": "^1.0.0",
42
44
  "@azure/msal-common": "14.13.0",
@@ -1,2 +0,0 @@
1
- export declare function createBlobStorageUrl(storageAccount: string): string;
2
- //# sourceMappingURL=createBlobStorageUrl.d.ts.map