@toolproof-npm/shared 0.1.42 → 0.1.43
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResourceTypeIdJson } from '@toolproof-npm/schema';
|
|
2
2
|
import type { ResourceShapeConst, ResourceRoleConst, StepConst, WorkflowConst, ResourceMap, ResourceConst } from './types.d.ts';
|
|
3
3
|
export declare function getNewId(identifiable: ResourceShapeConst | ResourceRoleConst | ResourceConst | StepConst | WorkflowConst): string;
|
|
4
|
-
export declare function listResources(
|
|
4
|
+
export declare function listResources(// ATTENTION: must clean up
|
|
5
|
+
resourceTypeIds: ResourceTypeIdJson[]): Promise<ResourceMap>;
|
|
@@ -7,7 +7,8 @@ export function getNewId(identifiable) {
|
|
|
7
7
|
const docRef = dbAdmin.collection(CONSTANTS.STORAGE.COLLECTIONS.shapes).doc(identifiable).collection(CONSTANTS.STORAGE.FILTER.members).doc();
|
|
8
8
|
return prefix + docRef.id;
|
|
9
9
|
}
|
|
10
|
-
export async function listResources(
|
|
10
|
+
export async function listResources(// ATTENTION: must clean up
|
|
11
|
+
resourceTypeIds) {
|
|
11
12
|
const bucket = storageAdmin.bucket(CONSTANTS.STORAGE.BUCKETS.tp_resources);
|
|
12
13
|
async function fetchFilesUnder(resourceTypeId) {
|
|
13
14
|
const prefix = `${resourceTypeId}/`;
|
|
@@ -89,7 +90,7 @@ export async function listResources(resourceTypeIds) {
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
const
|
|
93
|
+
const identity = root.identity;
|
|
93
94
|
const resourceTypeIdMeta = root.resourceTypeId;
|
|
94
95
|
// creationContext may be flattened as creationContext.resourceRoleId or direct resourceRoleId
|
|
95
96
|
const resourceRoleId = (root.creationContext?.resourceRoleId ?? root.resourceRoleId);
|
|
@@ -98,7 +99,7 @@ export async function listResources(resourceTypeIds) {
|
|
|
98
99
|
const path = root.path;
|
|
99
100
|
const timestamp = root.timestamp;
|
|
100
101
|
const missing = [
|
|
101
|
-
['
|
|
102
|
+
['identity', identity],
|
|
102
103
|
['resourceTypeId', resourceTypeIdMeta],
|
|
103
104
|
['resourceRoleId', resourceRoleId],
|
|
104
105
|
['executionId', executionId],
|
|
@@ -111,11 +112,11 @@ export async function listResources(resourceTypeIds) {
|
|
|
111
112
|
throw new Error(`Missing required metadata keys [${keys}] for resource file: ${name}`);
|
|
112
113
|
}
|
|
113
114
|
return {
|
|
114
|
-
|
|
115
|
-
resourceTypeId
|
|
115
|
+
identity,
|
|
116
|
+
resourceTypeId,
|
|
116
117
|
creationContext: {
|
|
117
|
-
resourceRoleId
|
|
118
|
-
executionId
|
|
118
|
+
resourceRoleId,
|
|
119
|
+
executionId,
|
|
119
120
|
},
|
|
120
121
|
kind: kind,
|
|
121
122
|
path: path,
|
package/dist/types.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export type Role = {
|
|
|
13
13
|
} & ResourceRoleValueJson;
|
|
14
14
|
export type ResourceRawMetaMap = Record<ResourceTypeIdJson, ResourceRawMetaJson[]>;
|
|
15
15
|
export type ResourceMap = Record<ResourceTypeIdJson, ResourceJson[]>;
|
|
16
|
-
export type
|
|
17
|
-
|
|
16
|
+
export type PartialResourceMeta = {
|
|
17
|
+
identity: ResourceIdJson;
|
|
18
18
|
resourceTypeId: ResourceTypeIdJson;
|
|
19
19
|
creationContext: {
|
|
20
20
|
resourceRoleId: ResourceRoleIdJson;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolproof-npm/shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"description": "Core library utilities for ToolProof",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"toolproof",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typescript": "^5.9.3"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@toolproof-npm/schema": "^0.1.
|
|
55
|
+
"@toolproof-npm/schema": "^0.1.36",
|
|
56
56
|
"firebase-admin": "^13.6.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|