@toolproof-core/lib 1.0.1 → 1.0.3
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/_lib/setup/firebaseAdminInit.d.ts.map +1 -0
- package/dist/_lib/setup/firebaseAdminInit.js.map +1 -0
- package/dist/artifacts/artifacts.d.ts +174 -0
- package/dist/artifacts/artifacts.d.ts.map +1 -0
- package/dist/{declarations/constants.js → artifacts/artifacts.js} +12 -11
- package/dist/artifacts/artifacts.js.map +1 -0
- package/dist/firebase/firebaseAdminHelpers.d.ts +4 -31
- package/dist/firebase/firebaseAdminHelpers.d.ts.map +1 -1
- package/dist/firebase/firebaseAdminHelpers.js +32 -27
- package/dist/firebase/firebaseAdminHelpers.js.map +1 -1
- package/dist/types/types.d.ts +9 -5
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +2 -1
- package/dist/types/types.js.map +1 -1
- package/dist/utils/creation.d.ts +4 -0
- package/dist/utils/creation.d.ts.map +1 -0
- package/dist/utils/creation.js +18 -0
- package/dist/utils/creation.js.map +1 -0
- package/dist/utils/resourceMapExtraction.d.ts +12 -0
- package/dist/utils/resourceMapExtraction.d.ts.map +1 -0
- package/dist/utils/resourceMapExtraction.js +23 -0
- package/dist/utils/resourceMapExtraction.js.map +1 -0
- package/package.json +42 -31
- package/src/{firebase → _lib/setup}/firebaseAdminInit.ts +38 -38
- package/{dist/constants/constants.js → src/artifacts/artifacts.ts} +14 -12
- package/src/firebase/firebaseAdminHelpers.ts +157 -189
- package/src/types/types.ts +25 -17
- package/src/utils/creation.ts +27 -0
- package/src/utils/resourceMapExtraction.ts +47 -0
- package/tsconfig.json +14 -14
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/constants/constants.d.ts +0 -94
- package/dist/constants/constants.d.ts.map +0 -1
- package/dist/constants/constants.js.map +0 -1
- package/dist/declarations/constants.d.ts +0 -94
- package/dist/declarations/constants.d.ts.map +0 -1
- package/dist/declarations/constants.js.map +0 -1
- package/dist/declarations/types.d.ts +0 -10
- package/dist/declarations/types.d.ts.map +0 -1
- package/dist/declarations/types.js +0 -2
- package/dist/declarations/types.js.map +0 -1
- package/dist/declarations/typesTS.d.ts +0 -11
- package/dist/declarations/typesTS.d.ts.map +0 -1
- package/dist/declarations/typesTS.js +0 -2
- package/dist/declarations/typesTS.js.map +0 -1
- package/dist/firebase/firebaseAdminInit.d.ts.map +0 -1
- package/dist/firebase/firebaseAdminInit.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/src/constants/constants.ts +0 -39
- package/src/index.ts +0 -3
- /package/dist/{firebase → _lib/setup}/firebaseAdminInit.d.ts +0 -0
- /package/dist/{firebase → _lib/setup}/firebaseAdminInit.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebaseAdminInit.d.ts","sourceRoot":"","sources":["../../../src/_lib/setup/firebaseAdminInit.ts"],"names":[],"mappings":"AAkCA,QAAA,MAAM,OAAO,6BAAoB,CAAC;AAClC,QAAA,MAAM,YAAY,0CAAkB,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebaseAdminInit.js","sourceRoot":"","sources":["../../../src/_lib/setup/firebaseAdminInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,uGAAuG;AACvG,SAAS,iBAAiB;IAC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AAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export declare const CONSTANTS: {
|
|
2
|
+
readonly Persistence: {
|
|
3
|
+
readonly Buckets: {
|
|
4
|
+
readonly tp_resources: "tp-resources";
|
|
5
|
+
readonly tp_strategies: "tp-strategies";
|
|
6
|
+
};
|
|
7
|
+
readonly Collections: {
|
|
8
|
+
readonly resources: "resources";
|
|
9
|
+
readonly members: "members";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
readonly Engine: {
|
|
13
|
+
readonly Graphs: {
|
|
14
|
+
readonly GraphRunStrategy: "GraphRunStrategy";
|
|
15
|
+
readonly GraphBuildStrategy: "GraphBuildStrategy";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly Cosmos: {
|
|
19
|
+
readonly TYPE_Boolean: "TYPE-Boolean";
|
|
20
|
+
readonly TYPE_Natural: "TYPE-Natural";
|
|
21
|
+
readonly TYPE_ResourceType: "TYPE-ResourceType";
|
|
22
|
+
readonly TYPE_Job: "TYPE-Job";
|
|
23
|
+
readonly TYPE_Error: "TYPE-Error";
|
|
24
|
+
readonly TYPE_RawStrategy: "TYPE-RawStrategy";
|
|
25
|
+
readonly TYPE_RunnableStrategy: "TYPE-RunnableStrategy";
|
|
26
|
+
readonly TYPE_StrategyRun: "TYPE-StrategyRun";
|
|
27
|
+
readonly ROLE_Manual: "ROLE-Manual";
|
|
28
|
+
readonly ROLE_ErrorOutput: "ROLE-ErrorOutput";
|
|
29
|
+
readonly ROLE_LessThanSource: "ROLE-LessThanSource";
|
|
30
|
+
readonly ROLE_LessThanTarget: "ROLE-LessThanTarget";
|
|
31
|
+
readonly ROLE_LessThanDecision: "ROLE-LessThanDecision";
|
|
32
|
+
readonly JOB_LessThan: "JOB-LessThan";
|
|
33
|
+
};
|
|
34
|
+
readonly Names: {
|
|
35
|
+
readonly Boolean: "Boolean";
|
|
36
|
+
readonly BooleanIdentity: "BooleanIdentity";
|
|
37
|
+
readonly BranchStep: "BranchStep";
|
|
38
|
+
readonly BranchStepIdentity: "BranchStepIdentity";
|
|
39
|
+
readonly Conditional: "Conditional";
|
|
40
|
+
readonly CreationContext: "CreationContext";
|
|
41
|
+
readonly CreationContextFacet: "CreationContextFacet";
|
|
42
|
+
readonly Description: "Description";
|
|
43
|
+
readonly DescriptionFacet: "DescriptionFacet";
|
|
44
|
+
readonly DocumentationFacet: "DocumentationFacet";
|
|
45
|
+
readonly Error: "Error";
|
|
46
|
+
readonly ForStep: "ForStep";
|
|
47
|
+
readonly ForStepIdentity: "ForStepIdentity";
|
|
48
|
+
readonly Goal: "Goal";
|
|
49
|
+
readonly GoalIdentity: "GoalIdentity";
|
|
50
|
+
readonly GraphEndRunEvent: "GraphEndRunEvent";
|
|
51
|
+
readonly GraphStartRunEvent: "GraphStartRunEvent";
|
|
52
|
+
readonly InterruptRunEvent: "InterruptRunEvent";
|
|
53
|
+
readonly Job: "Job";
|
|
54
|
+
readonly JobIdentity: "JobIdentity";
|
|
55
|
+
readonly JobStep: "JobStep";
|
|
56
|
+
readonly JobStepIdentity: "JobStepIdentity";
|
|
57
|
+
readonly JobStepSocket: "JobStepSocket";
|
|
58
|
+
readonly JsonData: "JsonData";
|
|
59
|
+
readonly Name: "Name";
|
|
60
|
+
readonly NameFacet: "NameFacet";
|
|
61
|
+
readonly Natural: "Natural";
|
|
62
|
+
readonly NaturalIdentity: "NaturalIdentity";
|
|
63
|
+
readonly Nucleus: "Nucleus";
|
|
64
|
+
readonly NucleusFacet: "NucleusFacet";
|
|
65
|
+
readonly Path: "Path";
|
|
66
|
+
readonly PathFacet: "PathFacet";
|
|
67
|
+
readonly RawStrategy: "RawStrategy";
|
|
68
|
+
readonly Resource: "Resource";
|
|
69
|
+
readonly ResourceIdentity: "ResourceIdentity";
|
|
70
|
+
readonly ResourceInputPotential: "ResourceInputPotential";
|
|
71
|
+
readonly ResourceMissing: "ResourceMissing";
|
|
72
|
+
readonly ResourceOutputPotential: "ResourceOutputPotential";
|
|
73
|
+
readonly ResourcePotential: "ResourcePotential";
|
|
74
|
+
readonly ResourceRoleIdentity: "ResourceRoleIdentity";
|
|
75
|
+
readonly ResourceRoleValue: "ResourceRoleValue";
|
|
76
|
+
readonly ResourceShellBase: "ResourceShellBase";
|
|
77
|
+
readonly ResourceShellKind: "ResourceShellKind";
|
|
78
|
+
readonly ResourceShellKindFacet: "ResourceShellKindFacet";
|
|
79
|
+
readonly ResourceType: "ResourceType";
|
|
80
|
+
readonly ResourceTypeIdentity: "ResourceTypeIdentity";
|
|
81
|
+
readonly RoleBindingArray: "RoleBindingArray";
|
|
82
|
+
readonly RoleBindings: "RoleBindings";
|
|
83
|
+
readonly RoleBindingsFacet: "RoleBindingsFacet";
|
|
84
|
+
readonly RoleMap: "RoleMap";
|
|
85
|
+
readonly Roles: "Roles";
|
|
86
|
+
readonly RolesFacet: "RolesFacet";
|
|
87
|
+
readonly RunEvent: "RunEvent";
|
|
88
|
+
readonly RunEventBase: "RunEventBase";
|
|
89
|
+
readonly RunEventCounters: "RunEventCounters";
|
|
90
|
+
readonly RunEventKind: "RunEventKind";
|
|
91
|
+
readonly RunEventStepMetadata: "RunEventStepMetadata";
|
|
92
|
+
readonly RunEventUpdates: "RunEventUpdates";
|
|
93
|
+
readonly RunnableStrategy: "RunnableStrategy";
|
|
94
|
+
readonly RunnableStrategyContext: "RunnableStrategyContext";
|
|
95
|
+
readonly RunnableStrategyIdentity: "RunnableStrategyIdentity";
|
|
96
|
+
readonly RunnableStrategyStatus: "RunnableStrategyStatus";
|
|
97
|
+
readonly RunnableStrategyUpdate: "RunnableStrategyUpdate";
|
|
98
|
+
readonly ShellInputPotential: "ShellInputPotential";
|
|
99
|
+
readonly ShellMaterialized: "ShellMaterialized";
|
|
100
|
+
readonly ShellMaterializedBase: "ShellMaterializedBase";
|
|
101
|
+
readonly ShellMissing: "ShellMissing";
|
|
102
|
+
readonly ShellOutputPotential: "ShellOutputPotential";
|
|
103
|
+
readonly Step: "Step";
|
|
104
|
+
readonly StepArray: "StepArray";
|
|
105
|
+
readonly StepIdentity: "StepIdentity";
|
|
106
|
+
readonly StepKind: "StepKind";
|
|
107
|
+
readonly StepKindFacet: "StepKindFacet";
|
|
108
|
+
readonly StepsFacet: "StepsFacet";
|
|
109
|
+
readonly StrategyRun: "StrategyRun";
|
|
110
|
+
readonly StrategyRunIdentity: "StrategyRunIdentity";
|
|
111
|
+
readonly StrategyState: "StrategyState";
|
|
112
|
+
readonly StrategyStateDelta: "StrategyStateDelta";
|
|
113
|
+
readonly StrategyStateFacet: "StrategyStateFacet";
|
|
114
|
+
readonly StrategyThreadIdentity: "StrategyThreadIdentity";
|
|
115
|
+
readonly StrategyThreadMap: "StrategyThreadMap";
|
|
116
|
+
readonly StrategyThreadMapFacet: "StrategyThreadMapFacet";
|
|
117
|
+
readonly TickRunEvent: "TickRunEvent";
|
|
118
|
+
readonly Timestamp: "Timestamp";
|
|
119
|
+
readonly TimestampFacet: "TimestampFacet";
|
|
120
|
+
readonly Uri: "Uri";
|
|
121
|
+
readonly WhileStep: "WhileStep";
|
|
122
|
+
readonly WhileStepIdentity: "WhileStepIdentity";
|
|
123
|
+
};
|
|
124
|
+
readonly Enums: {
|
|
125
|
+
readonly ResourceShellKind: {
|
|
126
|
+
readonly missing: "missing";
|
|
127
|
+
readonly inputPotential: "inputPotential";
|
|
128
|
+
readonly outputPotential: "outputPotential";
|
|
129
|
+
readonly materialized: "materialized";
|
|
130
|
+
};
|
|
131
|
+
readonly RunEventKind: {
|
|
132
|
+
readonly graph_start: "graph_start";
|
|
133
|
+
readonly tick: "tick";
|
|
134
|
+
readonly interrupt: "interrupt";
|
|
135
|
+
readonly graph_end: "graph_end";
|
|
136
|
+
};
|
|
137
|
+
readonly RunnableStrategyStatus: {
|
|
138
|
+
readonly pending: "pending";
|
|
139
|
+
readonly running: "running";
|
|
140
|
+
readonly completed: "completed";
|
|
141
|
+
readonly failed: "failed";
|
|
142
|
+
readonly cancelled: "cancelled";
|
|
143
|
+
};
|
|
144
|
+
readonly StepKind: {
|
|
145
|
+
readonly job: "job";
|
|
146
|
+
readonly branch: "branch";
|
|
147
|
+
readonly while: "while";
|
|
148
|
+
readonly for: "for";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export declare const MAPPINGS: {
|
|
153
|
+
readonly IdentityNameToIdentityPrefix: {
|
|
154
|
+
readonly BranchStepIdentity: "BRANCH_STEP-";
|
|
155
|
+
readonly ForStepIdentity: "FOR_STEP-";
|
|
156
|
+
readonly GoalIdentity: "GOAL-";
|
|
157
|
+
readonly JobIdentity: "JOB-";
|
|
158
|
+
readonly JobStepIdentity: "JOB_STEP-";
|
|
159
|
+
readonly ResourceIdentity: "RESOURCE-";
|
|
160
|
+
readonly ResourceRoleIdentity: "ROLE-";
|
|
161
|
+
readonly ResourceTypeIdentity: "TYPE-";
|
|
162
|
+
readonly RunnableStrategyIdentity: "RUNNABLE_STRATEGY-";
|
|
163
|
+
readonly StrategyRunIdentity: "STRATEGY_RUN-";
|
|
164
|
+
readonly StrategyThreadIdentity: "STRATEGY_THREAD-";
|
|
165
|
+
readonly WhileStepIdentity: "WHILE_STEP-";
|
|
166
|
+
};
|
|
167
|
+
readonly StepKindToStepIdentityPrefix: {
|
|
168
|
+
readonly branch: "BRANCH_STEP-";
|
|
169
|
+
readonly for: "FOR_STEP-";
|
|
170
|
+
readonly job: "JOB_STEP-";
|
|
171
|
+
readonly while: "WHILE_STEP-";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/artifacts/artifacts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCZ,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAEX,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { CONSTANTS as
|
|
1
|
+
import { CONSTANTS as _CONSTANTS, MAPPINGS as _MAPPINGS } from "@toolproof-core/schema";
|
|
2
2
|
export const CONSTANTS = {
|
|
3
|
-
...
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
..._CONSTANTS,
|
|
4
|
+
Persistence: {
|
|
5
|
+
Buckets: {
|
|
6
6
|
tp_resources: 'tp-resources',
|
|
7
7
|
tp_strategies: 'tp-strategies',
|
|
8
8
|
},
|
|
9
|
-
|
|
9
|
+
Collections: {
|
|
10
10
|
resources: 'resources',
|
|
11
11
|
members: 'members',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Engine: {
|
|
15
|
+
Graphs: {
|
|
16
16
|
GraphRunStrategy: 'GraphRunStrategy',
|
|
17
17
|
GraphBuildStrategy: 'GraphBuildStrategy',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
Cosmos: {
|
|
21
21
|
TYPE_Boolean: 'TYPE-Boolean',
|
|
22
22
|
TYPE_Natural: 'TYPE-Natural',
|
|
23
23
|
TYPE_ResourceType: 'TYPE-ResourceType',
|
|
@@ -32,8 +32,9 @@ export const CONSTANTS = {
|
|
|
32
32
|
ROLE_LessThanTarget: 'ROLE-LessThanTarget',
|
|
33
33
|
ROLE_LessThanDecision: 'ROLE-LessThanDecision',
|
|
34
34
|
JOB_LessThan: 'JOB-LessThan',
|
|
35
|
-
BOOLEAN_false: 'RESOURCE-qadnfFGjZsjpqLI0Du1d',
|
|
36
|
-
BOOLEAN_true: 'RESOURCE-iZX1cxZ9ImJRzty9Ob4G',
|
|
37
35
|
}
|
|
38
36
|
};
|
|
39
|
-
|
|
37
|
+
export const MAPPINGS = {
|
|
38
|
+
..._MAPPINGS,
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/artifacts/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExF,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,GAAG,UAAU;IACb,WAAW,EAAE;QACT,OAAO,EAAE;YACL,YAAY,EAAE,cAAc;YAC5B,aAAa,EAAE,eAAe;SACjC;QACD,WAAW,EAAE;YACT,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,SAAS;SACrB;KACJ;IACD,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,gBAAgB,EAAE,kBAAkB;YACpC,kBAAkB,EAAE,oBAAoB;SAC3C;KACJ;IACD,MAAM,EAAE;QACJ,YAAY,EAAE,cAAc;QAC5B,YAAY,EAAE,cAAc;QAC5B,iBAAiB,EAAE,mBAAmB;QACtC,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,YAAY;QACxB,gBAAgB,EAAE,kBAAkB;QACpC,qBAAqB,EAAE,uBAAuB;QAC9C,gBAAgB,EAAE,kBAAkB;QACpC,WAAW,EAAE,aAAa;QAC1B,gBAAgB,EAAE,kBAAkB;QACpC,mBAAmB,EAAE,qBAAqB;QAC1C,mBAAmB,EAAE,qBAAqB;QAC1C,qBAAqB,EAAE,uBAAuB;QAC9C,YAAY,EAAE,cAAc;KAC/B;CACK,CAAC;AAEX,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,GAAG,SAAS;CACN,CAAC"}
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
declare const STEP_KIND_TO_IDENTITY_PREFIX_KEY: {
|
|
6
|
-
readonly job: "JobStepIdentity";
|
|
7
|
-
readonly branch: "BranchStepIdentity";
|
|
8
|
-
readonly while: "WhileStepIdentity";
|
|
9
|
-
readonly for: "ForStepIdentity";
|
|
10
|
-
};
|
|
11
|
-
type StepIdentityPrefixKey = (typeof STEP_KIND_TO_IDENTITY_PREFIX_KEY)[StepKind];
|
|
12
|
-
type IdentityJsonByPrefixKey = {
|
|
13
|
-
ResourceTypeIdentity: ResourceTypeIdentityJson;
|
|
14
|
-
ResourceRoleIdentity: ResourceRoleIdentityJson;
|
|
15
|
-
ResourceIdentity: ResourceIdentityJson;
|
|
16
|
-
JobIdentity: JobIdentityJson;
|
|
17
|
-
JobStepIdentity: JobStepIdentityJson;
|
|
18
|
-
BranchStepIdentity: BranchStepIdentityJson;
|
|
19
|
-
WhileStepIdentity: WhileStepIdentityJson;
|
|
20
|
-
ForStepIdentity: ForStepIdentityJson;
|
|
21
|
-
StrategyThreadIdentity: StrategyThreadIdentityJson;
|
|
22
|
-
RunnableStrategyIdentity: RunnableStrategyIdentityJson;
|
|
23
|
-
StrategyRunIdentity: StrategyRunIdentityJson;
|
|
24
|
-
GoalIdentity: GoalIdentityJson;
|
|
25
|
-
};
|
|
26
|
-
export type NewIdentity<T extends IdentityPrefix = IdentityPrefix> = T extends keyof IdentityJsonByPrefixKey ? IdentityJsonByPrefixKey[T] : `${(typeof CONSTANTS.IDENTIFIABLES.PREFIXES)[T]}${string}`;
|
|
27
|
-
export declare function getNewIdentity<T extends IdentityPrefix>(identifiable: T): NewIdentity<T>;
|
|
28
|
-
export declare function getNewStepIdentityPrefix<K extends StepKind>(kind: K): (typeof CONSTANTS.IDENTIFIABLES.PREFIXES)[StepIdentityPrefixKey];
|
|
29
|
-
type StepIdentityForKind<K extends StepKind> = IdentityJsonByPrefixKey[(typeof STEP_KIND_TO_IDENTITY_PREFIX_KEY)[K]];
|
|
30
|
-
export declare function getNewStepIdentity<K extends StepKind>(kind: K): Promise<StepIdentityForKind<K>>;
|
|
1
|
+
import type { ResourceTypeIdentityJson, StepKindJson } from '@toolproof-core/schema';
|
|
2
|
+
import type { IdentityName, IdentityStringByIdentityName, StepIdentityStringByStepKind, ResourceMap } from '../types/types.js';
|
|
3
|
+
export declare function getNewIdentity<K extends IdentityName>(identityName: K): IdentityStringByIdentityName<K>;
|
|
4
|
+
export declare function getNewStepIdentity<K extends StepKindJson>(stepKind: K): StepIdentityStringByStepKind<K>;
|
|
31
5
|
export declare function listResources(resourceTypeHandles: ResourceTypeIdentityJson[]): Promise<ResourceMap>;
|
|
32
|
-
export {};
|
|
33
6
|
//# sourceMappingURL=firebaseAdminHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseAdminHelpers.d.ts","sourceRoot":"","sources":["../../src/firebase/firebaseAdminHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"firebaseAdminHelpers.d.ts","sourceRoot":"","sources":["../../src/firebase/firebaseAdminHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,wBAAwB,EACxB,YAAY,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAW/H,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,YAAY,EAAE,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAQvG;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAMvG;AAED,wBAAsB,aAAa,CAC/B,mBAAmB,EAAE,wBAAwB,EAAE,GAChD,OAAO,CAAC,WAAW,CAAC,CAsHtB"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { CONSTANTS } from '../
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export function getNewIdentity(
|
|
10
|
-
const prefix =
|
|
1
|
+
import { CONSTANTS } from '../artifacts/artifacts.js';
|
|
2
|
+
import { MAPPINGS } from '../artifacts/artifacts.js';
|
|
3
|
+
import { dbAdmin, storageAdmin } from "../_lib/setup/firebaseAdminInit.js";
|
|
4
|
+
function capitalizeFirst(value) {
|
|
5
|
+
if (!value)
|
|
6
|
+
return value;
|
|
7
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
8
|
+
}
|
|
9
|
+
export function getNewIdentity(identityName) {
|
|
10
|
+
const prefix = MAPPINGS.IdentityNameToIdentityPrefix[identityName];
|
|
11
11
|
const docRef = dbAdmin
|
|
12
|
-
.collection(CONSTANTS.
|
|
13
|
-
.doc(
|
|
14
|
-
.collection(CONSTANTS.
|
|
12
|
+
.collection(CONSTANTS.Persistence.Collections.resources)
|
|
13
|
+
.doc(identityName)
|
|
14
|
+
.collection(CONSTANTS.Persistence.Collections.members)
|
|
15
15
|
.doc();
|
|
16
16
|
return (prefix + docRef.id);
|
|
17
17
|
}
|
|
18
|
-
export function
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return getNewIdentity(key);
|
|
18
|
+
export function getNewStepIdentity(stepKind) {
|
|
19
|
+
const identityName = `${capitalizeFirst(stepKind)}StepIdentity`;
|
|
20
|
+
if (!(identityName in MAPPINGS.IdentityNameToIdentityPrefix)) {
|
|
21
|
+
throw new Error(`No IdentityNameToIdentityPrefix entry for derived step identity name: ${identityName}`);
|
|
22
|
+
}
|
|
23
|
+
return getNewIdentity(identityName);
|
|
25
24
|
}
|
|
26
25
|
export async function listResources(resourceTypeHandles) {
|
|
27
|
-
const bucket_resources = storageAdmin.bucket(CONSTANTS.
|
|
28
|
-
const bucket_strategies = storageAdmin.bucket(CONSTANTS.
|
|
26
|
+
const bucket_resources = storageAdmin.bucket(CONSTANTS.Persistence.Buckets.tp_resources);
|
|
27
|
+
const bucket_strategies = storageAdmin.bucket(CONSTANTS.Persistence.Buckets.tp_strategies);
|
|
29
28
|
async function fetchFilesUnder(resourceTypeHandle) {
|
|
30
|
-
const bucket = resourceTypeHandle === CONSTANTS.
|
|
29
|
+
const bucket = resourceTypeHandle === CONSTANTS.Cosmos.TYPE_RunnableStrategy
|
|
31
30
|
? bucket_strategies
|
|
32
31
|
: bucket_resources;
|
|
33
32
|
const prefix = `${resourceTypeHandle}/`;
|
|
@@ -115,14 +114,19 @@ export async function listResources(resourceTypeHandles) {
|
|
|
115
114
|
// const resourceTypeHandle = root.resourceTypeHandle; // we already have this
|
|
116
115
|
const resourceRoleHandle = root.creationContext.resourceRoleHandle;
|
|
117
116
|
const jobStepHandle = root.creationContext.jobStepHandle;
|
|
118
|
-
const
|
|
117
|
+
const resourceShellKind = root.resourceShellKind;
|
|
118
|
+
const versionRaw = root.version;
|
|
119
|
+
const version = typeof versionRaw === 'number'
|
|
120
|
+
? versionRaw
|
|
121
|
+
: parseInt(String(versionRaw ?? ''), 10);
|
|
119
122
|
const path = root.path;
|
|
120
123
|
const timestamp = root.timestamp;
|
|
121
124
|
const missing = [
|
|
122
125
|
['identity', identity],
|
|
123
126
|
['resourceRoleHandle', resourceRoleHandle],
|
|
124
127
|
['jobStepHandle', jobStepHandle],
|
|
125
|
-
['
|
|
128
|
+
['resourceShellKind', resourceShellKind],
|
|
129
|
+
['version', Number.isFinite(version) ? String(version) : ''],
|
|
126
130
|
['timestamp', timestamp],
|
|
127
131
|
['path', path],
|
|
128
132
|
].filter(([_, v]) => typeof v !== 'string' || v.length === 0);
|
|
@@ -137,9 +141,10 @@ export async function listResources(resourceTypeHandles) {
|
|
|
137
141
|
resourceRoleHandle,
|
|
138
142
|
jobStepHandle,
|
|
139
143
|
},
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
resourceShellKind,
|
|
145
|
+
version,
|
|
142
146
|
timestamp: timestamp,
|
|
147
|
+
path: path,
|
|
143
148
|
nucleus: data,
|
|
144
149
|
};
|
|
145
150
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseAdminHelpers.js","sourceRoot":"","sources":["../../src/firebase/firebaseAdminHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebaseAdminHelpers.js","sourceRoot":"","sources":["../../src/firebase/firebaseAdminHelpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAG3E,SAAS,eAAe,CAAC,KAAa;IAClC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,cAAc,CAAyB,YAAe;IAClE,MAAM,MAAM,GAAG,QAAQ,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,OAAO;SACjB,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC;SACvD,GAAG,CAAC,YAAY,CAAC;SACjB,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC;SACrD,GAAG,EAAE,CAAC;IACX,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAoC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAyB,QAAW;IAClE,MAAM,YAAY,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,cAA8B,CAAC;IAChF,IAAI,CAAC,CAAC,YAAY,IAAI,QAAQ,CAAC,4BAA4B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D,CAAC,CAAC,CACL,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAgB,CAAC;AACtD,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { ResourceJson, ResourceRoleIdentityJson, ResourceRoleValueJson, ResourceTypeIdentityJson } from '@toolproof-core/schema';
|
|
2
|
-
import { CONSTANTS } from '../
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
1
|
+
import type { StepKindJson, ResourceJson, ResourceRoleIdentityJson, ResourceRoleValueJson, ResourceTypeIdentityJson } from '@toolproof-core/schema';
|
|
2
|
+
import { CONSTANTS } from '../artifacts/artifacts.js';
|
|
3
|
+
import { MAPPINGS } from '../artifacts/artifacts.js';
|
|
4
|
+
export type Bucket = typeof CONSTANTS.Persistence.Buckets.tp_resources;
|
|
5
|
+
export type Collection = keyof typeof CONSTANTS.Persistence.Collections;
|
|
6
|
+
export type SchemaLike = Record<string, unknown>;
|
|
6
7
|
export type Role = {
|
|
7
8
|
identity: ResourceRoleIdentityJson;
|
|
8
9
|
} & ResourceRoleValueJson;
|
|
9
10
|
export type ResourceMap = Record<ResourceTypeIdentityJson, ResourceJson[]>;
|
|
11
|
+
export type IdentityName = keyof typeof MAPPINGS.IdentityNameToIdentityPrefix;
|
|
12
|
+
export type IdentityStringByIdentityName<K extends IdentityName> = `${(typeof MAPPINGS.IdentityNameToIdentityPrefix)[K]}${string}`;
|
|
13
|
+
export type StepIdentityStringByStepKind<K extends StepKindJson> = `${(typeof MAPPINGS.StepKindToStepIdentityPrefix)[K]}${string}`;
|
|
10
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,MAAM,MAAM,MAAM,GAAG,OAAO,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;AAEvE,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC;AAExE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,IAAI,GAAG;IAAE,QAAQ,EAAE,wBAAwB,CAAA;CAAE,GAAG,qBAAqB,CAAC;AAElF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,wBAAwB,EAAE,YAAY,EAAE,CAAC,CAAC;AAE3E,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,QAAQ,CAAC,4BAA4B,CAAC;AAE9E,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,YAAY,IAAI,GAAG,CAAC,OAAO,QAAQ,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC;AAEnI,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,YAAY,IAAI,GAAG,CAAC,OAAO,QAAQ,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC"}
|
package/dist/types/types.js
CHANGED
package/dist/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ResourceIdentityJson, ResourceTypeIdentityJson, ResourceJson, ResourceOutputPotentialJson } from '@toolproof-core/schema';
|
|
2
|
+
export declare function generatePath(resourceTypeHandle: ResourceTypeIdentityJson, identity: ResourceIdentityJson): string;
|
|
3
|
+
export declare function fromOutputPotentialToMaterialized(outputPotential: ResourceOutputPotentialJson, nucleus: unknown, timestamp?: string): ResourceJson;
|
|
4
|
+
//# sourceMappingURL=creation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creation.d.ts","sourceRoot":"","sources":["../../src/utils/creation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAGxI,wBAAgB,YAAY,CAAC,kBAAkB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,oBAAoB,GAAG,MAAM,CAEjH;AAED,wBAAgB,iCAAiC,CAC7C,eAAe,EAAE,2BAA2B,EAC5C,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,MAAM,GACnB,YAAY,CAed"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function generatePath(resourceTypeHandle, identity) {
|
|
2
|
+
return `${resourceTypeHandle}/${identity}.json`;
|
|
3
|
+
}
|
|
4
|
+
export function fromOutputPotentialToMaterialized(outputPotential, nucleus, timestamp) {
|
|
5
|
+
const { identity, resourceTypeHandle, creationContext } = outputPotential;
|
|
6
|
+
const path = generatePath(resourceTypeHandle, identity);
|
|
7
|
+
return {
|
|
8
|
+
identity,
|
|
9
|
+
resourceTypeHandle,
|
|
10
|
+
creationContext,
|
|
11
|
+
resourceShellKind: 'materialized',
|
|
12
|
+
version: 1,
|
|
13
|
+
timestamp: timestamp ?? new Date().toISOString(), // Preserve original timestamp when copying
|
|
14
|
+
path,
|
|
15
|
+
nucleus,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=creation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creation.js","sourceRoot":"","sources":["../../src/utils/creation.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAAC,kBAA4C,EAAE,QAA8B;IACrG,OAAO,GAAG,kBAAkB,IAAI,QAAQ,OAAO,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC7C,eAA4C,EAC5C,OAAgB,EAChB,SAAkB;IAElB,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC;IAE1E,MAAM,IAAI,GAAG,YAAY,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IAExD,OAAO;QACH,QAAQ;QACR,kBAAkB;QAClB,eAAe;QACf,iBAAiB,EAAE,cAAc;QACjC,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,2CAA2C;QAC7F,IAAI;QACJ,OAAO;KACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResourceIdentityJson, ResourceTypeIdentityJson, ResourceJson } from '@toolproof-core/schema';
|
|
2
|
+
import type { ResourceMap } from '../types/types.js';
|
|
3
|
+
export declare function extractResourcesByType<TResource extends ResourceJson = ResourceJson>(resourceMap: ResourceMap, resourceTypeHandle: ResourceTypeIdentityJson): Record<ResourceIdentityJson, TResource>;
|
|
4
|
+
/**
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractNucleusMap<TKey extends string = string, TNucleus extends {
|
|
8
|
+
identity: string | number | boolean;
|
|
9
|
+
} = {
|
|
10
|
+
identity: string | number | boolean;
|
|
11
|
+
}, TResource extends ResourceJson = ResourceJson>(resourceMap: ResourceMap, resourceTypeHandle: ResourceTypeIdentityJson): Map<TKey, TNucleus>;
|
|
12
|
+
//# sourceMappingURL=resourceMapExtraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceMapExtraction.d.ts","sourceRoot":"","sources":["../../src/utils/resourceMapExtraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,wBAAgB,sBAAsB,CAAC,SAAS,SAAS,YAAY,GAAG,YAAY,EAChF,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,wBAAwB,GAC7C,MAAM,CAAC,oBAAoB,EAAE,SAAS,CAAC,CASzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,QAAQ,SAAS;IAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,EAClG,SAAS,SAAS,YAAY,GAAG,YAAY,EAE7C,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,wBAAwB,GAC7C,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAcrB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function extractResourcesByType(resourceMap, resourceTypeHandle) {
|
|
2
|
+
const resources = (resourceMap[resourceTypeHandle] ?? []);
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const resource of resources) {
|
|
5
|
+
result[resource.identity] = resource;
|
|
6
|
+
}
|
|
7
|
+
return result;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
|
|
11
|
+
*/
|
|
12
|
+
export function extractNucleusMap(resourceMap, resourceTypeHandle) {
|
|
13
|
+
const resources = extractResourcesByType(resourceMap, resourceTypeHandle);
|
|
14
|
+
const out = new Map();
|
|
15
|
+
for (const resource of Object.values(resources)) {
|
|
16
|
+
const data = resource.nucleus;
|
|
17
|
+
const value = data;
|
|
18
|
+
const key = String(value.identity);
|
|
19
|
+
out.set(key, value);
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=resourceMapExtraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceMapExtraction.js","sourceRoot":"","sources":["../../src/utils/resourceMapExtraction.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,sBAAsB,CAClC,WAAwB,EACxB,kBAA4C;IAE5C,MAAM,SAAS,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAgB,CAAC;IACzE,MAAM,MAAM,GAA4C,EAA6C,CAAC;IAEtG,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACzC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAK7B,WAAwB,EACxB,kBAA4C;IAE5C,MAAM,SAAS,GAAG,sBAAsB,CAAY,WAAW,EAAE,kBAAkB,CAAC,CAAC;IACrF,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEtC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAI,QAAgB,CAAC,OAAkB,CAAC;QAElD,MAAM,KAAK,GAAG,IAAgB,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAS,CAAC;QAE3C,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js"
|
|
2
|
+
"name": "@toolproof-core/lib",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [],
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"packageManager": "pnpm@10.15.0",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"build": "tsc -b"
|
|
15
13
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
"exports": {
|
|
15
|
+
"./artifacts": {
|
|
16
|
+
"types": "./dist/artifacts/artifacts.d.ts",
|
|
17
|
+
"import": "./dist/artifacts/artifacts.js"
|
|
18
|
+
},
|
|
19
|
+
"./types": {
|
|
20
|
+
"types": "./dist/types/types.d.ts",
|
|
21
|
+
"import": "./dist/types/types.js"
|
|
22
|
+
},
|
|
23
|
+
"./resource-map-extraction": {
|
|
24
|
+
"types": "./dist/utils/resourceMapExtraction.d.ts",
|
|
25
|
+
"import": "./dist/utils/resourceMapExtraction.js"
|
|
26
|
+
},
|
|
27
|
+
"./creation": {
|
|
28
|
+
"types": "./dist/utils/creation.d.ts",
|
|
29
|
+
"import": "./dist/utils/creation.js"
|
|
30
|
+
},
|
|
31
|
+
"./firebase-admin-init": {
|
|
32
|
+
"types": "./dist/_lib/setup/firebaseAdminInit.d.ts",
|
|
33
|
+
"import": "./dist/_lib/setup/firebaseAdminInit.js"
|
|
34
|
+
},
|
|
35
|
+
"./firebase-admin-helpers": {
|
|
36
|
+
"types": "./dist/firebase/firebaseAdminHelpers.d.ts",
|
|
37
|
+
"import": "./dist/firebase/firebaseAdminHelpers.js"
|
|
38
|
+
}
|
|
19
39
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^22.0.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@toolproof-core/schema": "workspace:*",
|
|
45
|
+
"firebase-admin": "^13.7.0"
|
|
23
46
|
}
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/node": "^22.0.0"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"firebase-admin": "^13.7.0",
|
|
30
|
-
"@toolproof-core/schema": "1.0.8"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
34
|
-
"build": "tsc -b"
|
|
35
|
-
}
|
|
36
47
|
}
|