@toolproof-npm/shared 0.1.14 → 0.1.18
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/README.md +56 -55
- package/dist/constants.d.ts +4 -4
- package/dist/constants.js +4 -4
- package/dist/firestoreAdminHelpers.d.ts +4 -4
- package/dist/firestoreAdminHelpers.js +5 -5
- package/dist/types.d.ts +8 -8
- package/package.json +60 -60
package/README.md
CHANGED
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
# @toolproof-npm/shared
|
|
2
|
-
|
|
3
|
-
Core library utilities for ToolProof.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @toolproof-npm/shared
|
|
9
|
-
# or
|
|
10
|
-
npm install @toolproof-npm/shared
|
|
11
|
-
# or
|
|
12
|
-
yarn add @toolproof-npm/shared
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
### Basic Import
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
import { /* your exports */ } from '@toolproof-npm/shared';
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Constants
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import { /* constants */ } from '@toolproof-npm/shared/constants';
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Types
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { /* types */ } from '@toolproof-npm/shared/types';
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Server Utilities (Node.js only)
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import { /* server utilities */ } from '@toolproof-npm/shared/server';
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Features
|
|
42
|
-
|
|
43
|
-
- TypeScript support with full type definitions
|
|
44
|
-
- ESM module format
|
|
45
|
-
- Tree-shakeable exports
|
|
46
|
-
- Server-side utilities for Firestore admin operations
|
|
47
|
-
|
|
48
|
-
## Requirements
|
|
49
|
-
|
|
50
|
-
- Node.js 16+
|
|
51
|
-
- TypeScript 4.5+ (for TypeScript projects)
|
|
52
|
-
|
|
53
|
-
## License
|
|
54
|
-
|
|
55
|
-
MIT
|
|
1
|
+
# @toolproof-npm/shared
|
|
2
|
+
|
|
3
|
+
Core library utilities for ToolProof.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @toolproof-npm/shared
|
|
9
|
+
# or
|
|
10
|
+
npm install @toolproof-npm/shared
|
|
11
|
+
# or
|
|
12
|
+
yarn add @toolproof-npm/shared
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic Import
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { /* your exports */ } from '@toolproof-npm/shared';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Constants
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { /* constants */ } from '@toolproof-npm/shared/constants';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { /* types */ } from '@toolproof-npm/shared/types';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Server Utilities (Node.js only)
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { /* server utilities */ } from '@toolproof-npm/shared/server';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- TypeScript support with full type definitions
|
|
44
|
+
- ESM module format
|
|
45
|
+
- Tree-shakeable exports
|
|
46
|
+
- Server-side utilities for Firestore admin operations
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
- Node.js 16+
|
|
51
|
+
- TypeScript 4.5+ (for TypeScript projects)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
56
|
+
|
package/dist/constants.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export declare const CONSTANTS: {
|
|
|
9
9
|
};
|
|
10
10
|
readonly STORAGE: {
|
|
11
11
|
readonly BUCKETS: {
|
|
12
|
-
readonly
|
|
12
|
+
readonly tp_archetypes: "tp-archetypes";
|
|
13
13
|
readonly tp_resources: "tp-resources";
|
|
14
14
|
};
|
|
15
15
|
readonly COLLECTIONS: {
|
|
16
|
-
readonly
|
|
16
|
+
readonly archetypes: "archetypes";
|
|
17
17
|
readonly resources: "resources";
|
|
18
18
|
};
|
|
19
19
|
readonly FILTER: {
|
|
@@ -21,11 +21,11 @@ export declare const CONSTANTS: {
|
|
|
21
21
|
readonly specials: "specials";
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
readonly
|
|
24
|
+
readonly ARCHETYPES: {
|
|
25
25
|
readonly formats: "formats";
|
|
26
26
|
readonly types: "types";
|
|
27
27
|
};
|
|
28
|
-
readonly
|
|
28
|
+
readonly ARCHETYPES_PSEUDO: {
|
|
29
29
|
readonly roles: "roles";
|
|
30
30
|
};
|
|
31
31
|
readonly RESOURCES: {
|
package/dist/constants.js
CHANGED
|
@@ -9,11 +9,11 @@ export const CONSTANTS = {
|
|
|
9
9
|
},
|
|
10
10
|
STORAGE: {
|
|
11
11
|
BUCKETS: {
|
|
12
|
-
|
|
12
|
+
tp_archetypes: 'tp-archetypes',
|
|
13
13
|
tp_resources: 'tp-resources',
|
|
14
14
|
},
|
|
15
15
|
COLLECTIONS: {
|
|
16
|
-
|
|
16
|
+
archetypes: 'archetypes',
|
|
17
17
|
resources: 'resources',
|
|
18
18
|
},
|
|
19
19
|
FILTER: {
|
|
@@ -21,11 +21,11 @@ export const CONSTANTS = {
|
|
|
21
21
|
specials: 'specials',
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
ARCHETYPES: {
|
|
25
25
|
formats: 'formats',
|
|
26
26
|
types: 'types',
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
ARCHETYPES_PSEUDO: {
|
|
29
29
|
roles: 'roles',
|
|
30
30
|
},
|
|
31
31
|
RESOURCES: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TypeIdJson } from '@toolproof-npm/schema';
|
|
2
|
-
import type { FilterConst,
|
|
3
|
-
export declare function getNewId(identifiable:
|
|
4
|
-
export declare function
|
|
2
|
+
import type { FilterConst, ArchetypeConst, RoleConst, StepConst, WorkflowConst, ArchetypeMeta, ArchetypeData, ArchetypeMetaMap, ArchetypeDataMap, ResourceMetaMap, ResourceDataMap, ResourceConst } from './types.d.ts';
|
|
3
|
+
export declare function getNewId(identifiable: ArchetypeConst | RoleConst | ResourceConst | StepConst | WorkflowConst): string;
|
|
4
|
+
export declare function listArchetypesMeta<T extends ArchetypeMeta>(groupKey: ArchetypeConst, filterConfig: Record<FilterConst, boolean>): Promise<ArchetypeMetaMap<T>>;
|
|
5
5
|
export declare function listResourcesMeta(typeIds: TypeIdJson[]): Promise<ResourceMetaMap>;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function listArchetypesData<T extends ArchetypeData>(groupKey: ArchetypeConst, filterConfig: Record<FilterConst, boolean>): Promise<ArchetypeDataMap<T>>;
|
|
7
7
|
export declare function listResourcesData(typeIds: TypeIdJson[]): Promise<ResourceDataMap>;
|
|
@@ -4,12 +4,12 @@ export function getNewId(identifiable) {
|
|
|
4
4
|
const base = identifiable.toUpperCase();
|
|
5
5
|
const normalized = base.endsWith('S') ? base.slice(0, -1) : base;
|
|
6
6
|
const prefix = normalized + '-';
|
|
7
|
-
const docRef = dbAdmin.collection(CONSTANTS.STORAGE.COLLECTIONS.
|
|
7
|
+
const docRef = dbAdmin.collection(CONSTANTS.STORAGE.COLLECTIONS.archetypes).doc(identifiable).collection(CONSTANTS.STORAGE.FILTER.members).doc();
|
|
8
8
|
return prefix + docRef.id;
|
|
9
9
|
}
|
|
10
|
-
export async function
|
|
10
|
+
export async function listArchetypesMeta(groupKey, filterConfig) {
|
|
11
11
|
const baseRef = dbAdmin
|
|
12
|
-
.collection(CONSTANTS.STORAGE.COLLECTIONS.
|
|
12
|
+
.collection(CONSTANTS.STORAGE.COLLECTIONS.archetypes)
|
|
13
13
|
.doc(groupKey);
|
|
14
14
|
const entries = await Promise.all([
|
|
15
15
|
filterConfig.members
|
|
@@ -45,8 +45,8 @@ export async function listResourcesMeta(typeIds) {
|
|
|
45
45
|
}));
|
|
46
46
|
return Object.fromEntries(entries);
|
|
47
47
|
}
|
|
48
|
-
export async function
|
|
49
|
-
const bucket = storageAdmin.bucket(CONSTANTS.STORAGE.BUCKETS.
|
|
48
|
+
export async function listArchetypesData(groupKey, filterConfig) {
|
|
49
|
+
const bucket = storageAdmin.bucket(CONSTANTS.STORAGE.BUCKETS.tp_archetypes);
|
|
50
50
|
const prefix = `${groupKey}/`;
|
|
51
51
|
const [files] = await bucket.getFiles({ prefix });
|
|
52
52
|
const result = {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ResourceIdJson, ExecutionIdJson, RoleIdJson, RoleLiteralJson, TypeIdJson, FormatMetaJson, FormatDataJson, TypeMetaJson, TypeDataJson, ResourceMetaJson, ResourceDataJson } from '@toolproof-npm/schema';
|
|
2
2
|
import { CONSTANTS } from './constants.js';
|
|
3
|
-
export type BucketConst = typeof CONSTANTS.STORAGE.BUCKETS.
|
|
4
|
-
export type CollectionConst = typeof CONSTANTS.STORAGE.COLLECTIONS.
|
|
3
|
+
export type BucketConst = typeof CONSTANTS.STORAGE.BUCKETS.tp_archetypes | typeof CONSTANTS.STORAGE.BUCKETS.tp_resources;
|
|
4
|
+
export type CollectionConst = typeof CONSTANTS.STORAGE.COLLECTIONS.archetypes | typeof CONSTANTS.STORAGE.COLLECTIONS.resources;
|
|
5
5
|
export type FilterConst = typeof CONSTANTS.STORAGE.FILTER.members | typeof CONSTANTS.STORAGE.FILTER.specials;
|
|
6
|
-
export type
|
|
7
|
-
export type RoleConst = typeof CONSTANTS.
|
|
6
|
+
export type ArchetypeConst = typeof CONSTANTS.ARCHETYPES.formats | typeof CONSTANTS.ARCHETYPES.types;
|
|
7
|
+
export type RoleConst = typeof CONSTANTS.ARCHETYPES_PSEUDO.roles;
|
|
8
8
|
export type ResourceConst = typeof CONSTANTS.RESOURCES.resources;
|
|
9
9
|
export type StepConst = typeof CONSTANTS.STEP.work | typeof CONSTANTS.STEP.branch | typeof CONSTANTS.STEP.while | typeof CONSTANTS.STEP.for;
|
|
10
10
|
export type WorkflowConst = typeof CONSTANTS.WORKFLOW.workflow | typeof CONSTANTS.WORKFLOW.workflowSpec | typeof CONSTANTS.WORKFLOW.execution;
|
|
@@ -16,10 +16,10 @@ export interface DryRunManagerType {
|
|
|
16
16
|
export type Role = {
|
|
17
17
|
id: RoleIdJson;
|
|
18
18
|
} & RoleLiteralJson;
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
19
|
+
export type ArchetypeData = FormatDataJson | TypeDataJson;
|
|
20
|
+
export type ArchetypeMeta = FormatMetaJson | TypeMetaJson;
|
|
21
|
+
export type ArchetypeDataMap<T extends ArchetypeData> = Record<FilterConst, T[]>;
|
|
22
|
+
export type ArchetypeMetaMap<T extends ArchetypeMeta> = Record<FilterConst, T[]>;
|
|
23
23
|
export type ResourceMetaMap = Record<TypeIdJson, ResourceMetaJson[]>;
|
|
24
24
|
export type ResourceDataMap = Record<TypeIdJson, ResourceDataJson[]>;
|
|
25
25
|
export type ExternallyProvidedResourceMeta = {
|
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@toolproof-npm/shared",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Core library utilities for ToolProof",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"toolproof",
|
|
7
|
-
"utilities",
|
|
8
|
-
"library"
|
|
9
|
-
],
|
|
10
|
-
"author": "ToolProof Team",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/ToolProof/core.git",
|
|
15
|
-
"directory": "packages/_lib"
|
|
16
|
-
},
|
|
17
|
-
"homepage": "https://github.com/ToolProof/core#readme",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/ToolProof/core/issues"
|
|
20
|
-
},
|
|
21
|
-
"type": "module",
|
|
22
|
-
"main": "dist/index.js",
|
|
23
|
-
"types": "dist/index.d.ts",
|
|
24
|
-
"sideEffects": false,
|
|
25
|
-
"exports": {
|
|
26
|
-
".": {
|
|
27
|
-
"import": "./dist/index.js",
|
|
28
|
-
"types": "./dist/index.d.ts"
|
|
29
|
-
},
|
|
30
|
-
"./constants": {
|
|
31
|
-
"import": "./dist/constants.js",
|
|
32
|
-
"types": "./dist/constants.d.ts"
|
|
33
|
-
},
|
|
34
|
-
"./types": {
|
|
35
|
-
"import": "./dist/types.js",
|
|
36
|
-
"types": "./dist/types.d.ts"
|
|
37
|
-
},
|
|
38
|
-
"./server": {
|
|
39
|
-
"node": "./dist/firestoreAdminHelpers.js",
|
|
40
|
-
"types": "./dist/firestoreAdminHelpers.d.ts"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "tsc -b"
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"dist",
|
|
48
|
-
"README.md"
|
|
49
|
-
],
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@google-cloud/storage": "^7.17.3",
|
|
52
|
-
"@types/node": "^20.19.25",
|
|
53
|
-
"json-schema-to-typescript": "^15.0.4",
|
|
54
|
-
"ts-node": "^10.9.2",
|
|
55
|
-
"typescript": "^5.9.3"
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"@toolproof-npm/schema": "^0.1.
|
|
59
|
-
"firebase-admin": "^13.6.0"
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@toolproof-npm/shared",
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"description": "Core library utilities for ToolProof",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"toolproof",
|
|
7
|
+
"utilities",
|
|
8
|
+
"library"
|
|
9
|
+
],
|
|
10
|
+
"author": "ToolProof Team",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/ToolProof/core.git",
|
|
15
|
+
"directory": "packages/_lib"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/ToolProof/core#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/ToolProof/core/issues"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "dist/index.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./constants": {
|
|
31
|
+
"import": "./dist/constants.js",
|
|
32
|
+
"types": "./dist/constants.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./types": {
|
|
35
|
+
"import": "./dist/types.js",
|
|
36
|
+
"types": "./dist/types.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./server": {
|
|
39
|
+
"node": "./dist/firestoreAdminHelpers.js",
|
|
40
|
+
"types": "./dist/firestoreAdminHelpers.d.ts"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -b"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@google-cloud/storage": "^7.17.3",
|
|
52
|
+
"@types/node": "^20.19.25",
|
|
53
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
54
|
+
"ts-node": "^10.9.2",
|
|
55
|
+
"typescript": "^5.9.3"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@toolproof-npm/schema": "^0.1.20",
|
|
59
|
+
"firebase-admin": "^13.6.0"
|
|
60
|
+
}
|
|
61
61
|
}
|