@uipath/packager-tool-datafabric 1.204.0 → 1.205.0-preview.258
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/canonical-path.d.ts +31 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +802 -58
- package/dist/init/entity-init-service.d.ts +7 -0
- package/dist/init.js +1243 -451
- package/dist/inline/inline-entity-service.d.ts +209 -0
- package/dist/inline.d.ts +8 -0
- package/dist/inline.js +3665 -0
- package/dist/missing-path.d.ts +19 -0
- package/dist/pack/constants.d.ts +3 -0
- package/dist/pack/verify-pair.d.ts +14 -1
- package/dist/resource/local-entities.d.ts +14 -0
- package/dist/resource/unified-resource-file.d.ts +21 -0
- package/dist/schema/author-field.d.ts +82 -0
- package/dist/schema/create-entity-skeleton.d.ts +21 -0
- package/dist/schema/solution-entity-names.d.ts +45 -0
- package/dist/schema/validate-entity.d.ts +12 -0
- package/dist/sort-names.d.ts +11 -0
- package/package.json +5 -4
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read and edit the entities of an Entity project on disk — the service behind
|
|
3
|
+
* `uip df entities <verb> --local`.
|
|
4
|
+
*
|
|
5
|
+
* Everything here composes pieces that already exist rather than restating
|
|
6
|
+
* them: {@link verifyPair} resolves a stub to its resource exactly as pack
|
|
7
|
+
* does, {@link validateEntity} is the only judge of whether a document is
|
|
8
|
+
* valid, {@link authorField} owns the field-type vocabulary, and
|
|
9
|
+
* {@link siblingNamesFor} supplies the solution-wide uniqueness input. The job
|
|
10
|
+
* of this module is sequencing and I/O, not rules.
|
|
11
|
+
*
|
|
12
|
+
* Node-only (filesystem + solution-sdk), so it sits on the `./inline` entry
|
|
13
|
+
* next to `./init` rather than the browser-safe root.
|
|
14
|
+
*/
|
|
15
|
+
import type { EntityJSON } from "@uipath/entity-modeler/schema";
|
|
16
|
+
import { type AuthoredFieldSpec } from "../schema/author-field.js";
|
|
17
|
+
import { type EntityDiagnostic } from "../schema/validate-entity.js";
|
|
18
|
+
/** Reasons a caller can branch on rather than re-deriving from a message. Only
|
|
19
|
+
* the cases a command actually distinguishes get one. */
|
|
20
|
+
export declare const INLINE_ENTITY_ERROR_CODES: {
|
|
21
|
+
/** No directory at the project path — the caller may want to scaffold. */
|
|
22
|
+
readonly projectNotFound: "PROJECT_NOT_FOUND";
|
|
23
|
+
/** The directory is there, but no `.uipx` above it. Scaffolding is wrong. */
|
|
24
|
+
readonly noParentSolution: "NO_PARENT_SOLUTION";
|
|
25
|
+
/** The solution holds no entity by that name. */
|
|
26
|
+
readonly entityNotFound: "ENTITY_NOT_FOUND";
|
|
27
|
+
/** The entity exists, but the solution only references it — a live
|
|
28
|
+
* platform entity, not one authored here. */
|
|
29
|
+
readonly notLocallyAuthored: "NOT_LOCALLY_AUTHORED";
|
|
30
|
+
};
|
|
31
|
+
export type InlineEntityErrorCode = (typeof INLINE_ENTITY_ERROR_CODES)[keyof typeof INLINE_ENTITY_ERROR_CODES];
|
|
32
|
+
/** A failure the caller caused — a missing project, an entity that is not
|
|
33
|
+
* there, an edit aimed at a referenced platform entity. Carries instructions
|
|
34
|
+
* so the command layer can hand it straight to `fail()`. */
|
|
35
|
+
export declare class InlineEntityError extends Error {
|
|
36
|
+
readonly instructions: string;
|
|
37
|
+
readonly code?: InlineEntityErrorCode | undefined;
|
|
38
|
+
constructor(message: string, instructions: string, code?: InlineEntityErrorCode | undefined);
|
|
39
|
+
}
|
|
40
|
+
export interface InlineEntityOptions {
|
|
41
|
+
/** Directory the project name resolves against. Defaults to the process cwd. */
|
|
42
|
+
cwd?: string;
|
|
43
|
+
}
|
|
44
|
+
/** One entity in a project, as `list` reports it. */
|
|
45
|
+
export interface InlineEntitySummary {
|
|
46
|
+
name: string;
|
|
47
|
+
/** Absolute path to the `.entity` stub. */
|
|
48
|
+
stubFile: string;
|
|
49
|
+
/** Absolute path to the definition resource, when the pair resolves. */
|
|
50
|
+
resourceFile?: string;
|
|
51
|
+
/** False for an entity the solution references rather than owns. */
|
|
52
|
+
locallyAuthored?: boolean;
|
|
53
|
+
/** Set when the stub and its resource do not form a valid pair. */
|
|
54
|
+
problem?: string;
|
|
55
|
+
}
|
|
56
|
+
/** The field edits an `update` applies, mirroring the body
|
|
57
|
+
* `uip df entities update` takes so one payload serves both. */
|
|
58
|
+
export interface InlineEntityUpdate {
|
|
59
|
+
addFields?: AuthoredFieldSpec[];
|
|
60
|
+
updateFields?: Array<{
|
|
61
|
+
name: string;
|
|
62
|
+
} & Partial<AuthoredFieldSpec>>;
|
|
63
|
+
removeFields?: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
}>;
|
|
66
|
+
displayName?: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
}
|
|
69
|
+
interface ResolvedProject {
|
|
70
|
+
projectDir: string;
|
|
71
|
+
solutionDir: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The solution root a local command acts within, or a clear refusal.
|
|
75
|
+
*
|
|
76
|
+
* Exported because the SCAFFOLD path needs the same base the lookup path
|
|
77
|
+
* uses. `resolveProjectAsync` finds it and then throws `projectNotFound`,
|
|
78
|
+
* which is what `create` reads as "scaffold it" — so without this the two
|
|
79
|
+
* halves of one command resolved the project against different directories
|
|
80
|
+
* and `create` registered a project no other verb could address.
|
|
81
|
+
*/
|
|
82
|
+
export declare function solutionRootAsync(options?: InlineEntityOptions): Promise<string>;
|
|
83
|
+
export declare function resolveProjectAsync(projectName: string, options?: InlineEntityOptions): Promise<ResolvedProject>;
|
|
84
|
+
/**
|
|
85
|
+
* The project that owns `entityName`, for callers that did not name one.
|
|
86
|
+
*
|
|
87
|
+
* `--project-name` is optional on every verb that addresses an EXISTING
|
|
88
|
+
* entity, because entity names are solution-wide unique and so the project is
|
|
89
|
+
* derivable. Searching beats assuming: guessing "project = entity name" would
|
|
90
|
+
* report "project 'Product' not found" when Product simply lives in Catalog,
|
|
91
|
+
* which sends the caller after the wrong thing.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveOwningProjectAsync(entityName: string, options?: InlineEntityOptions): Promise<{
|
|
94
|
+
projectName: string;
|
|
95
|
+
entityName: string;
|
|
96
|
+
solutionDir: string;
|
|
97
|
+
}>;
|
|
98
|
+
/** List the entities in a project, reporting broken pairs rather than throwing
|
|
99
|
+
* — a caller listing wants to see the damage, not just the healthy rows. */
|
|
100
|
+
export declare function inlineEntityListAsync(projectName: string, options?: InlineEntityOptions): Promise<InlineEntitySummary[]>;
|
|
101
|
+
/** One row of a solution-wide listing: a project summary plus its owner. */
|
|
102
|
+
export interface InlineEntitySolutionSummary extends InlineEntitySummary {
|
|
103
|
+
projectName: string;
|
|
104
|
+
/** The solution these rows were found under. Callers need it to scope
|
|
105
|
+
* follow-up calls: a project name is relative to this, not to cwd. */
|
|
106
|
+
solutionDir: string;
|
|
107
|
+
/**
|
|
108
|
+
* Set when the row stands for a PROJECT that could not be listed at all
|
|
109
|
+
* rather than for one entity in it — an unreadable directory, or a
|
|
110
|
+
* directory name the inline commands cannot address. The row exists so a
|
|
111
|
+
* caller gating on this listing (`validate --local` with no arguments)
|
|
112
|
+
* sees a project it must not silently pass over; `name` is then the
|
|
113
|
+
* directory name and there is no entity behind it.
|
|
114
|
+
*/
|
|
115
|
+
projectProblem?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Every locally authored entity in the solution, across all Entity projects.
|
|
119
|
+
*
|
|
120
|
+
* Backs `uip df entities list --local` with no `--project-name`. Reports
|
|
121
|
+
* broken pairs rather than throwing, like the per-project listing — a caller
|
|
122
|
+
* surveying a solution wants the damage visible, not an early exit.
|
|
123
|
+
*/
|
|
124
|
+
export declare function inlineEntityListAllAsync(options?: InlineEntityOptions): Promise<InlineEntitySolutionSummary[]>;
|
|
125
|
+
/** Read one entity's authored document. */
|
|
126
|
+
export declare function inlineEntityGetAsync(projectName: string, entityName: string, options?: InlineEntityOptions): Promise<EntityJSON>;
|
|
127
|
+
export interface InlineEntityValidation {
|
|
128
|
+
entityName: string;
|
|
129
|
+
resourceFile?: string;
|
|
130
|
+
diagnostics: EntityDiagnostic[];
|
|
131
|
+
/** Set instead of `diagnostics` when the stub↔resource pair itself is broken. */
|
|
132
|
+
pairProblem?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Validate one entity, or every entity in the project.
|
|
136
|
+
*
|
|
137
|
+
* Same two checks pack runs, in the same order — the pair, then the schema —
|
|
138
|
+
* so a clean result here means the project will not fail pack on its entities.
|
|
139
|
+
*/
|
|
140
|
+
export declare function inlineEntityValidateAsync(projectName: string, options?: InlineEntityOptions & {
|
|
141
|
+
entityName?: string;
|
|
142
|
+
}): Promise<InlineEntityValidation[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Apply field edits to an entity and write it back.
|
|
145
|
+
*
|
|
146
|
+
* Validates the resulting document before writing, so a rejected edit leaves
|
|
147
|
+
* the file exactly as it was. Field-type translation is `authorField`'s;
|
|
148
|
+
* name and type-pair rules are `validateEntity`'s.
|
|
149
|
+
*/
|
|
150
|
+
export declare function inlineEntityUpdateAsync(projectName: string, entityName: string, update: InlineEntityUpdate, options?: InlineEntityOptions): Promise<{
|
|
151
|
+
entity: EntityJSON;
|
|
152
|
+
resourceFile: string;
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* The document `create --local` writes for a new entity with this
|
|
156
|
+
* definition — authored and validated, touching nothing on disk.
|
|
157
|
+
*
|
|
158
|
+
* `create` used to write an empty entity and then apply the definition as an
|
|
159
|
+
* update, so anything only this layer rejects failed after the first write
|
|
160
|
+
* and left an empty entity behind, blocking the retry. Authoring the whole
|
|
161
|
+
* document up front lets `create` write it once, and a rule added to
|
|
162
|
+
* `authorField` or `validateEntity` guards the create with no copy in the
|
|
163
|
+
* command layer. The name's collision checks stay with the write: they need
|
|
164
|
+
* the solution.
|
|
165
|
+
*/
|
|
166
|
+
export declare function authorNewEntity(entityName: string, definition: Pick<InlineEntityUpdate, "addFields" | "displayName" | "description">): EntityJSON;
|
|
167
|
+
/**
|
|
168
|
+
* Add an entity to a project that already exists.
|
|
169
|
+
*
|
|
170
|
+
* The first entity of a new project comes from `entityInitAsync`, which also
|
|
171
|
+
* creates the project and registers it in the `.uipx`. This is the second and
|
|
172
|
+
* later ones: pack already supports many entities per project, and only the
|
|
173
|
+
* scaffolder was limited to one.
|
|
174
|
+
*/
|
|
175
|
+
export declare function inlineEntityAddAsync(projectName: string, entityName: string, options?: InlineEntityOptions,
|
|
176
|
+
/** From {@link authorNewEntity}; an empty skeleton when omitted. */
|
|
177
|
+
authored?: EntityJSON): Promise<{
|
|
178
|
+
entityFile: string;
|
|
179
|
+
resourceFile: string;
|
|
180
|
+
}>;
|
|
181
|
+
/** What a delete removed. Under `force` either half may be absent, because
|
|
182
|
+
* the point of that path is a pair that is already half there. */
|
|
183
|
+
export interface InlineEntityDeletion {
|
|
184
|
+
stubFile?: string;
|
|
185
|
+
resourceFile?: string;
|
|
186
|
+
/** True when the pair did not verify and `force` removed what it found. */
|
|
187
|
+
forced?: boolean;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Remove an entity: its stub and its definition resource.
|
|
191
|
+
*
|
|
192
|
+
* `force` is for the state that most needs removing — a broken pair. Delete
|
|
193
|
+
* used to resolve the entity first, which refuses anything `verifyPair`
|
|
194
|
+
* rejects, so every row `list` reports with a `Problem` was undeletable by
|
|
195
|
+
* CLI and had to be cleaned up by hand.
|
|
196
|
+
*/
|
|
197
|
+
export declare function inlineEntityDeleteAsync(projectName: string, entityName: string, options?: InlineEntityOptions & {
|
|
198
|
+
force?: boolean;
|
|
199
|
+
}): Promise<InlineEntityDeletion>;
|
|
200
|
+
/**
|
|
201
|
+
* Remove a definition resource that no `.entity` stub declares — what an
|
|
202
|
+
* interrupted create or delete leaves behind. There is no project to name, so
|
|
203
|
+
* `delete <Name> --local --force` without `--project-name` lands here when the
|
|
204
|
+
* owner lookup finds none; the resource must still pass every check
|
|
205
|
+
* `--force` applies to one (inside the solution, a file, unowned, locally
|
|
206
|
+
* authored).
|
|
207
|
+
*/
|
|
208
|
+
export declare function inlineEntityDeleteOrphanAsync(entityName: string, options?: InlineEntityOptions): Promise<InlineEntityDeletion>;
|
|
209
|
+
export {};
|
package/dist/inline.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline entity authoring — read and edit the entities of an Entity project on
|
|
3
|
+
* disk. A separate entry (like `./init`) because it needs the filesystem and
|
|
4
|
+
* solution-sdk, node-only machinery the root module must not pull into browser
|
|
5
|
+
* bundles.
|
|
6
|
+
*/
|
|
7
|
+
export type { InlineEntityDeletion, InlineEntityErrorCode, InlineEntityOptions, InlineEntitySolutionSummary, InlineEntitySummary, InlineEntityUpdate, InlineEntityValidation, } from "./inline/inline-entity-service.js";
|
|
8
|
+
export { authorNewEntity, INLINE_ENTITY_ERROR_CODES, InlineEntityError, inlineEntityAddAsync, inlineEntityDeleteAsync, inlineEntityDeleteOrphanAsync, inlineEntityGetAsync, inlineEntityListAllAsync, inlineEntityListAsync, inlineEntityUpdateAsync, inlineEntityValidateAsync, resolveOwningProjectAsync, resolveProjectAsync, solutionRootAsync, } from "./inline/inline-entity-service.js";
|