@adobe/spacecat-shared-data-access 3.23.0 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +2 -2
- package/src/models/access-grant-log/access-grant-log.collection.js +26 -0
- package/src/models/access-grant-log/access-grant-log.model.js +31 -0
- package/src/models/access-grant-log/access-grant-log.schema.js +62 -0
- package/src/models/access-grant-log/index.d.ts +37 -0
- package/src/models/access-grant-log/index.js +15 -0
- package/src/models/base/base.model.js +14 -0
- package/src/models/base/entity.registry.js +12 -0
- package/src/models/index.d.ts +2 -0
- package/src/models/index.js +4 -0
- package/src/models/sentiment-topic/index.d.ts +0 -9
- package/src/models/sentiment-topic/sentiment-topic.schema.js +0 -19
- package/src/models/site/site.schema.js +5 -0
- package/src/models/site-ims-org-access/index.d.ts +65 -0
- package/src/models/site-ims-org-access/index.js +15 -0
- package/src/models/site-ims-org-access/site-ims-org-access.collection.js +190 -0
- package/src/models/site-ims-org-access/site-ims-org-access.model.js +32 -0
- package/src/models/site-ims-org-access/site-ims-org-access.schema.js +63 -0
- package/src/models/suggestion-grant/index.d.ts +30 -0
- package/src/models/suggestion-grant/index.js +19 -0
- package/src/models/suggestion-grant/suggestion-grant.collection.js +177 -0
- package/src/models/suggestion-grant/suggestion-grant.model.js +26 -0
- package/src/models/suggestion-grant/suggestion-grant.schema.js +74 -0
- package/src/models/token/index.js +19 -0
- package/src/models/token/token.collection.js +71 -0
- package/src/models/token/token.model.js +36 -0
- package/src/models/token/token.schema.js +57 -0
- package/src/util/postgrest.utils.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-data-access-v3.25.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.24.0...@adobe/spacecat-shared-data-access-v3.25.0) (2026-03-19)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* cross-org delegation entity models and AuthInfo extensions ([#1448](https://github.com/adobe/spacecat-shared/issues/1448)) ([b0cb091](https://github.com/adobe/spacecat-shared/commit/b0cb091432f15eb304e20263c0a18ec794d93bb9))
|
|
6
|
+
|
|
7
|
+
## [@adobe/spacecat-shared-data-access-v3.24.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.23.0...@adobe/spacecat-shared-data-access-v3.24.0) (2026-03-19)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* SITES-40623 - token system in Spacecat ([#1414](https://github.com/adobe/spacecat-shared/issues/1414)) ([9c540ba](https://github.com/adobe/spacecat-shared/commit/9c540babf47984e15737bde509b54df9b5233c54))
|
|
12
|
+
|
|
1
13
|
## [@adobe/spacecat-shared-data-access-v3.23.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.22.0...@adobe/spacecat-shared-data-access-v3.23.0) (2026-03-18)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-data-access",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@adobe/fetch": "^4.2.3",
|
|
44
|
-
"@adobe/spacecat-shared-utils": "1.
|
|
44
|
+
"@adobe/spacecat-shared-utils": "1.105.0",
|
|
45
45
|
"@supabase/postgrest-js": "2.99.1",
|
|
46
46
|
"@aws-sdk/client-s3": "^3.940.0",
|
|
47
47
|
"@types/joi": "17.2.3",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseCollection from '../base/base.collection.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AccessGrantLogCollection - Collection of immutable audit log entries.
|
|
17
|
+
* Supports creation and querying only (no update/delete at the app layer).
|
|
18
|
+
*
|
|
19
|
+
* @class AccessGrantLogCollection
|
|
20
|
+
* @extends BaseCollection
|
|
21
|
+
*/
|
|
22
|
+
class AccessGrantLogCollection extends BaseCollection {
|
|
23
|
+
static COLLECTION_NAME = 'AccessGrantLogCollection';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default AccessGrantLogCollection;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseModel from '../base/base.model.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AccessGrantLog - Immutable audit log entry for cross-org delegation grant/revoke actions.
|
|
17
|
+
* site_id and organization_id are TEXT (not FK) — values survive entity deletion.
|
|
18
|
+
*
|
|
19
|
+
* @class AccessGrantLog
|
|
20
|
+
* @extends BaseModel
|
|
21
|
+
*/
|
|
22
|
+
class AccessGrantLog extends BaseModel {
|
|
23
|
+
static ENTITY_NAME = 'AccessGrantLog';
|
|
24
|
+
|
|
25
|
+
static GRANT_ACTIONS = {
|
|
26
|
+
GRANT: 'grant',
|
|
27
|
+
REVOKE: 'revoke',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default AccessGrantLog;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { isValidUUID } from '@adobe/spacecat-shared-utils';
|
|
14
|
+
import { Entitlement } from '../entitlement/index.js';
|
|
15
|
+
import SiteImsOrgAccess from '../site-ims-org-access/site-ims-org-access.model.js';
|
|
16
|
+
import SchemaBuilder from '../base/schema.builder.js';
|
|
17
|
+
import AccessGrantLog from './access-grant-log.model.js';
|
|
18
|
+
import AccessGrantLogCollection from './access-grant-log.collection.js';
|
|
19
|
+
|
|
20
|
+
const PERFORMED_BY_PATTERN = /^(ims:\S+|slack:\S+|system)$/;
|
|
21
|
+
|
|
22
|
+
const schema = new SchemaBuilder(AccessGrantLog, AccessGrantLogCollection)
|
|
23
|
+
.allowUpdates(false)
|
|
24
|
+
.allowRemove(false)
|
|
25
|
+
// siteId, organizationId, and targetOrganizationId are plain addAttribute (not belongs_to)
|
|
26
|
+
// because the DB columns are TEXT, not FK. Audit logs must preserve UUIDs after entity deletion.
|
|
27
|
+
.addAttribute('siteId', {
|
|
28
|
+
type: 'string',
|
|
29
|
+
required: true,
|
|
30
|
+
validate: (v) => isValidUUID(v),
|
|
31
|
+
})
|
|
32
|
+
.addAttribute('organizationId', {
|
|
33
|
+
type: 'string',
|
|
34
|
+
required: true,
|
|
35
|
+
validate: (v) => isValidUUID(v),
|
|
36
|
+
})
|
|
37
|
+
.addAttribute('targetOrganizationId', {
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: true,
|
|
40
|
+
validate: (v) => isValidUUID(v),
|
|
41
|
+
})
|
|
42
|
+
.addAttribute('productCode', {
|
|
43
|
+
type: Object.values(Entitlement.PRODUCT_CODES),
|
|
44
|
+
required: true,
|
|
45
|
+
})
|
|
46
|
+
.addAttribute('action', {
|
|
47
|
+
type: Object.values(AccessGrantLog.GRANT_ACTIONS),
|
|
48
|
+
required: true,
|
|
49
|
+
})
|
|
50
|
+
.addAttribute('role', {
|
|
51
|
+
type: Object.values(SiteImsOrgAccess.DELEGATION_ROLES),
|
|
52
|
+
required: true,
|
|
53
|
+
})
|
|
54
|
+
.addAttribute('performedBy', {
|
|
55
|
+
type: 'string',
|
|
56
|
+
required: true,
|
|
57
|
+
validate: (v) => PERFORMED_BY_PATTERN.test(v),
|
|
58
|
+
})
|
|
59
|
+
.addAllIndex(['organizationId'])
|
|
60
|
+
.addAllIndex(['siteId']);
|
|
61
|
+
|
|
62
|
+
export default schema.build();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
BaseCollection, BaseModel, EntitlementProductCode,
|
|
15
|
+
} from '../index';
|
|
16
|
+
|
|
17
|
+
export type AccessGrantAction = 'grant' | 'revoke';
|
|
18
|
+
export type AccessGrantRole = 'collaborator' | 'agency' | 'viewer';
|
|
19
|
+
|
|
20
|
+
export interface AccessGrantLog extends BaseModel {
|
|
21
|
+
getSiteId(): string;
|
|
22
|
+
getOrganizationId(): string;
|
|
23
|
+
getTargetOrganizationId(): string;
|
|
24
|
+
getProductCode(): EntitlementProductCode;
|
|
25
|
+
getAction(): AccessGrantAction;
|
|
26
|
+
getRole(): AccessGrantRole;
|
|
27
|
+
getPerformedBy(): string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AccessGrantLogCollection extends
|
|
31
|
+
BaseCollection<AccessGrantLog> {
|
|
32
|
+
allByOrganizationId(organizationId: string): Promise<AccessGrantLog[]>;
|
|
33
|
+
allBySiteId(siteId: string): Promise<AccessGrantLog[]>;
|
|
34
|
+
|
|
35
|
+
findByOrganizationId(organizationId: string): Promise<AccessGrantLog | null>;
|
|
36
|
+
findBySiteId(siteId: string): Promise<AccessGrantLog | null>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as AccessGrantLog } from './access-grant-log.model.js';
|
|
14
|
+
export { default as AccessGrantLogCollection } from './access-grant-log.collection.js';
|
|
15
|
+
export { default as AccessGrantLogSchema } from './access-grant-log.schema.js';
|
|
@@ -176,6 +176,20 @@ class BaseModel {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
return null;
|
|
179
|
+
})
|
|
180
|
+
.catch((error) => {
|
|
181
|
+
// Gracefully skip dependents whose table/column is absent from the PostgREST
|
|
182
|
+
// schema cache (e.g. when the legacy test DB pre-dates this table). All other
|
|
183
|
+
// errors are re-thrown so they still surface as removal failures.
|
|
184
|
+
const msg = error?.cause?.message || error?.message || '';
|
|
185
|
+
if (
|
|
186
|
+
msg.includes('Could not find the')
|
|
187
|
+
&& (msg.includes('table') || msg.includes('column'))
|
|
188
|
+
&& msg.includes('schema cache')
|
|
189
|
+
) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
throw error;
|
|
179
193
|
}),
|
|
180
194
|
);
|
|
181
195
|
});
|
|
@@ -38,14 +38,18 @@ import SiteEnrollmentCollection from '../site-enrollment/site-enrollment.collect
|
|
|
38
38
|
import SiteTopFormCollection from '../site-top-form/site-top-form.collection.js';
|
|
39
39
|
import SiteTopPageCollection from '../site-top-page/site-top-page.collection.js';
|
|
40
40
|
import SuggestionCollection from '../suggestion/suggestion.collection.js';
|
|
41
|
+
import SuggestionGrantCollection from '../suggestion-grant/suggestion-grant.collection.js';
|
|
41
42
|
import PageIntentCollection from '../page-intent/page-intent.collection.js';
|
|
42
43
|
import ReportCollection from '../report/report.collection.js';
|
|
43
44
|
import TrialUserCollection from '../trial-user/trial-user.collection.js';
|
|
44
45
|
import TrialUserActivityCollection from '../trial-user-activity/trial-user-activity.collection.js';
|
|
46
|
+
import TokenCollection from '../token/token.collection.js';
|
|
45
47
|
import PageCitabilityCollection from '../page-citability/page-citability.collection.js';
|
|
46
48
|
import PlgOnboardingCollection from '../plg-onboarding/plg-onboarding.collection.js';
|
|
47
49
|
import SentimentGuidelineCollection from '../sentiment-guideline/sentiment-guideline.collection.js';
|
|
48
50
|
import SentimentTopicCollection from '../sentiment-topic/sentiment-topic.collection.js';
|
|
51
|
+
import AccessGrantLogCollection from '../access-grant-log/access-grant-log.collection.js';
|
|
52
|
+
import SiteImsOrgAccessCollection from '../site-ims-org-access/site-ims-org-access.collection.js';
|
|
49
53
|
|
|
50
54
|
import ApiKeySchema from '../api-key/api-key.schema.js';
|
|
51
55
|
import AsyncJobSchema from '../async-job/async-job.schema.js';
|
|
@@ -71,14 +75,18 @@ import SiteEnrollmentSchema from '../site-enrollment/site-enrollment.schema.js';
|
|
|
71
75
|
import SiteTopFormSchema from '../site-top-form/site-top-form.schema.js';
|
|
72
76
|
import SiteTopPageSchema from '../site-top-page/site-top-page.schema.js';
|
|
73
77
|
import SuggestionSchema from '../suggestion/suggestion.schema.js';
|
|
78
|
+
import SuggestionGrantSchema from '../suggestion-grant/suggestion-grant.schema.js';
|
|
74
79
|
import PageIntentSchema from '../page-intent/page-intent.schema.js';
|
|
75
80
|
import ReportSchema from '../report/report.schema.js';
|
|
76
81
|
import TrialUserSchema from '../trial-user/trial-user.schema.js';
|
|
77
82
|
import TrialUserActivitySchema from '../trial-user-activity/trial-user-activity.schema.js';
|
|
83
|
+
import TokenSchema from '../token/token.schema.js';
|
|
78
84
|
import PageCitabilitySchema from '../page-citability/page-citability.schema.js';
|
|
79
85
|
import PlgOnboardingSchema from '../plg-onboarding/plg-onboarding.schema.js';
|
|
80
86
|
import SentimentGuidelineSchema from '../sentiment-guideline/sentiment-guideline.schema.js';
|
|
81
87
|
import SentimentTopicSchema from '../sentiment-topic/sentiment-topic.schema.js';
|
|
88
|
+
import AccessGrantLogSchema from '../access-grant-log/access-grant-log.schema.js';
|
|
89
|
+
import SiteImsOrgAccessSchema from '../site-ims-org-access/site-ims-org-access.schema.js';
|
|
82
90
|
|
|
83
91
|
/**
|
|
84
92
|
* EntityRegistry - A registry class responsible for managing entities, their schema and collection.
|
|
@@ -199,14 +207,18 @@ EntityRegistry.registerEntity(SiteEnrollmentSchema, SiteEnrollmentCollection);
|
|
|
199
207
|
EntityRegistry.registerEntity(SiteTopFormSchema, SiteTopFormCollection);
|
|
200
208
|
EntityRegistry.registerEntity(SiteTopPageSchema, SiteTopPageCollection);
|
|
201
209
|
EntityRegistry.registerEntity(SuggestionSchema, SuggestionCollection);
|
|
210
|
+
EntityRegistry.registerEntity(SuggestionGrantSchema, SuggestionGrantCollection);
|
|
202
211
|
EntityRegistry.registerEntity(PageIntentSchema, PageIntentCollection);
|
|
203
212
|
EntityRegistry.registerEntity(ReportSchema, ReportCollection);
|
|
204
213
|
EntityRegistry.registerEntity(TrialUserSchema, TrialUserCollection);
|
|
205
214
|
EntityRegistry.registerEntity(TrialUserActivitySchema, TrialUserActivityCollection);
|
|
215
|
+
EntityRegistry.registerEntity(TokenSchema, TokenCollection);
|
|
206
216
|
EntityRegistry.registerEntity(PageCitabilitySchema, PageCitabilityCollection);
|
|
207
217
|
EntityRegistry.registerEntity(PlgOnboardingSchema, PlgOnboardingCollection);
|
|
208
218
|
EntityRegistry.registerEntity(SentimentGuidelineSchema, SentimentGuidelineCollection);
|
|
209
219
|
EntityRegistry.registerEntity(SentimentTopicSchema, SentimentTopicCollection);
|
|
220
|
+
EntityRegistry.registerEntity(AccessGrantLogSchema, AccessGrantLogCollection);
|
|
221
|
+
EntityRegistry.registerEntity(SiteImsOrgAccessSchema, SiteImsOrgAccessCollection);
|
|
210
222
|
EntityRegistry.defaultEntities = { ...EntityRegistry.entities };
|
|
211
223
|
|
|
212
224
|
export default EntityRegistry;
|
package/src/models/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
export type * from './access-grant-log';
|
|
13
14
|
export type * from './api-key';
|
|
14
15
|
export type * from './async-job';
|
|
15
16
|
export type * from './audit';
|
|
@@ -39,6 +40,7 @@ export type * from './sentiment-topic';
|
|
|
39
40
|
export type * from './site';
|
|
40
41
|
export type * from './site-candidate';
|
|
41
42
|
export type * from './site-enrollment';
|
|
43
|
+
export type * from './site-ims-org-access';
|
|
42
44
|
export type * from './site-top-form';
|
|
43
45
|
export type * from './site-top-page';
|
|
44
46
|
export type * from './suggestion';
|
package/src/models/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
export * from './access-grant-log/index.js';
|
|
13
14
|
export * from './api-key/index.js';
|
|
14
15
|
export * from './async-job/index.js';
|
|
15
16
|
export * from './audit/index.js';
|
|
@@ -32,14 +33,17 @@ export * from './scrape-job/index.js';
|
|
|
32
33
|
export * from './scrape-url/index.js';
|
|
33
34
|
export * from './site-candidate/index.js';
|
|
34
35
|
export * from './site-enrollment/index.js';
|
|
36
|
+
export * from './site-ims-org-access/index.js';
|
|
35
37
|
export * from './site-top-form/index.js';
|
|
36
38
|
export * from './site-top-page/index.js';
|
|
37
39
|
export * from './site/index.js';
|
|
38
40
|
export * from './suggestion/index.js';
|
|
41
|
+
export * from './suggestion-grant/index.js';
|
|
39
42
|
export * from './page-intent/index.js';
|
|
40
43
|
export * from './report/index.js';
|
|
41
44
|
export * from './trial-user/index.js';
|
|
42
45
|
export * from './trial-user-activity/index.js';
|
|
46
|
+
export * from './token/index.js';
|
|
43
47
|
export * from './page-citability/index.js';
|
|
44
48
|
export * from './plg-onboarding/index.js';
|
|
45
49
|
export * from './sentiment-guideline/index.js';
|
|
@@ -16,18 +16,10 @@ import type { BaseCollection, BaseModel, Site } from '../index';
|
|
|
16
16
|
* SentimentTopic entity representing a topic for sentiment analysis.
|
|
17
17
|
* Composite primary key: siteId (PK) + topicId (SK)
|
|
18
18
|
*/
|
|
19
|
-
export interface SentimentTopicUrl {
|
|
20
|
-
url: string;
|
|
21
|
-
timesCited: number;
|
|
22
|
-
category?: string;
|
|
23
|
-
subPrompts?: string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
19
|
export interface SentimentTopic extends BaseModel {
|
|
27
20
|
getTopicId(): string;
|
|
28
21
|
getName(): string;
|
|
29
22
|
getDescription(): string | undefined;
|
|
30
|
-
getUrls(): SentimentTopicUrl[];
|
|
31
23
|
getEnabled(): boolean;
|
|
32
24
|
getCreatedAt(): string;
|
|
33
25
|
getCreatedBy(): string;
|
|
@@ -38,7 +30,6 @@ export interface SentimentTopic extends BaseModel {
|
|
|
38
30
|
|
|
39
31
|
setName(name: string): SentimentTopic;
|
|
40
32
|
setDescription(description: string): SentimentTopic;
|
|
41
|
-
setUrls(urls: SentimentTopicUrl[]): SentimentTopic;
|
|
42
33
|
setEnabled(enabled: boolean): SentimentTopic;
|
|
43
34
|
setUpdatedBy(updatedBy: string): SentimentTopic;
|
|
44
35
|
}
|
|
@@ -55,25 +55,6 @@ const schema = new SchemaBuilder(SentimentTopic, SentimentTopicCollection)
|
|
|
55
55
|
type: 'string',
|
|
56
56
|
required: false,
|
|
57
57
|
})
|
|
58
|
-
.addAttribute('urls', {
|
|
59
|
-
type: 'list',
|
|
60
|
-
required: false,
|
|
61
|
-
default: [],
|
|
62
|
-
items: {
|
|
63
|
-
type: 'map',
|
|
64
|
-
properties: {
|
|
65
|
-
url: { type: 'string', required: true },
|
|
66
|
-
timesCited: { type: 'number', required: true },
|
|
67
|
-
category: { type: 'string', required: false },
|
|
68
|
-
subPrompts: {
|
|
69
|
-
type: 'list',
|
|
70
|
-
items: { type: 'string' },
|
|
71
|
-
required: false,
|
|
72
|
-
default: [],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
58
|
.addAttribute('enabled', {
|
|
78
59
|
type: 'boolean',
|
|
79
60
|
required: true,
|
|
@@ -43,6 +43,11 @@ const schema = new SchemaBuilder(Site, SiteCollection)
|
|
|
43
43
|
.addReference('has_many', 'Opportunities')
|
|
44
44
|
.addReference('has_many', 'SiteCandidates')
|
|
45
45
|
.addReference('has_many', 'SiteEnrollments')
|
|
46
|
+
// TODO(Phase 2 audit gap): removeDependents silently removes all SiteImsOrgAccess records on
|
|
47
|
+
// site deletion without writing AccessGrantLog 'revoke' entries. Anyone auditing "why did
|
|
48
|
+
// agency X lose access to site Y" will find nothing in the log. Add a model-level pre-remove
|
|
49
|
+
// hook that writes revoke audit entries before this ships to production.
|
|
50
|
+
.addReference('has_many', 'SiteImsOrgAccesses', [], { removeDependents: true })
|
|
46
51
|
.addReference('has_many', 'SiteTopForms')
|
|
47
52
|
.addReference('has_many', 'SiteTopPages')
|
|
48
53
|
.addReference('has_many', 'TrialUserActivities')
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
BaseCollection, BaseModel, EntitlementProductCode, Organization, Site,
|
|
15
|
+
} from '../index';
|
|
16
|
+
|
|
17
|
+
export type SiteImsOrgAccessRole = 'collaborator' | 'agency' | 'viewer';
|
|
18
|
+
|
|
19
|
+
export interface SiteImsOrgAccess extends BaseModel {
|
|
20
|
+
getSite(): Promise<Site>;
|
|
21
|
+
getOrganization(): Promise<Organization>;
|
|
22
|
+
getSiteId(): string;
|
|
23
|
+
/** organizationId is the delegate org receiving access (read-only, part of grant identity). */
|
|
24
|
+
getOrganizationId(): string;
|
|
25
|
+
/** targetOrganizationId is the site-owning org (read-only, part of grant identity). */
|
|
26
|
+
getTargetOrganizationId(): string;
|
|
27
|
+
/** productCode is read-only; changing scope requires a new grant. */
|
|
28
|
+
getProductCode(): EntitlementProductCode;
|
|
29
|
+
getRole(): SiteImsOrgAccessRole;
|
|
30
|
+
getGrantedBy(): string | null;
|
|
31
|
+
getExpiresAt(): string | null;
|
|
32
|
+
setRole(role: SiteImsOrgAccessRole): SiteImsOrgAccess;
|
|
33
|
+
setGrantedBy(grantedBy: string): SiteImsOrgAccess;
|
|
34
|
+
setExpiresAt(expiresAt: string): SiteImsOrgAccess;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SiteImsOrgAccessGrantWithTarget {
|
|
38
|
+
grant: {
|
|
39
|
+
id: string;
|
|
40
|
+
siteId: string;
|
|
41
|
+
organizationId: string;
|
|
42
|
+
targetOrganizationId: string;
|
|
43
|
+
productCode: EntitlementProductCode;
|
|
44
|
+
role: SiteImsOrgAccessRole;
|
|
45
|
+
grantedBy: string | null;
|
|
46
|
+
expiresAt: string | null;
|
|
47
|
+
};
|
|
48
|
+
targetOrganization: {
|
|
49
|
+
id: string;
|
|
50
|
+
imsOrgId: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SiteImsOrgAccessCollection extends
|
|
55
|
+
BaseCollection<SiteImsOrgAccess> {
|
|
56
|
+
allBySiteId(siteId: string): Promise<SiteImsOrgAccess[]>;
|
|
57
|
+
allByOrganizationId(organizationId: string): Promise<SiteImsOrgAccess[]>;
|
|
58
|
+
allByTargetOrganizationId(targetOrganizationId: string): Promise<SiteImsOrgAccess[]>;
|
|
59
|
+
allByOrganizationIdWithTargetOrganization(organizationId: string): Promise<SiteImsOrgAccessGrantWithTarget[]>;
|
|
60
|
+
allByOrganizationIdsWithTargetOrganization(organizationIds: string[]): Promise<SiteImsOrgAccessGrantWithTarget[]>;
|
|
61
|
+
|
|
62
|
+
findBySiteId(siteId: string): Promise<SiteImsOrgAccess | null>;
|
|
63
|
+
findByOrganizationId(organizationId: string): Promise<SiteImsOrgAccess | null>;
|
|
64
|
+
findByTargetOrganizationId(targetOrganizationId: string): Promise<SiteImsOrgAccess | null>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as SiteImsOrgAccess } from './site-ims-org-access.model.js';
|
|
14
|
+
export { default as SiteImsOrgAccessCollection } from './site-ims-org-access.collection.js';
|
|
15
|
+
export { default as SiteImsOrgAccessSchema } from './site-ims-org-access.schema.js';
|