@elementumai/edk 0.8.0-preview.11 → 0.8.2-alpha.5
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 +510 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +83 -4
- package/dist-sdk/src/catalog/from-authoring.js +19 -2
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +134 -50
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +18 -0
- package/dist-sdk/src/catalog/types.d.ts +75 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +58 -0
- package/dist-sdk/src/engine/build/context.js +11 -1
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +54 -0
- package/dist-sdk/src/engine/tf/labels.js +75 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +15 -0
- package/dist-sdk/src/engine/tf/parse.js +162 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +66 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +187 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +164 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +2 -0
- package/dist-sdk/src/entities/agent/build.js +1 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +257 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +29 -9
- package/dist-sdk/src/entities/agent/from-tf.js +146 -19
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +14 -4
- package/dist-sdk/src/entities/agent/to-tf.d.ts +46 -1
- package/dist-sdk/src/entities/agent/to-tf.js +160 -14
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +64 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.js +14 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +47 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +176 -30
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +91 -13
- package/dist-sdk/src/entities/app/build.js +63 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -22
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +10 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +45 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +62 -42
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +206 -47
- package/dist-sdk/src/entities/automation/filter.d.ts +37 -3
- package/dist-sdk/src/entities/automation/filter.js +54 -3
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1344 -222
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1291 -230
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +44 -13
- package/dist-sdk/src/entities/element/build.js +45 -3
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +28 -14
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +26 -3
- package/dist-sdk/src/entities/field/build.d.ts +61 -14
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +46 -11
- package/dist-sdk/src/entities/field/to-tf.js +166 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +59 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +46 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +128 -11
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +7 -1
- package/dist-sdk/src/entities/skill/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/skill/to-tf.js +65 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +37 -8
- package/dist-sdk/src/entities/skill/tools.js +43 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +34 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.js +128 -18
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +13 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +164 -25
- package/dist-sdk/src/entities/skill-tool/types.d.ts +5 -7
- package/dist-sdk/src/entities/skill-tool/types.js +47 -11
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +39 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +8 -1
- package/dist-sdk/src/graph/types.d.ts +98 -4
- package/package.json +49 -16
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
* A sub-type that grows real per-kind logic graduates to its own file under
|
|
7
7
|
* this directory (the automation task/ pattern).
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* A group/user field's `defaultValue`, when the wire value is a
|
|
11
|
+
* `data.elementum_group|user.<label>.id` EXPRESSION rather than a plain
|
|
12
|
+
* scalar — round-tripped as this tagged shape (see `field/from-tf.ts`) so
|
|
13
|
+
* `fieldToTf` can re-emit the exact same data lookup instead of either
|
|
14
|
+
* dropping the value (a live destroy on every build, since the attribute is
|
|
15
|
+
* Optional-without-Computed) or fabricating an unresolvable raw id.
|
|
16
|
+
*/
|
|
17
|
+
export interface OrgFieldRefValue {
|
|
18
|
+
readonly __kind: "orgFieldRef";
|
|
19
|
+
readonly dataType: "elementum_group" | "elementum_user";
|
|
20
|
+
/** The data block's own label, captured verbatim — reproduced byte-for-byte, never re-derived. */
|
|
21
|
+
readonly label: string;
|
|
22
|
+
/** The data block's lookup-attr value ("name" for a group, "email" for a user). */
|
|
23
|
+
readonly value: string;
|
|
24
|
+
}
|
|
9
25
|
/** One field sub-type: the authoring variant key ↔ resource type ↔ normalized type triple. */
|
|
10
26
|
export interface FieldSubType {
|
|
11
27
|
/** `AspectFieldInput` variant key — the key under `fields: {}` entries ("html"). */
|
|
@@ -16,6 +32,16 @@ export interface FieldSubType {
|
|
|
16
32
|
readonly authoringType: string;
|
|
17
33
|
/** Carries an `options` attribute (the picklist kinds). */
|
|
18
34
|
readonly hasOptions?: true;
|
|
35
|
+
/** Carries `related_object_id`/`related_label_field_id`/`auto_relate` instead of the generic default_value/options handling (the "relation" sub-type only). */
|
|
36
|
+
readonly hasRelation?: true;
|
|
37
|
+
/**
|
|
38
|
+
* Round-trips through fieldFromTf/fieldToTf today. Declared-but-absent
|
|
39
|
+
* (undefined) sub-types are recognized (so fieldFromTf doesn't report
|
|
40
|
+
* "unknown resource" for them) but extraction reports them `skipped`
|
|
41
|
+
* rather than attempting the generic field shape - same convention as
|
|
42
|
+
* file-reader's/automation's per-sub-type `implemented` flags.
|
|
43
|
+
*/
|
|
44
|
+
readonly implemented?: true;
|
|
19
45
|
}
|
|
20
46
|
export declare const FIELD_SUB_TYPES: readonly FieldSubType[];
|
|
21
47
|
export declare const SUB_TYPE_BY_TYPE_KEY: ReadonlyMap<string, FieldSubType>;
|
|
@@ -7,23 +7,40 @@
|
|
|
7
7
|
* this directory (the automation task/ pattern).
|
|
8
8
|
*/
|
|
9
9
|
export const FIELD_SUB_TYPES = [
|
|
10
|
-
{ typeKey: "text", resourceType: "elementum_text_field", authoringType: "TEXT" },
|
|
11
|
-
{ typeKey: "html", resourceType: "elementum_longtext_field", authoringType: "HTML" },
|
|
12
|
-
{ typeKey: "number", resourceType: "elementum_number_field", authoringType: "NUMBER" },
|
|
13
|
-
{ typeKey: "decimal", resourceType: "elementum_decimal_field", authoringType: "DECIMAL" },
|
|
14
|
-
{ typeKey: "bool", resourceType: "elementum_boolean_field", authoringType: "BOOLEAN" },
|
|
15
|
-
{ typeKey: "date", resourceType: "elementum_date_field", authoringType: "DATE" },
|
|
16
|
-
{ typeKey: "dateTime", resourceType: "elementum_datetime_field", authoringType: "DATETIME" },
|
|
17
|
-
{ typeKey: "user", resourceType: "elementum_user_field", authoringType: "USER" },
|
|
18
|
-
{ typeKey: "group", resourceType: "elementum_group_field", authoringType: "GROUP" },
|
|
19
|
-
{ typeKey: "attachment", resourceType: "elementum_attachment_field", authoringType: "ATTACHMENT" },
|
|
20
|
-
{ typeKey: "json", resourceType: "elementum_json_field", authoringType: "JSON" },
|
|
21
|
-
{
|
|
10
|
+
{ typeKey: "text", resourceType: "elementum_text_field", authoringType: "TEXT", implemented: true },
|
|
11
|
+
{ typeKey: "html", resourceType: "elementum_longtext_field", authoringType: "HTML", implemented: true },
|
|
12
|
+
{ typeKey: "number", resourceType: "elementum_number_field", authoringType: "NUMBER", implemented: true },
|
|
13
|
+
{ typeKey: "decimal", resourceType: "elementum_decimal_field", authoringType: "DECIMAL", implemented: true },
|
|
14
|
+
{ typeKey: "bool", resourceType: "elementum_boolean_field", authoringType: "BOOLEAN", implemented: true },
|
|
15
|
+
{ typeKey: "date", resourceType: "elementum_date_field", authoringType: "DATE", implemented: true },
|
|
16
|
+
{ typeKey: "dateTime", resourceType: "elementum_datetime_field", authoringType: "DATETIME", implemented: true },
|
|
17
|
+
{ typeKey: "user", resourceType: "elementum_user_field", authoringType: "USER", implemented: true },
|
|
18
|
+
{ typeKey: "group", resourceType: "elementum_group_field", authoringType: "GROUP", implemented: true },
|
|
19
|
+
{ typeKey: "attachment", resourceType: "elementum_attachment_field", authoringType: "ATTACHMENT", implemented: true },
|
|
20
|
+
{ typeKey: "json", resourceType: "elementum_json_field", authoringType: "JSON", implemented: true },
|
|
21
|
+
{
|
|
22
|
+
typeKey: "picklist",
|
|
23
|
+
resourceType: "elementum_dropdown_field",
|
|
24
|
+
authoringType: "PICKLIST",
|
|
25
|
+
hasOptions: true,
|
|
26
|
+
implemented: true,
|
|
27
|
+
},
|
|
22
28
|
{
|
|
23
29
|
typeKey: "multiPicklist",
|
|
24
30
|
resourceType: "elementum_multiselect_field",
|
|
25
31
|
authoringType: "MULTI_PICKLIST",
|
|
26
32
|
hasOptions: true,
|
|
33
|
+
implemented: true,
|
|
34
|
+
},
|
|
35
|
+
// related_object_id/related_label_field_id/auto_relate are handled
|
|
36
|
+
// specially in fieldFromTf/fieldToTf (see hasRelation below), not via the
|
|
37
|
+
// generic default_value/options handling other sub-types share.
|
|
38
|
+
{
|
|
39
|
+
typeKey: "relation",
|
|
40
|
+
resourceType: "elementum_relation_field",
|
|
41
|
+
authoringType: "RELATION",
|
|
42
|
+
hasRelation: true,
|
|
43
|
+
implemented: true,
|
|
27
44
|
},
|
|
28
45
|
];
|
|
29
46
|
export const SUB_TYPE_BY_TYPE_KEY = new Map(FIELD_SUB_TYPES.map((t) => [t.typeKey, t]));
|
|
@@ -43,4 +60,9 @@ export const KNOWN_FIELD_ATTRS = new Set([
|
|
|
43
60
|
"column_name",
|
|
44
61
|
"default_value",
|
|
45
62
|
"options",
|
|
63
|
+
"field_role",
|
|
64
|
+
"related_object_id",
|
|
65
|
+
"related_label_field_id",
|
|
66
|
+
"auto_relate",
|
|
67
|
+
"decimal_places",
|
|
46
68
|
]);
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* —
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (only `name` can change) — `wire-client.ts`'s update dispatch throws for
|
|
12
|
-
* that variant if anything beyond `name` changed.
|
|
2
|
+
* File-reader authoring. Targets the real terraform resources
|
|
3
|
+
* (`elementum_excel_file_reader`, `elementum_json_file_reader`,
|
|
4
|
+
* `elementum_text_file_reader`) — replaces an earlier `defineFileReader` that
|
|
5
|
+
* targeted a pre-refactor, non-terraform GraphQL mutation path
|
|
6
|
+
* (`documentModelCreate`/`documentModelUpdate` against "the tenant graph")
|
|
7
|
+
* with a different, incompatible option shape. That path was never wired
|
|
8
|
+
* into `elementum build`/`pull` (confirmed: nothing outside this directory
|
|
9
|
+
* referenced it) — this is a from-scratch terraform-facing builder, not a
|
|
10
|
+
* migration of the old one.
|
|
13
11
|
*/
|
|
14
12
|
import type { FileReaderCatalogRef } from "../../catalog/index.js";
|
|
15
13
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
16
|
-
import type { FileReaderCreateInput, FileReaderUpdateInput, InvoiceFieldLabel } from "../../../elementum-entity-client/clients/document-models/models/document-model.js";
|
|
17
14
|
/**
|
|
18
|
-
* A field in a JSON/XML
|
|
19
|
-
*
|
|
15
|
+
* A field in a JSON/XML file reader's structure tree. `object`/`array` nest
|
|
16
|
+
* recursively, mirroring the `structure`/`values` JSON-encoded attribute's
|
|
17
|
+
* shape (`{ properties: [...] }`).
|
|
20
18
|
*/
|
|
21
19
|
export type JsonStructureField = {
|
|
22
20
|
readonly type: "text";
|
|
@@ -47,78 +45,138 @@ export type JsonStructureField = {
|
|
|
47
45
|
readonly name: string;
|
|
48
46
|
readonly itemType: JsonStructureField;
|
|
49
47
|
};
|
|
50
|
-
/**
|
|
51
|
-
export interface FileReaderAiField {
|
|
52
|
-
readonly name: string;
|
|
53
|
-
readonly description: string;
|
|
54
|
-
readonly required: boolean;
|
|
55
|
-
readonly type: string;
|
|
56
|
-
}
|
|
57
|
-
/** Where in the spreadsheet an Excel field's value lives. */
|
|
48
|
+
/** Where in the spreadsheet an Excel field's value lives (all 0-based). */
|
|
58
49
|
export interface ExcelCellLocation {
|
|
59
50
|
readonly sheet: number;
|
|
60
51
|
readonly row: number;
|
|
61
52
|
readonly column: number;
|
|
62
53
|
}
|
|
63
|
-
/** An Excel
|
|
54
|
+
/** An Excel field mapping — a fixed cell location plus its extracted type. */
|
|
64
55
|
export interface FileReaderExcelField {
|
|
56
|
+
readonly name: string;
|
|
57
|
+
/** e.g. "TEXT", "NUMBER", "DECIMAL", "BOOLEAN", "DATE", "DATETIME", "PICKLIST", "USER_ID", "GROUP_ID", "HTML", "LOCALIZATION_KEY", "UUID". */
|
|
58
|
+
readonly type: string;
|
|
59
|
+
readonly location: ExcelCellLocation;
|
|
60
|
+
/** Defaults to true on the platform. */
|
|
61
|
+
readonly include?: boolean;
|
|
62
|
+
/** Defaults to true on the platform. */
|
|
63
|
+
readonly required?: boolean;
|
|
64
|
+
}
|
|
65
|
+
interface FileReaderOptionsBase extends EntityDeployOptions {
|
|
66
|
+
readonly parent: string;
|
|
67
|
+
readonly name: string;
|
|
68
|
+
}
|
|
69
|
+
export interface FileReaderExcelOptions extends FileReaderOptionsBase {
|
|
70
|
+
readonly type: "excel";
|
|
71
|
+
readonly firstRowIsHeader: boolean;
|
|
72
|
+
readonly fields: readonly FileReaderExcelField[];
|
|
73
|
+
/**
|
|
74
|
+
* Base64 content of the sample spreadsheet `fields[].location` values are
|
|
75
|
+
* relative to. Required when creating a new resource (enforced by the
|
|
76
|
+
* provider at apply time, not by its schema); the platform never returns
|
|
77
|
+
* it back on read, so a pulled file reader can't reconstruct it — pull
|
|
78
|
+
* leaves this unset (matching the null state already on an imported
|
|
79
|
+
* resource) rather than fabricate a value that would plan a replace.
|
|
80
|
+
*/
|
|
81
|
+
readonly documentContent?: string;
|
|
82
|
+
readonly documentName?: string;
|
|
83
|
+
readonly fileType?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface FileReaderJsonOptions extends FileReaderOptionsBase {
|
|
86
|
+
readonly type: "json";
|
|
87
|
+
readonly structure: readonly JsonStructureField[];
|
|
88
|
+
}
|
|
89
|
+
export interface FileReaderTextOptions extends FileReaderOptionsBase {
|
|
90
|
+
readonly type: "text";
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A field the AI file reader extracts. Named with an `AiFileReader-` prefix
|
|
94
|
+
* (not `FileReaderAi-`) to avoid colliding with the deprecated
|
|
95
|
+
* `FileReaderAiField`/`FileReaderAiOptions` legacy exports below, which keep
|
|
96
|
+
* their names for published API back-compat.
|
|
97
|
+
*/
|
|
98
|
+
export interface AiFileReaderField {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly description: string;
|
|
101
|
+
/** e.g. "TEXT", "NUMBER", "DECIMAL", "BOOLEAN", "DATE", "DATETIME". */
|
|
102
|
+
readonly type: string;
|
|
103
|
+
/** Defaults to true on the platform. */
|
|
104
|
+
readonly required?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface AiFileReaderOptions extends FileReaderOptionsBase {
|
|
107
|
+
readonly type: "ai";
|
|
108
|
+
readonly instructions: string;
|
|
109
|
+
readonly fields: readonly AiFileReaderField[];
|
|
110
|
+
}
|
|
111
|
+
export type FileReaderOptions = FileReaderExcelOptions | FileReaderJsonOptions | FileReaderTextOptions | AiFileReaderOptions;
|
|
112
|
+
/** The authored shape stored as `DeployableEntity.payload` — `FileReaderOptions` minus the deploy-only `parent`/`enabled`. */
|
|
113
|
+
export type FileReaderPayload = Omit<FileReaderExcelOptions, "parent" | "enabled"> | Omit<FileReaderJsonOptions, "parent" | "enabled"> | Omit<FileReaderTextOptions, "parent" | "enabled"> | Omit<AiFileReaderOptions, "parent" | "enabled">;
|
|
114
|
+
export interface FileReaderConfigured {
|
|
115
|
+
ref(refName: string): FileReaderCatalogRef;
|
|
116
|
+
def(refName: string): DeployableEntity;
|
|
117
|
+
}
|
|
118
|
+
export declare function defineFileReader(opts: FileReaderOptions): FileReaderConfigured;
|
|
119
|
+
import type { FileReaderCreateInput, FileReaderUpdateInput, InvoiceFieldLabel } from "../../../elementum-entity-client/clients/document-models/models/document-model.js";
|
|
120
|
+
/** @deprecated Pre-terraform API. An AI-extraction field definition. */
|
|
121
|
+
export interface FileReaderAiField {
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly description: string;
|
|
124
|
+
readonly required: boolean;
|
|
125
|
+
readonly type: string;
|
|
126
|
+
}
|
|
127
|
+
/** @deprecated Pre-terraform API. An Excel/Excel-cell field mapping — renamed from `FileReaderExcelField` (now a different shape). */
|
|
128
|
+
export interface LegacyFileReaderExcelField {
|
|
65
129
|
readonly name?: string;
|
|
66
130
|
readonly fieldType: string;
|
|
67
131
|
readonly required: boolean;
|
|
68
132
|
readonly include: boolean;
|
|
69
133
|
readonly location?: ExcelCellLocation;
|
|
70
134
|
}
|
|
71
|
-
|
|
72
|
-
readonly parent: string;
|
|
73
|
-
readonly name: string;
|
|
74
|
-
}
|
|
135
|
+
/** @deprecated Pre-terraform API. */
|
|
75
136
|
export interface FileReaderAiOptions extends FileReaderOptionsBase {
|
|
76
137
|
readonly type: "ai";
|
|
77
138
|
readonly instructions: string;
|
|
78
139
|
readonly fields: readonly FileReaderAiField[];
|
|
79
140
|
}
|
|
80
|
-
|
|
141
|
+
/** @deprecated Pre-terraform API. Renamed from `FileReaderExcelOptions` (now a different shape, targeting `elementum_excel_file_reader` directly). */
|
|
142
|
+
export interface LegacyFileReaderExcelOptions extends FileReaderOptionsBase {
|
|
81
143
|
readonly type: "excel";
|
|
82
144
|
readonly documentId: string;
|
|
83
145
|
readonly firstRowIsHeader: boolean;
|
|
84
|
-
readonly fields: readonly
|
|
146
|
+
readonly fields: readonly LegacyFileReaderExcelField[];
|
|
85
147
|
}
|
|
148
|
+
/** @deprecated Pre-terraform API. */
|
|
86
149
|
export interface FileReaderExcelCellOptions extends FileReaderOptionsBase {
|
|
87
150
|
readonly type: "excelCell";
|
|
88
151
|
readonly documentId: string;
|
|
89
|
-
readonly fields: readonly
|
|
152
|
+
readonly fields: readonly LegacyFileReaderExcelField[];
|
|
90
153
|
}
|
|
154
|
+
/** @deprecated Pre-terraform API. */
|
|
91
155
|
export interface FileReaderInvoiceOptions extends FileReaderOptionsBase {
|
|
92
156
|
readonly type: "invoice";
|
|
93
157
|
readonly fields: readonly InvoiceFieldLabel[];
|
|
94
158
|
}
|
|
95
|
-
|
|
96
|
-
readonly type: "json";
|
|
97
|
-
readonly structure: readonly JsonStructureField[];
|
|
98
|
-
}
|
|
159
|
+
/** @deprecated Pre-terraform API. */
|
|
99
160
|
export interface FileReaderOcrOptions extends FileReaderOptionsBase {
|
|
100
161
|
readonly type: "ocr";
|
|
101
162
|
}
|
|
163
|
+
/** @deprecated Pre-terraform API. */
|
|
102
164
|
export interface FileReaderXmlOptions extends FileReaderOptionsBase {
|
|
103
165
|
readonly type: "xml";
|
|
104
166
|
readonly structure: readonly JsonStructureField[];
|
|
105
167
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
168
|
+
/** @deprecated Pre-terraform API. Renamed from `FileReaderOptions` (now the terraform-facing union above). */
|
|
169
|
+
export type LegacyFileReaderOptions = FileReaderAiOptions | LegacyFileReaderExcelOptions | FileReaderExcelCellOptions | FileReaderInvoiceOptions | FileReaderJsonOptions | FileReaderOcrOptions | FileReaderXmlOptions;
|
|
170
|
+
/** @deprecated Pre-terraform API. Renamed from `FileReaderPayload` (now the terraform-facing union above). */
|
|
171
|
+
export type LegacyFileReaderPayload = Omit<FileReaderAiOptions, "parent" | "enabled"> | Omit<LegacyFileReaderExcelOptions, "parent" | "enabled"> | Omit<FileReaderExcelCellOptions, "parent" | "enabled"> | Omit<FileReaderInvoiceOptions, "parent" | "enabled"> | Omit<FileReaderJsonOptions, "parent" | "enabled"> | Omit<FileReaderOcrOptions, "parent" | "enabled"> | Omit<FileReaderXmlOptions, "parent" | "enabled">;
|
|
172
|
+
/** @deprecated Pre-terraform API. Build the `documentModelCreate` mutation input from a document model's authored payload. */
|
|
173
|
+
export declare function fileReaderCreateBody(opts: LegacyFileReaderPayload): FileReaderCreateInput;
|
|
111
174
|
/**
|
|
112
|
-
* Build the `documentModelUpdate` mutation
|
|
113
|
-
* path on the graph for its own content —
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
175
|
+
* @deprecated Pre-terraform API. Build the `documentModelUpdate` mutation
|
|
176
|
+
* input. `excelCell` has no update path on the graph for its own content —
|
|
177
|
+
* only `name` — so callers must route any other excelCell change to
|
|
178
|
+
* update-unsupported themselves before calling this with excelCell content
|
|
179
|
+
* changes.
|
|
117
180
|
*/
|
|
118
|
-
export declare function fileReaderUpdateBody(opts:
|
|
119
|
-
export interface FileReaderConfigured {
|
|
120
|
-
ref(refName: string): FileReaderCatalogRef;
|
|
121
|
-
def(refName: string): DeployableEntity;
|
|
122
|
-
}
|
|
123
|
-
export declare function defineFileReader(opts: FileReaderOptions): FileReaderConfigured;
|
|
181
|
+
export declare function fileReaderUpdateBody(opts: LegacyFileReaderPayload): FileReaderUpdateInput;
|
|
124
182
|
export {};
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export function defineFileReader(opts) {
|
|
2
|
+
return {
|
|
3
|
+
ref(refName) {
|
|
4
|
+
return { __kind: "documentModel", refName, name: opts.name, parent: opts.parent, readerType: opts.type };
|
|
5
|
+
},
|
|
6
|
+
def(refName) {
|
|
7
|
+
const { parent, enabled, ...payload } = opts;
|
|
8
|
+
return {
|
|
9
|
+
kind: "documentModel",
|
|
10
|
+
parent,
|
|
11
|
+
refName,
|
|
12
|
+
payload,
|
|
13
|
+
...(enabled !== undefined ? { enabled } : {}),
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
1
18
|
function serializeJsonStructureField(f) {
|
|
2
19
|
switch (f.type) {
|
|
3
20
|
case "text":
|
|
@@ -33,7 +50,7 @@ function serializeExcelFields(fields) {
|
|
|
33
50
|
...(f.location !== undefined ? { location: f.location } : {}),
|
|
34
51
|
}));
|
|
35
52
|
}
|
|
36
|
-
/** Build the `documentModelCreate` mutation input from a document model's authored payload. */
|
|
53
|
+
/** @deprecated Pre-terraform API. Build the `documentModelCreate` mutation input from a document model's authored payload. */
|
|
37
54
|
export function fileReaderCreateBody(opts) {
|
|
38
55
|
switch (opts.type) {
|
|
39
56
|
case "ai":
|
|
@@ -62,11 +79,11 @@ export function fileReaderCreateBody(opts) {
|
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
/**
|
|
65
|
-
* Build the `documentModelUpdate` mutation
|
|
66
|
-
* path on the graph for its own content —
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
82
|
+
* @deprecated Pre-terraform API. Build the `documentModelUpdate` mutation
|
|
83
|
+
* input. `excelCell` has no update path on the graph for its own content —
|
|
84
|
+
* only `name` — so callers must route any other excelCell change to
|
|
85
|
+
* update-unsupported themselves before calling this with excelCell content
|
|
86
|
+
* changes.
|
|
70
87
|
*/
|
|
71
88
|
export function fileReaderUpdateBody(opts) {
|
|
72
89
|
switch (opts.type) {
|
|
@@ -86,20 +103,3 @@ export function fileReaderUpdateBody(opts) {
|
|
|
86
103
|
return { name: opts.name, xml: { name: opts.name, values: serializeJsonStructure(opts.structure) } };
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
|
-
export function defineFileReader(opts) {
|
|
90
|
-
return {
|
|
91
|
-
ref(refName) {
|
|
92
|
-
return { __kind: "documentModel", refName, name: opts.name, parent: opts.parent };
|
|
93
|
-
},
|
|
94
|
-
def(refName) {
|
|
95
|
-
const { parent, enabled, ...payload } = opts;
|
|
96
|
-
return {
|
|
97
|
-
kind: "documentModel",
|
|
98
|
-
parent,
|
|
99
|
-
refName,
|
|
100
|
-
payload,
|
|
101
|
-
...(enabled !== undefined ? { enabled } : {}),
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NormalizedFileReader } from "../from-tf.js";
|
|
2
|
+
export interface PrintFileReaderOptions {
|
|
3
|
+
/** The owning app's refName — the file's `parent` option. */
|
|
4
|
+
readonly parent: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function printFileReader(model: NormalizedFileReader, opts: PrintFileReaderOptions): string;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `NormalizedFileReader` → editable `defineFileReader({...})` source, a
|
|
3
|
+
* configured `{ ref, def }` builder call exported as default — same
|
|
4
|
+
* convention as the other configured-builder printers (`print-skill-v2.ts`,
|
|
5
|
+
* `print-agent.ts`). File readers carry no catalog-token references of their
|
|
6
|
+
* own (`parent` is a plain refName string), so this needs no `ImportTracker`.
|
|
7
|
+
*/
|
|
8
|
+
import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
9
|
+
export function printFileReader(model, opts) {
|
|
10
|
+
const { payload } = model;
|
|
11
|
+
const lines = [];
|
|
12
|
+
lines.push(`/**`);
|
|
13
|
+
lines.push(` * Auto-generated by EDK (pull). Hand-edit freely; the generator is a`);
|
|
14
|
+
lines.push(` * one-shot starting point, not a live-binding view.`);
|
|
15
|
+
lines.push(` */`);
|
|
16
|
+
lines.push("");
|
|
17
|
+
lines.push(`import { defineFileReader } from "${sdkPackageSpecifier("fileReaders")}";`);
|
|
18
|
+
lines.push("");
|
|
19
|
+
lines.push(`const fileReader = defineFileReader({`);
|
|
20
|
+
lines.push(` type: ${quote(payload.type)},`);
|
|
21
|
+
lines.push(` name: ${quote(payload.name)},`);
|
|
22
|
+
lines.push(` parent: ${quote(opts.parent)},`);
|
|
23
|
+
const body = printBody(payload);
|
|
24
|
+
if (body.length > 0)
|
|
25
|
+
lines.push(body);
|
|
26
|
+
lines.push(`});`);
|
|
27
|
+
lines.push("");
|
|
28
|
+
lines.push(`export default fileReader;`);
|
|
29
|
+
return lines.join("\n") + "\n";
|
|
30
|
+
}
|
|
31
|
+
function printBody(payload) {
|
|
32
|
+
switch (payload.type) {
|
|
33
|
+
case "excel":
|
|
34
|
+
return [
|
|
35
|
+
` firstRowIsHeader: ${payload.firstRowIsHeader},`,
|
|
36
|
+
` fields: ${printExcelFields(payload.fields)},`,
|
|
37
|
+
// documentContent/documentName/fileType are never recoverable from
|
|
38
|
+
// the platform (its own schema docs say so - Read() never returns
|
|
39
|
+
// any of the three on an already-imported resource), so pull never
|
|
40
|
+
// sets them: only needed to CREATE a genuinely new Excel reader, e.g.
|
|
41
|
+
// documentContent: filebase64("path/to/sample.xlsx"),
|
|
42
|
+
// documentName: "sample.xlsx",
|
|
43
|
+
// fileType: "xlsx",
|
|
44
|
+
...(payload.documentContent !== undefined ? [` documentContent: ${quote(payload.documentContent)},`] : []),
|
|
45
|
+
...(payload.documentName !== undefined ? [` documentName: ${quote(payload.documentName)},`] : []),
|
|
46
|
+
...(payload.fileType !== undefined ? [` fileType: ${quote(payload.fileType)},`] : []),
|
|
47
|
+
].join("\n");
|
|
48
|
+
case "json":
|
|
49
|
+
return ` structure: ${printStructure(payload.structure, 1)},`;
|
|
50
|
+
case "text":
|
|
51
|
+
return "";
|
|
52
|
+
case "ai":
|
|
53
|
+
return [
|
|
54
|
+
` instructions: ${quote(payload.instructions)},`,
|
|
55
|
+
` fields: ${printAiFields(payload.fields)},`,
|
|
56
|
+
].join("\n");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function printAiFields(fields) {
|
|
60
|
+
if (fields.length === 0)
|
|
61
|
+
return "[]";
|
|
62
|
+
const items = fields.map((f) => {
|
|
63
|
+
const parts = [`name: ${quote(f.name)}`, `description: ${quote(f.description)}`, `type: ${quote(f.type)}`];
|
|
64
|
+
if (f.required !== undefined)
|
|
65
|
+
parts.push(`required: ${f.required}`);
|
|
66
|
+
return `{ ${parts.join(", ")} }`;
|
|
67
|
+
});
|
|
68
|
+
return `[\n ${items.join(",\n ")},\n ]`;
|
|
69
|
+
}
|
|
70
|
+
function printExcelFields(fields) {
|
|
71
|
+
if (fields.length === 0)
|
|
72
|
+
return "[]";
|
|
73
|
+
const items = fields.map((f) => {
|
|
74
|
+
const parts = [`name: ${quote(f.name)}`, `type: ${quote(f.type)}`, `location: { sheet: ${f.location.sheet}, row: ${f.location.row}, column: ${f.location.column} }`];
|
|
75
|
+
if (f.include !== undefined)
|
|
76
|
+
parts.push(`include: ${f.include}`);
|
|
77
|
+
if (f.required !== undefined)
|
|
78
|
+
parts.push(`required: ${f.required}`);
|
|
79
|
+
return `{ ${parts.join(", ")} }`;
|
|
80
|
+
});
|
|
81
|
+
return `[\n ${items.join(",\n ")},\n ]`;
|
|
82
|
+
}
|
|
83
|
+
function printStructure(fields, indent) {
|
|
84
|
+
if (fields.length === 0)
|
|
85
|
+
return "[]";
|
|
86
|
+
const pad = " ".repeat(indent + 1);
|
|
87
|
+
const closePad = " ".repeat(indent);
|
|
88
|
+
const items = fields.map((f) => printStructureField(f, indent + 1));
|
|
89
|
+
return `[\n${pad}${items.join(`,\n${pad}`)},\n${closePad}]`;
|
|
90
|
+
}
|
|
91
|
+
function printStructureField(f, indent) {
|
|
92
|
+
switch (f.type) {
|
|
93
|
+
case "text":
|
|
94
|
+
case "number":
|
|
95
|
+
case "decimal":
|
|
96
|
+
case "boolean":
|
|
97
|
+
return `{ type: ${quote(f.type)}, name: ${quote(f.name)} }`;
|
|
98
|
+
case "date":
|
|
99
|
+
case "datetime":
|
|
100
|
+
return `{ type: ${quote(f.type)}, name: ${quote(f.name)}, format: ${quote(f.format)} }`;
|
|
101
|
+
case "object":
|
|
102
|
+
return `{ type: "object", name: ${quote(f.name)}, properties: ${printStructure(f.properties, indent)} }`;
|
|
103
|
+
case "array":
|
|
104
|
+
return `{ type: "array", name: ${quote(f.name)}, itemType: ${printStructureField(f.itemType, indent)} }`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function quote(s) {
|
|
108
|
+
return JSON.stringify(s);
|
|
109
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { FileReaderPayload } from "./build.js";
|
|
4
|
+
export interface NormalizedFileReader {
|
|
5
|
+
readonly refName: string;
|
|
6
|
+
readonly payload: FileReaderPayload;
|
|
7
|
+
}
|
|
8
|
+
export interface FileReaderFromTfResult {
|
|
9
|
+
readonly fileReader?: NormalizedFileReader;
|
|
10
|
+
/** Set when this block can't be authored on the terraform path — reported, not fatal (plan §6). */
|
|
11
|
+
readonly skippedReason?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function fileReaderFromTf(block: TfBlock, appTfLabel: string, _ctx: FromTfContext): FileReaderFromTfResult;
|