@walde.ai/walde-sdk 0.1.5 → 0.1.8
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/sdk/dev/mock-credentials-provider.d.ts +22 -0
- package/dist/sdk/dev/mock-credentials-provider.d.ts.map +1 -0
- package/dist/sdk/dev/mock-credentials-provider.js +59 -0
- package/dist/sdk/dev/mock-credentials-provider.js.map +1 -0
- package/dist/sdk/dev/s3-mock-client-factory.d.ts +15 -0
- package/dist/sdk/dev/s3-mock-client-factory.d.ts.map +1 -0
- package/dist/sdk/dev/s3-mock-client-factory.js +25 -0
- package/dist/sdk/dev/s3-mock-client-factory.js.map +1 -0
- package/dist/sdk/dev/s3-mock-client.d.ts +14 -0
- package/dist/sdk/dev/s3-mock-client.d.ts.map +1 -0
- package/dist/sdk/dev/s3-mock-client.js +45 -0
- package/dist/sdk/dev/s3-mock-client.js.map +1 -0
- package/dist/sdk/domain/entities/credentials.d.ts +5 -0
- package/dist/sdk/domain/entities/credentials.d.ts.map +1 -1
- package/dist/sdk/domain/entities/credentials.js +41 -0
- package/dist/sdk/domain/entities/credentials.js.map +1 -1
- package/dist/sdk/domain/entities/walde-admin-config.d.ts +4 -0
- package/dist/sdk/domain/entities/walde-admin-config.d.ts.map +1 -1
- package/dist/sdk/domain/entities/walde-admin-config.js +7 -2
- package/dist/sdk/domain/entities/walde-admin-config.js.map +1 -1
- package/dist/sdk/domain/ports/out/s3-client-factory.d.ts +13 -0
- package/dist/sdk/domain/ports/out/s3-client-factory.d.ts.map +1 -0
- package/dist/sdk/domain/ports/out/s3-client-factory.js +3 -0
- package/dist/sdk/domain/ports/out/s3-client-factory.js.map +1 -0
- package/dist/sdk/index.d.ts +6 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +12 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/infra/adapters/admin-http-client.d.ts +16 -0
- package/dist/sdk/infra/adapters/admin-http-client.d.ts.map +1 -0
- package/dist/sdk/infra/adapters/admin-http-client.js +75 -0
- package/dist/sdk/infra/adapters/admin-http-client.js.map +1 -0
- package/dist/sdk/infra/adapters/api-client.d.ts +2 -2
- package/dist/sdk/infra/adapters/api-client.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/api-client.js.map +1 -1
- package/dist/sdk/infra/adapters/aws-s3-client-factory.d.ts +13 -0
- package/dist/sdk/infra/adapters/aws-s3-client-factory.d.ts.map +1 -0
- package/dist/sdk/infra/adapters/aws-s3-client-factory.js +24 -0
- package/dist/sdk/infra/adapters/aws-s3-client-factory.js.map +1 -0
- package/dist/sdk/infra/adapters/default-http-client.d.ts +2 -6
- package/dist/sdk/infra/adapters/default-http-client.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/default-http-client.js +7 -12
- package/dist/sdk/infra/adapters/default-http-client.js.map +1 -1
- package/dist/sdk/infra/adapters/default-token-provider.d.ts +8 -1
- package/dist/sdk/infra/adapters/default-token-provider.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/default-token-provider.js +34 -1
- package/dist/sdk/infra/adapters/default-token-provider.js.map +1 -1
- package/dist/sdk/infra/adapters/frontend-http-client.d.ts +9 -7
- package/dist/sdk/infra/adapters/frontend-http-client.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/frontend-http-client.js +17 -11
- package/dist/sdk/infra/adapters/frontend-http-client.js.map +1 -1
- package/dist/sdk/infra/adapters/http-request-handler.d.ts +31 -0
- package/dist/sdk/infra/adapters/http-request-handler.d.ts.map +1 -0
- package/dist/sdk/infra/adapters/http-request-handler.js +83 -0
- package/dist/sdk/infra/adapters/http-request-handler.js.map +1 -0
- package/dist/sdk/infra/adapters/repositories/aws-s3-files-repo.d.ts +3 -1
- package/dist/sdk/infra/adapters/repositories/aws-s3-files-repo.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/repositories/aws-s3-files-repo.js +6 -10
- package/dist/sdk/infra/adapters/repositories/aws-s3-files-repo.js.map +1 -1
- package/dist/sdk/infra/adapters/repositories/default-walde-admin-config.d.ts.map +1 -1
- package/dist/sdk/infra/adapters/repositories/default-walde-admin-config.js +3 -1
- package/dist/sdk/infra/adapters/repositories/default-walde-admin-config.js.map +1 -1
- package/dist/sdk/infra/backend/walde-client.d.ts +3 -4
- package/dist/sdk/infra/backend/walde-client.d.ts.map +1 -1
- package/dist/sdk/infra/backend/walde-client.js +9 -9
- package/dist/sdk/infra/backend/walde-client.js.map +1 -1
- package/dist/sdk/infra/factories/s3-files-repo-factory.d.ts +3 -0
- package/dist/sdk/infra/factories/s3-files-repo-factory.d.ts.map +1 -1
- package/dist/sdk/infra/factories/s3-files-repo-factory.js +5 -1
- package/dist/sdk/infra/factories/s3-files-repo-factory.js.map +1 -1
- package/dist/sdk/infra/factories/walde-admin-factory.d.ts +2 -0
- package/dist/sdk/infra/factories/walde-admin-factory.d.ts.map +1 -1
- package/dist/sdk/infra/factories/walde-admin-factory.js +6 -5
- package/dist/sdk/infra/factories/walde-admin-factory.js.map +1 -1
- package/dist/sdk/infra/futures/content-by-key-future.d.ts +27 -0
- package/dist/sdk/infra/futures/content-by-key-future.d.ts.map +1 -0
- package/dist/sdk/infra/futures/content-by-key-future.js +63 -0
- package/dist/sdk/infra/futures/content-by-key-future.js.map +1 -0
- package/dist/sdk/infra/futures/content-item-future.d.ts +2 -3
- package/dist/sdk/infra/futures/content-item-future.d.ts.map +1 -1
- package/dist/sdk/infra/futures/content-item-future.js +6 -9
- package/dist/sdk/infra/futures/content-item-future.js.map +1 -1
- package/dist/sdk/infra/futures/content-list-future.d.ts +3 -3
- package/dist/sdk/infra/futures/content-list-future.d.ts.map +1 -1
- package/dist/sdk/infra/futures/content-list-future.js +14 -4
- package/dist/sdk/infra/futures/content-list-future.js.map +1 -1
- package/dist/sdk/infra/futures/credentials-future.d.ts.map +1 -1
- package/dist/sdk/infra/futures/credentials-future.js +38 -7
- package/dist/sdk/infra/futures/credentials-future.js.map +1 -1
- package/dist/sdk/infra/futures/frontend-contents-future.d.ts +12 -17
- package/dist/sdk/infra/futures/frontend-contents-future.d.ts.map +1 -1
- package/dist/sdk/infra/futures/frontend-contents-future.js +14 -35
- package/dist/sdk/infra/futures/frontend-contents-future.js.map +1 -1
- package/dist/sdk/infra/futures/walde-future.d.ts +3 -14
- package/dist/sdk/infra/futures/walde-future.d.ts.map +1 -1
- package/dist/sdk/infra/futures/walde-future.js +3 -31
- package/dist/sdk/infra/futures/walde-future.js.map +1 -1
- package/dist/sdk/make-walde-admin.d.ts +2 -0
- package/dist/sdk/make-walde-admin.d.ts.map +1 -1
- package/dist/sdk/make-walde-admin.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { RemoteFilesRepo } from '../../../sdk/domain/ports/out/remote-files-repo';
|
|
2
|
+
import { S3ClientFactory } from '../../../sdk/domain/ports/out/s3-client-factory';
|
|
2
3
|
import { S3FilesRepoFactory } from '../../../sdk/domain/interactors/ui/upload-ui-from-folder';
|
|
3
4
|
/**
|
|
4
5
|
* Factory for creating S3 file repositories
|
|
5
6
|
*/
|
|
6
7
|
export declare class DefaultS3FilesRepoFactory implements S3FilesRepoFactory {
|
|
8
|
+
private readonly s3ClientFactory;
|
|
9
|
+
constructor(s3ClientFactory: S3ClientFactory);
|
|
7
10
|
create(siteId: string): RemoteFilesRepo;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=s3-files-repo-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-files-repo-factory.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/s3-files-repo-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAGvF;;GAEG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;
|
|
1
|
+
{"version":3,"file":"s3-files-repo-factory.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/s3-files-repo-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAGvF;;GAEG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;IACtD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAE7D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAGxC"}
|
|
@@ -6,8 +6,12 @@ const aws_s3_files_repo_1 = require("../../../sdk/infra/adapters/repositories/aw
|
|
|
6
6
|
* Factory for creating S3 file repositories
|
|
7
7
|
*/
|
|
8
8
|
class DefaultS3FilesRepoFactory {
|
|
9
|
+
s3ClientFactory;
|
|
10
|
+
constructor(s3ClientFactory) {
|
|
11
|
+
this.s3ClientFactory = s3ClientFactory;
|
|
12
|
+
}
|
|
9
13
|
create(siteId) {
|
|
10
|
-
return new aws_s3_files_repo_1.AwsS3FilesRepo();
|
|
14
|
+
return new aws_s3_files_repo_1.AwsS3FilesRepo(this.s3ClientFactory);
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
exports.DefaultS3FilesRepoFactory = DefaultS3FilesRepoFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-files-repo-factory.js","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/s3-files-repo-factory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"s3-files-repo-factory.js","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/s3-files-repo-factory.ts"],"names":[],"mappings":";;;AAGA,2FAAqF;AAErF;;GAEG;AACH,MAAa,yBAAyB;IACP;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,MAAM,CAAC,MAAc;QACnB,OAAO,IAAI,kCAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC;CACF;AAND,8DAMC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { WaldeAdmin } from '../../../sdk/infra/futures/walde-admin-future';
|
|
2
2
|
import { CredentialsProvider } from '../../../sdk/domain/ports/out/credentials-provider';
|
|
3
|
+
import { S3ClientFactory } from '../../../sdk/domain/ports/out/s3-client-factory';
|
|
3
4
|
interface WaldeAdminFactoryConfig {
|
|
4
5
|
credentialsProvider: CredentialsProvider;
|
|
5
6
|
endpoint?: string;
|
|
6
7
|
clientId?: string;
|
|
7
8
|
region?: string;
|
|
8
9
|
stage?: string;
|
|
10
|
+
s3ClientFactory?: S3ClientFactory;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Factory for creating properly configured WaldeAdmin instances
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walde-admin-factory.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/walde-admin-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"walde-admin-factory.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/walde-admin-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAMlF,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAa3E,UAAU,uBAAuB;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;GAEG;AACH,qBAAa,iBAAiB;WACd,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,UAAU;CAiCvE"}
|
|
@@ -8,7 +8,7 @@ const file_workspace_config_repo_1 = require("../../../sdk/infra/adapters/reposi
|
|
|
8
8
|
const writer_api_aws_ui_upload_credentials_repo_1 = require("../../../sdk/infra/adapters/repositories/writer-api-aws-ui-upload-credentials-repo");
|
|
9
9
|
const s3_files_repo_factory_1 = require("./s3-files-repo-factory");
|
|
10
10
|
const api_client_1 = require("../../../sdk/infra/adapters/api-client");
|
|
11
|
-
const
|
|
11
|
+
const admin_http_client_1 = require("../../../sdk/infra/adapters/admin-http-client");
|
|
12
12
|
const default_token_provider_1 = require("../../../sdk/infra/adapters/default-token-provider");
|
|
13
13
|
const walde_admin_config_factory_1 = require("./walde-admin-config-factory");
|
|
14
14
|
/**
|
|
@@ -19,16 +19,17 @@ class WaldeAdminFactory {
|
|
|
19
19
|
const completeConfig = walde_admin_config_factory_1.WaldeAdminConfigFactory.create({
|
|
20
20
|
endpoint: config.endpoint,
|
|
21
21
|
clientId: config.clientId,
|
|
22
|
-
region: config.region
|
|
22
|
+
region: config.region,
|
|
23
|
+
s3ClientFactory: config.s3ClientFactory
|
|
23
24
|
}, config.stage);
|
|
24
|
-
const tokenProvider = new default_token_provider_1.DefaultTokenProvider(config.credentialsProvider);
|
|
25
|
-
const httpClient = new
|
|
25
|
+
const tokenProvider = new default_token_provider_1.DefaultTokenProvider(config.credentialsProvider, completeConfig.clientId, completeConfig.region);
|
|
26
|
+
const httpClient = new admin_http_client_1.AdminHttpClient(completeConfig.endpoint, tokenProvider);
|
|
26
27
|
const apiClient = new api_client_1.ApiClient(httpClient);
|
|
27
28
|
const sitesRepo = new http_site_repo_1.HttpSiteRepository(apiClient);
|
|
28
29
|
const contentRepo = new http_content_repo_1.HttpContentRepo(apiClient);
|
|
29
30
|
const workspaceConfigRepo = new file_workspace_config_repo_1.FileWorkspaceConfigRepo();
|
|
30
31
|
const uiUploadCredentialsRepo = new writer_api_aws_ui_upload_credentials_repo_1.WriterApiAwsUiUploadCredentialsRepo(apiClient);
|
|
31
|
-
const s3FilesRepoFactory = new s3_files_repo_factory_1.DefaultS3FilesRepoFactory();
|
|
32
|
+
const s3FilesRepoFactory = new s3_files_repo_factory_1.DefaultS3FilesRepoFactory(completeConfig.s3ClientFactory);
|
|
32
33
|
const backendCommunication = apiClient;
|
|
33
34
|
return new walde_admin_future_1.WaldeAdmin({
|
|
34
35
|
credentialsProvider: config.credentialsProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walde-admin-factory.js","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/walde-admin-factory.ts"],"names":[],"mappings":";;;AAAA,+EAAoE;
|
|
1
|
+
{"version":3,"file":"walde-admin-factory.js","sourceRoot":"","sources":["../../../../src/sdk/infra/factories/walde-admin-factory.ts"],"names":[],"mappings":";;;AAAA,+EAAoE;AASpE,qFAAsF;AACtF,mFAA8E;AAC9E,6GAAuG;AACvG,2IAAkI;AAClI,mEAAoE;AAEpE,gEAA4D;AAC5D,8EAAyE;AACzE,wFAAmF;AACnF,6EAAuE;AAWvE;;GAEG;AACH,MAAa,iBAAiB;IACrB,MAAM,CAAC,WAAW,CAAC,MAA+B;QACvD,MAAM,cAAc,GAAG,oDAAuB,CAAC,MAAM,CAAC;YACpD,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAEjB,MAAM,aAAa,GAAG,IAAI,6CAAoB,CAC5C,MAAM,CAAC,mBAAmB,EAC1B,cAAc,CAAC,QAAQ,EACvB,cAAc,CAAC,MAAM,CACtB,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,mCAAe,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC/E,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAmB,IAAI,mCAAkB,CAAC,SAAS,CAAC,CAAC;QACpE,MAAM,WAAW,GAAgB,IAAI,mCAAe,CAAC,SAAS,CAAC,CAAC;QAChE,MAAM,mBAAmB,GAAwB,IAAI,oDAAuB,EAAE,CAAC;QAC/E,MAAM,uBAAuB,GAA4B,IAAI,+EAAmC,CAAC,SAAS,CAAC,CAAC;QAC5G,MAAM,kBAAkB,GAAuB,IAAI,iDAAyB,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAC7G,MAAM,oBAAoB,GAAyB,SAAS,CAAC;QAE7D,OAAO,IAAI,+BAAU,CAAC;YACpB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;YAC/C,SAAS;YACT,WAAW;YACX,mBAAmB;YACnB,uBAAuB;YACvB,kBAAkB;YAClB,oBAAoB;YACpB,MAAM,EAAE,cAAc;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAlCD,8CAkCC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Future } from '../../../std/domain/entities/future';
|
|
2
|
+
import { Result } from '../../../std/domain/entities/result';
|
|
3
|
+
import { FrontendContent } from '../../../sdk/domain/entities/frontend-content';
|
|
4
|
+
import { FrontendHttpClient } from '../../../sdk/infra/adapters/frontend-http-client';
|
|
5
|
+
import { FrontendContentDtoMapper } from '../../../sdk/infra/mappers/dto/frontend-content-dto-mapper';
|
|
6
|
+
import { ManifestFuture } from './manifest-future';
|
|
7
|
+
/**
|
|
8
|
+
* Future for content item operations that resolves key/name to ID via manifest
|
|
9
|
+
*/
|
|
10
|
+
export declare class ContentByKeyFuture extends Future<FrontendContent, never> {
|
|
11
|
+
private readonly contentKey;
|
|
12
|
+
private readonly keyType;
|
|
13
|
+
private readonly manifestFuture;
|
|
14
|
+
private readonly httpClient;
|
|
15
|
+
private readonly contentMapper;
|
|
16
|
+
private selectedLocale?;
|
|
17
|
+
constructor(contentKey: string, keyType: 'key' | 'name', manifestFuture: ManifestFuture, httpClient: FrontendHttpClient, contentMapper: FrontendContentDtoMapper);
|
|
18
|
+
/**
|
|
19
|
+
* Specify locale for content retrieval
|
|
20
|
+
*/
|
|
21
|
+
locale(locale: string): ContentByKeyFuture;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the content by first looking up ID in manifest, then fetching from API
|
|
24
|
+
*/
|
|
25
|
+
resolve(): Promise<Result<FrontendContent, any>>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=content-by-key-future.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-by-key-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-by-key-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC;IAIlE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,cAAc,CAAC,CAAS;gBAGb,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,KAAK,GAAG,MAAM,EACvB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,kBAAkB,EAC9B,aAAa,EAAE,wBAAwB;IAK1D;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB;IAY1C;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;CA8BvD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentByKeyFuture = void 0;
|
|
4
|
+
const future_1 = require("../../../std/domain/entities/future");
|
|
5
|
+
const result_1 = require("../../../std/domain/entities/result");
|
|
6
|
+
const errors_1 = require("../../../sdk/domain/errors");
|
|
7
|
+
/**
|
|
8
|
+
* Future for content item operations that resolves key/name to ID via manifest
|
|
9
|
+
*/
|
|
10
|
+
class ContentByKeyFuture extends future_1.Future {
|
|
11
|
+
contentKey;
|
|
12
|
+
keyType;
|
|
13
|
+
manifestFuture;
|
|
14
|
+
httpClient;
|
|
15
|
+
contentMapper;
|
|
16
|
+
selectedLocale;
|
|
17
|
+
constructor(contentKey, keyType, manifestFuture, httpClient, contentMapper) {
|
|
18
|
+
super({ parent: undefined });
|
|
19
|
+
this.contentKey = contentKey;
|
|
20
|
+
this.keyType = keyType;
|
|
21
|
+
this.manifestFuture = manifestFuture;
|
|
22
|
+
this.httpClient = httpClient;
|
|
23
|
+
this.contentMapper = contentMapper;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Specify locale for content retrieval
|
|
27
|
+
*/
|
|
28
|
+
locale(locale) {
|
|
29
|
+
const newFuture = new ContentByKeyFuture(this.contentKey, this.keyType, this.manifestFuture, this.httpClient, this.contentMapper);
|
|
30
|
+
newFuture.selectedLocale = locale;
|
|
31
|
+
return newFuture;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the content by first looking up ID in manifest, then fetching from API
|
|
35
|
+
*/
|
|
36
|
+
async resolve() {
|
|
37
|
+
try {
|
|
38
|
+
if (!this.selectedLocale) {
|
|
39
|
+
return (0, result_1.err)(new errors_1.WaldeValidationError('Locale must be specified for content retrieval'));
|
|
40
|
+
}
|
|
41
|
+
// Get manifest to resolve key/name to ID
|
|
42
|
+
const manifestResult = await this.manifestFuture.resolve();
|
|
43
|
+
if (manifestResult.isErr()) {
|
|
44
|
+
return (0, result_1.err)(manifestResult.unwrapErr());
|
|
45
|
+
}
|
|
46
|
+
const manifest = manifestResult.unwrap();
|
|
47
|
+
const contentMetadata = manifest.contents.find(content => this.keyType === 'key' ? content.key === this.contentKey : content.name === this.contentKey);
|
|
48
|
+
if (!contentMetadata) {
|
|
49
|
+
return (0, result_1.err)(new errors_1.WaldeValidationError(`Content with ${this.keyType} '${this.contentKey}' not found in manifest`));
|
|
50
|
+
}
|
|
51
|
+
// Fetch content using resolved ID
|
|
52
|
+
const endpoint = `/contents/${contentMetadata.id}/${this.selectedLocale}.json`;
|
|
53
|
+
const contentData = await this.httpClient.get(endpoint);
|
|
54
|
+
const content = this.contentMapper.toDomain(contentData);
|
|
55
|
+
return (0, result_1.ok)(content);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return (0, result_1.err)(error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ContentByKeyFuture = ContentByKeyFuture;
|
|
63
|
+
//# sourceMappingURL=content-by-key-future.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-by-key-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-by-key-future.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AACtD,yDAA+D;AAK/D,gDAA2D;AAE3D;;GAEG;AACH,MAAa,kBAAmB,SAAQ,eAA8B;IAIjD;IACA;IACA;IACA;IACA;IAPX,cAAc,CAAU;IAEhC,YACmB,UAAkB,EAClB,OAAuB,EACvB,cAA8B,EAC9B,UAA8B,EAC9B,aAAuC;QAExD,KAAK,CAAC,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC,CAAC;QANrB,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAgB;QACvB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAoB;QAC9B,kBAAa,GAAb,aAAa,CAA0B;IAG1D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAc;QACnB,MAAM,SAAS,GAAG,IAAI,kBAAkB,CACtC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,SAAS,CAAC,cAAc,GAAG,MAAM,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,OAAO,IAAA,YAAG,EAAC,IAAI,6BAAoB,CAAC,gDAAgD,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,yCAAyC;YACzC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3D,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;gBAC3B,OAAO,IAAA,YAAG,EAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;YACzC,CAAC;YAED,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;YACzC,MAAM,eAAe,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACvD,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,UAAU,CAC5F,CAAC;YAEF,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,OAAO,IAAA,YAAG,EAAC,IAAI,6BAAoB,CAAC,gBAAgB,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,UAAU,yBAAyB,CAAC,CAAC,CAAC;YAClH,CAAC;YAED,kCAAkC;YAClC,MAAM,QAAQ,GAAG,aAAa,eAAe,CAAC,EAAE,IAAI,IAAI,CAAC,cAAc,OAAO,CAAC;YAC/E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO,IAAA,WAAE,EAAC,OAAO,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,YAAG,EAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AA7DD,gDA6DC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { Future } from '../../../std/domain/entities/future';
|
|
2
2
|
import { Result } from '../../../std/domain/entities/result';
|
|
3
3
|
import { FrontendContent } from '../../../sdk/domain/entities/frontend-content';
|
|
4
|
-
import { ManifestContent } from '../../../sdk/domain/entities/manifest-content';
|
|
5
4
|
import { FrontendHttpClient } from '../../../sdk/infra/adapters/frontend-http-client';
|
|
6
5
|
import { FrontendContentDtoMapper } from '../../../sdk/infra/mappers/dto/frontend-content-dto-mapper';
|
|
7
6
|
/**
|
|
8
7
|
* Future for individual content item operations with locale support
|
|
9
8
|
*/
|
|
10
9
|
export declare class ContentItemFuture extends Future<FrontendContent, never> {
|
|
11
|
-
private readonly
|
|
10
|
+
private readonly contentId;
|
|
12
11
|
private readonly httpClient;
|
|
13
12
|
private readonly contentMapper;
|
|
14
13
|
private selectedLocale?;
|
|
15
|
-
constructor(
|
|
14
|
+
constructor(contentId: string, httpClient: FrontendHttpClient, contentMapper: FrontendContentDtoMapper);
|
|
16
15
|
/**
|
|
17
16
|
* Specify locale for content retrieval
|
|
18
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-item-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-item-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"content-item-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-item-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAG/F;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC;IAIjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IALhC,OAAO,CAAC,cAAc,CAAC,CAAS;gBAGb,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,kBAAkB,EAC9B,aAAa,EAAE,wBAAwB;IAK1D;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUzC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;CAcvD"}
|
|
@@ -8,13 +8,13 @@ const errors_1 = require("../../../sdk/domain/errors");
|
|
|
8
8
|
* Future for individual content item operations with locale support
|
|
9
9
|
*/
|
|
10
10
|
class ContentItemFuture extends future_1.Future {
|
|
11
|
-
|
|
11
|
+
contentId;
|
|
12
12
|
httpClient;
|
|
13
13
|
contentMapper;
|
|
14
14
|
selectedLocale;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(contentId, httpClient, contentMapper) {
|
|
16
16
|
super({ parent: undefined });
|
|
17
|
-
this.
|
|
17
|
+
this.contentId = contentId;
|
|
18
18
|
this.httpClient = httpClient;
|
|
19
19
|
this.contentMapper = contentMapper;
|
|
20
20
|
}
|
|
@@ -22,10 +22,7 @@ class ContentItemFuture extends future_1.Future {
|
|
|
22
22
|
* Specify locale for content retrieval
|
|
23
23
|
*/
|
|
24
24
|
locale(locale) {
|
|
25
|
-
|
|
26
|
-
throw new errors_1.WaldeValidationError(`Locale '${locale}' not available for content '${this.contentMetadata.name}'. Available locales: ${this.contentMetadata.locales.join(', ')}`);
|
|
27
|
-
}
|
|
28
|
-
const newFuture = new ContentItemFuture(this.contentMetadata, this.httpClient, this.contentMapper);
|
|
25
|
+
const newFuture = new ContentItemFuture(this.contentId, this.httpClient, this.contentMapper);
|
|
29
26
|
newFuture.selectedLocale = locale;
|
|
30
27
|
return newFuture;
|
|
31
28
|
}
|
|
@@ -35,9 +32,9 @@ class ContentItemFuture extends future_1.Future {
|
|
|
35
32
|
async resolve() {
|
|
36
33
|
try {
|
|
37
34
|
if (!this.selectedLocale) {
|
|
38
|
-
|
|
35
|
+
return (0, result_1.err)(new errors_1.WaldeValidationError('Locale must be specified for content retrieval'));
|
|
39
36
|
}
|
|
40
|
-
const endpoint = `/contents/${this.
|
|
37
|
+
const endpoint = `/contents/${this.contentId}/${this.selectedLocale}.json`;
|
|
41
38
|
const contentData = await this.httpClient.get(endpoint);
|
|
42
39
|
const content = this.contentMapper.toDomain(contentData);
|
|
43
40
|
return (0, result_1.ok)(content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-item-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-item-future.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AACtD,yDAA+D;
|
|
1
|
+
{"version":3,"file":"content-item-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-item-future.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AACtD,yDAA+D;AAI/D,gDAA2D;AAE3D;;GAEG;AACH,MAAa,iBAAkB,SAAQ,eAA8B;IAIhD;IACA;IACA;IALX,cAAc,CAAU;IAEhC,YACmB,SAAiB,EACjB,UAA8B,EAC9B,aAAuC;QAExD,KAAK,CAAC,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC,CAAC;QAJrB,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAoB;QAC9B,kBAAa,GAAb,aAAa,CAA0B;IAG1D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAc;QACnB,MAAM,SAAS,GAAG,IAAI,iBAAiB,CACrC,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,SAAS,CAAC,cAAc,GAAG,MAAM,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,OAAO,IAAA,YAAG,EAAC,IAAI,6BAAoB,CAAC,gDAAgD,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,QAAQ,GAAG,aAAa,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,OAAO,CAAC;YAC3E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACzD,OAAO,IAAA,WAAE,EAAC,OAAO,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,YAAG,EAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AAzCD,8CAyCC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Future } from '../../../std/domain/entities/future';
|
|
2
2
|
import { Result } from '../../../std/domain/entities/result';
|
|
3
3
|
import { ManifestContent } from '../../../sdk/domain/entities/manifest-content';
|
|
4
|
-
import {
|
|
4
|
+
import { ManifestFuture } from './manifest-future';
|
|
5
5
|
/**
|
|
6
6
|
* Future for content list operations from manifest
|
|
7
7
|
*/
|
|
8
8
|
export declare class ContentListFuture extends Future<ManifestContent[], never> {
|
|
9
|
-
private readonly
|
|
10
|
-
constructor(
|
|
9
|
+
private readonly manifestFuture;
|
|
10
|
+
constructor(manifestFuture: ManifestFuture);
|
|
11
11
|
/**
|
|
12
12
|
* Resolve the list of content metadata from manifest
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-list-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-list-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"content-list-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-list-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,eAAe,EAAE,EAAE,KAAK,CAAC;IACzD,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3D;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,GAAG,CAAC,CAAC;CAazD"}
|
|
@@ -7,16 +7,26 @@ const result_1 = require("../../../std/domain/entities/result");
|
|
|
7
7
|
* Future for content list operations from manifest
|
|
8
8
|
*/
|
|
9
9
|
class ContentListFuture extends future_1.Future {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
10
|
+
manifestFuture;
|
|
11
|
+
constructor(manifestFuture) {
|
|
12
12
|
super({ parent: undefined });
|
|
13
|
-
this.
|
|
13
|
+
this.manifestFuture = manifestFuture;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Resolve the list of content metadata from manifest
|
|
17
17
|
*/
|
|
18
18
|
async resolve() {
|
|
19
|
-
|
|
19
|
+
try {
|
|
20
|
+
const manifestResult = await this.manifestFuture.resolve();
|
|
21
|
+
if (manifestResult.isErr()) {
|
|
22
|
+
return (0, result_1.err)(manifestResult.unwrapErr());
|
|
23
|
+
}
|
|
24
|
+
const manifest = manifestResult.unwrap();
|
|
25
|
+
return (0, result_1.ok)(manifest.contents);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return (0, result_1.err)(error);
|
|
29
|
+
}
|
|
20
30
|
}
|
|
21
31
|
}
|
|
22
32
|
exports.ContentListFuture = ContentListFuture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-list-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-list-future.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"content-list-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/content-list-future.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AACtD,yDAA+D;AAI/D;;GAEG;AACH,MAAa,iBAAkB,SAAQ,eAAgC;IACxC;IAA7B,YAA6B,cAA8B;QACzD,KAAK,CAAC,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC,CAAC;QADX,mBAAc,GAAd,cAAc,CAAgB;IAE3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3D,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;gBAC3B,OAAO,IAAA,YAAG,EAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;YACzC,CAAC;YAED,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;YACzC,OAAO,IAAA,WAAE,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,YAAG,EAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AArBD,8CAqBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/credentials-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAW,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"credentials-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/credentials-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAW,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAkDhE,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC;IACpE,OAAO,CAAC,SAAS,CAA+C;gBAEpD,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAI9C,GAAG,IAAI,iBAAiB;IAMxB,OAAO,IAAI,iBAAiB;IAM5B,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAIhC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;CA6BnD"}
|
|
@@ -4,9 +4,40 @@ exports.CredentialsFuture = void 0;
|
|
|
4
4
|
const std_1 = require("../../../std");
|
|
5
5
|
const get_credentials_1 = require("../../../sdk/domain/interactors/get-credentials");
|
|
6
6
|
const refresh_credentials_1 = require("../../../sdk/domain/interactors/refresh-credentials");
|
|
7
|
-
const get_token_1 = require("../../../sdk/domain/interactors/get-token");
|
|
8
7
|
const cognito_token_refresh_provider_1 = require("../../../sdk/infra/adapters/cognito-token-refresh-provider");
|
|
9
8
|
const errors_1 = require("../../../sdk/domain/errors");
|
|
9
|
+
/**
|
|
10
|
+
* Threshold in milliseconds (5 minutes) for auto-refresh
|
|
11
|
+
*/
|
|
12
|
+
const AUTO_REFRESH_THRESHOLD_MS = 5 * 60 * 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Get valid credentials, automatically refreshing if needed
|
|
15
|
+
* @param parent WaldeAdmin instance for config access
|
|
16
|
+
* @returns Valid credentials
|
|
17
|
+
*/
|
|
18
|
+
async function getValidCredentials(parent) {
|
|
19
|
+
const config = parent.getConfig();
|
|
20
|
+
const getCredentialsInteractor = new get_credentials_1.GetCredentials(config.credentialsProvider);
|
|
21
|
+
const credentials = await getCredentialsInteractor.execute();
|
|
22
|
+
const timeToExpiry = credentials.timeToExpirationMs();
|
|
23
|
+
// Auto-refresh if token is expired or about to expire (≤5 minutes left)
|
|
24
|
+
if (timeToExpiry <= AUTO_REFRESH_THRESHOLD_MS) {
|
|
25
|
+
if (!credentials.refreshToken) {
|
|
26
|
+
// No refresh token available - return credentials as-is
|
|
27
|
+
// This will likely result in authentication errors when used
|
|
28
|
+
return credentials;
|
|
29
|
+
}
|
|
30
|
+
if (!config.config.clientId) {
|
|
31
|
+
throw new errors_1.WaldeConfigurationError('Cognito client ID not configured');
|
|
32
|
+
}
|
|
33
|
+
const tokenRefreshProvider = new cognito_token_refresh_provider_1.CognitoTokenRefreshProvider(config.config.clientId, config.config.region);
|
|
34
|
+
const refreshInteractor = new refresh_credentials_1.RefreshCredentials(config.credentialsProvider, tokenRefreshProvider);
|
|
35
|
+
return await refreshInteractor.execute();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return credentials;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
10
41
|
class CredentialsFuture extends std_1.Future {
|
|
11
42
|
operation = null;
|
|
12
43
|
constructor({ parent }) {
|
|
@@ -29,8 +60,7 @@ class CredentialsFuture extends std_1.Future {
|
|
|
29
60
|
try {
|
|
30
61
|
const config = this.parent.getConfig();
|
|
31
62
|
if (this.operation === 'get') {
|
|
32
|
-
const
|
|
33
|
-
const credentials = await interactor.execute();
|
|
63
|
+
const credentials = await getValidCredentials(this.parent);
|
|
34
64
|
return (0, std_1.ok)(credentials);
|
|
35
65
|
}
|
|
36
66
|
else if (this.operation === 'refresh') {
|
|
@@ -58,10 +88,11 @@ class TokenFuture extends std_1.Future {
|
|
|
58
88
|
}
|
|
59
89
|
async resolve() {
|
|
60
90
|
try {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
const credentials = await getValidCredentials(this.parent);
|
|
92
|
+
if (!credentials.isComplete()) {
|
|
93
|
+
throw new errors_1.WaldeConfigurationError('No valid credentials available');
|
|
94
|
+
}
|
|
95
|
+
return (0, std_1.ok)(credentials.accessToken);
|
|
65
96
|
}
|
|
66
97
|
catch (error) {
|
|
67
98
|
return (0, std_1.err)(error.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/credentials-future.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAGhD,8EAA0E;AAC1E,sFAAkF;
|
|
1
|
+
{"version":3,"file":"credentials-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/credentials-future.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import { Future } from '../../../std/domain/entities/future';
|
|
2
|
-
import { Result } from '../../../std/domain/entities/result';
|
|
3
|
-
import { Manifest } from '../../../sdk/domain/entities/manifest';
|
|
4
1
|
import { FrontendHttpClient } from '../../../sdk/infra/adapters/frontend-http-client';
|
|
5
2
|
import { FrontendContentDtoMapper } from '../../../sdk/infra/mappers/dto/frontend-content-dto-mapper';
|
|
6
|
-
import {
|
|
3
|
+
import { ManifestFuture } from './manifest-future';
|
|
7
4
|
import { ContentItemFuture } from './content-item-future';
|
|
5
|
+
import { ContentListFuture } from './content-list-future';
|
|
6
|
+
import { ContentByKeyFuture } from './content-by-key-future';
|
|
8
7
|
/**
|
|
9
|
-
* Future for frontend content operations
|
|
8
|
+
* Future for frontend content operations that fetches manifest when needed
|
|
10
9
|
*/
|
|
11
|
-
export declare class FrontendContentsFuture
|
|
12
|
-
private readonly
|
|
10
|
+
export declare class FrontendContentsFuture {
|
|
11
|
+
private readonly manifestFuture;
|
|
13
12
|
private readonly httpClient;
|
|
14
13
|
private readonly contentMapper;
|
|
15
|
-
constructor(
|
|
16
|
-
/**
|
|
17
|
-
* Resolve returns self for method chaining
|
|
18
|
-
*/
|
|
19
|
-
resolve(): Promise<Result<FrontendContentsFuture, any>>;
|
|
14
|
+
constructor(manifestFuture: ManifestFuture, httpClient: FrontendHttpClient, contentMapper: FrontendContentDtoMapper);
|
|
20
15
|
/**
|
|
21
16
|
* Get list of contents from manifest
|
|
22
17
|
*/
|
|
23
18
|
list(): ContentListFuture;
|
|
24
19
|
/**
|
|
25
|
-
* Get content by ID
|
|
20
|
+
* Get content by ID - fetches directly without manifest validation
|
|
26
21
|
*/
|
|
27
22
|
id(id: string): ContentItemFuture;
|
|
28
23
|
/**
|
|
29
|
-
* Get content by name
|
|
24
|
+
* Get content by name - resolves name to ID via manifest first
|
|
30
25
|
*/
|
|
31
|
-
name(name: string):
|
|
26
|
+
name(name: string): ContentByKeyFuture;
|
|
32
27
|
/**
|
|
33
|
-
* Get content by key
|
|
28
|
+
* Get content by key - resolves key to ID via manifest first
|
|
34
29
|
*/
|
|
35
|
-
key(key: string):
|
|
30
|
+
key(key: string): ContentByKeyFuture;
|
|
36
31
|
}
|
|
37
32
|
//# sourceMappingURL=frontend-contents-future.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-contents-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/frontend-contents-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"frontend-contents-future.d.ts","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/frontend-contents-future.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAFb,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,kBAAkB,EAC9B,aAAa,EAAE,wBAAwB;IAG1D;;OAEG;IACH,IAAI,IAAI,iBAAiB;IAIzB;;OAEG;IACH,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB;IAIjC;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB;IAItC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;CAGrC"}
|
|
@@ -1,65 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FrontendContentsFuture = void 0;
|
|
4
|
-
const future_1 = require("../../../std/domain/entities/future");
|
|
5
|
-
const result_1 = require("../../../std/domain/entities/result");
|
|
6
|
-
const content_list_future_1 = require("./content-list-future");
|
|
7
4
|
const content_item_future_1 = require("./content-item-future");
|
|
8
|
-
const
|
|
5
|
+
const content_list_future_1 = require("./content-list-future");
|
|
6
|
+
const content_by_key_future_1 = require("./content-by-key-future");
|
|
9
7
|
/**
|
|
10
|
-
* Future for frontend content operations
|
|
8
|
+
* Future for frontend content operations that fetches manifest when needed
|
|
11
9
|
*/
|
|
12
|
-
class FrontendContentsFuture
|
|
13
|
-
|
|
10
|
+
class FrontendContentsFuture {
|
|
11
|
+
manifestFuture;
|
|
14
12
|
httpClient;
|
|
15
13
|
contentMapper;
|
|
16
|
-
constructor(
|
|
17
|
-
|
|
18
|
-
this.manifest = manifest;
|
|
14
|
+
constructor(manifestFuture, httpClient, contentMapper) {
|
|
15
|
+
this.manifestFuture = manifestFuture;
|
|
19
16
|
this.httpClient = httpClient;
|
|
20
17
|
this.contentMapper = contentMapper;
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Resolve returns self for method chaining
|
|
24
|
-
*/
|
|
25
|
-
async resolve() {
|
|
26
|
-
return (0, result_1.ok)(this);
|
|
27
|
-
}
|
|
28
19
|
/**
|
|
29
20
|
* Get list of contents from manifest
|
|
30
21
|
*/
|
|
31
22
|
list() {
|
|
32
|
-
return new content_list_future_1.ContentListFuture(this.
|
|
23
|
+
return new content_list_future_1.ContentListFuture(this.manifestFuture);
|
|
33
24
|
}
|
|
34
25
|
/**
|
|
35
|
-
* Get content by ID
|
|
26
|
+
* Get content by ID - fetches directly without manifest validation
|
|
36
27
|
*/
|
|
37
28
|
id(id) {
|
|
38
|
-
|
|
39
|
-
if (!contentMetadata) {
|
|
40
|
-
throw new errors_1.WaldeValidationError(`Content with ID '${id}' not found in manifest`);
|
|
41
|
-
}
|
|
42
|
-
return new content_item_future_1.ContentItemFuture(contentMetadata, this.httpClient, this.contentMapper);
|
|
29
|
+
return new content_item_future_1.ContentItemFuture(id, this.httpClient, this.contentMapper);
|
|
43
30
|
}
|
|
44
31
|
/**
|
|
45
|
-
* Get content by name
|
|
32
|
+
* Get content by name - resolves name to ID via manifest first
|
|
46
33
|
*/
|
|
47
34
|
name(name) {
|
|
48
|
-
|
|
49
|
-
if (!contentMetadata) {
|
|
50
|
-
throw new errors_1.WaldeValidationError(`Content with name '${name}' not found in manifest`);
|
|
51
|
-
}
|
|
52
|
-
return new content_item_future_1.ContentItemFuture(contentMetadata, this.httpClient, this.contentMapper);
|
|
35
|
+
return new content_by_key_future_1.ContentByKeyFuture(name, 'name', this.manifestFuture, this.httpClient, this.contentMapper);
|
|
53
36
|
}
|
|
54
37
|
/**
|
|
55
|
-
* Get content by key
|
|
38
|
+
* Get content by key - resolves key to ID via manifest first
|
|
56
39
|
*/
|
|
57
40
|
key(key) {
|
|
58
|
-
|
|
59
|
-
if (!contentMetadata) {
|
|
60
|
-
throw new errors_1.WaldeValidationError(`Content with key '${key}' not found in manifest`);
|
|
61
|
-
}
|
|
62
|
-
return new content_item_future_1.ContentItemFuture(contentMetadata, this.httpClient, this.contentMapper);
|
|
41
|
+
return new content_by_key_future_1.ContentByKeyFuture(key, 'key', this.manifestFuture, this.httpClient, this.contentMapper);
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
exports.FrontendContentsFuture = FrontendContentsFuture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-contents-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/frontend-contents-future.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"frontend-contents-future.js","sourceRoot":"","sources":["../../../../src/sdk/infra/futures/frontend-contents-future.ts"],"names":[],"mappings":";;;AAGA,+DAA0D;AAC1D,+DAA0D;AAC1D,mEAA6D;AAE7D;;GAEG;AACH,MAAa,sBAAsB;IAEd;IACA;IACA;IAHnB,YACmB,cAA8B,EAC9B,UAA8B,EAC9B,aAAuC;QAFvC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAoB;QAC9B,kBAAa,GAAb,aAAa,CAA0B;IACvD,CAAC;IAEJ;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,uCAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,EAAE,CAAC,EAAU;QACX,OAAO,IAAI,uCAAiB,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,IAAY;QACf,OAAO,IAAI,0CAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxG,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,0CAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACtG,CAAC;CACF;AAlCD,wDAkCC"}
|