Skip to content

Commit 0900e2d

Browse files
feat: onboarding attachments (#252)
1 parent c3fdaf7 commit 0900e2d

27 files changed

Lines changed: 537 additions & 4 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
echo "data_fabric_test_choiceset_id=${{ secrets.UIPATH_DATA_FABRIC_TEST_CHOICESET_ID_DEV || secrets.UIPATH_DATA_FABRIC_TEST_CHOICESET_ID }}" >> $GITHUB_OUTPUT
6060
echo "data_fabric_test_record_id=${{ secrets.UIPATH_DATA_FABRIC_TEST_RECORD_ID_DEV || secrets.UIPATH_DATA_FABRIC_TEST_RECORD_ID }}" >> $GITHUB_OUTPUT
6161
echo "data_fabric_test_attachment_field=${{ secrets.UIPATH_DATA_FABRIC_TEST_ATTACHMENT_FIELD_DEV || secrets.UIPATH_DATA_FABRIC_TEST_ATTACHMENT_FIELD }}" >> $GITHUB_OUTPUT
62+
echo "orchestrator_attachment_id=${{ secrets.UIPATH_ORCHESTRATOR_ATTACHMENT_ID_DEV || secrets.UIPATH_ORCHESTRATOR_ATTACHMENT_ID }}" >> $GITHUB_OUTPUT
6263
6364
- name: Create Integration Test Configuration
6465
if: github.base_ref == 'main'
@@ -78,6 +79,7 @@ jobs:
7879
DATA_FABRIC_TEST_RECORD_ID=${{ steps.config.outputs.data_fabric_test_record_id }}
7980
DATA_FABRIC_TEST_ATTACHMENT_FIELD=${{ steps.config.outputs.data_fabric_test_attachment_field }}
8081
ORCHESTRATOR_TEST_PROCESS_KEY=${{ steps.config.outputs.orchestrator_test_process_key }}
82+
ORCHESTRATOR_ATTACHMENT_ID=${{ steps.config.outputs.orchestrator_attachment_id }}
8183
EOF
8284
8385
- name: Run Integration Tests

docs/oauth-scopes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ This page lists the specific OAuth scopes required in external app for each SDK
1515
|--------|-------------|
1616
| `getAll()` | `OR.Jobs` or `OR.Jobs.Read` |
1717

18+
## Attachments
19+
20+
| Method | OAuth Scope |
21+
|--------|-------------|
22+
| `getById()` | `OR.Folders` or `OR.Folders.Read` |
23+
1824
## Buckets
1925

2026
| Method | OAuth Scope |

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ plugins:
9191
- api/interfaces/QueueServiceModel.md: Queue service methods
9292
- api/interfaces/BucketServiceModel.md: Bucket service methods
9393
- api/interfaces/TaskServiceModel.md: Task service methods
94+
- api/interfaces/attachments/index.md: Attachment service methods
9495
- api/interfaces/entity/index.md: Entity service methods
9596
- api/interfaces/ChoiceSetServiceModel.md: Choice set service methods
9697
- api/interfaces/MaestroProcessesServiceModel.md: Maestro process methods
@@ -182,6 +183,8 @@ nav:
182183
- Session: api/interfaces/SessionStream.md
183184
- Exchanges: api/interfaces/ExchangeServiceModel.md
184185
- Messages: api/interfaces/MessageServiceModel.md
186+
- Attachments:
187+
- api/interfaces/attachments/index.md
185188
- Assets: api/interfaces/AssetServiceModel.md
186189
- Buckets: api/interfaces/BucketServiceModel.md
187190
- Entities:

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@
7676
"default": "./dist/jobs/index.cjs"
7777
}
7878
},
79+
"./attachments": {
80+
"import": {
81+
"types": "./dist/attachments/index.d.ts",
82+
"default": "./dist/attachments/index.mjs"
83+
},
84+
"require": {
85+
"types": "./dist/attachments/index.d.ts",
86+
"default": "./dist/attachments/index.cjs"
87+
}
88+
},
7989
"./queues": {
8090
"import": {
8191
"types": "./dist/queues/index.d.ts",

packages/cli/src/constants/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export const MESSAGES = {
139139
//Action schema validations
140140
INVALID_PROPERTY_TYPE: 'Invalid type. Must be one of: string, integer, number, boolean, array, object',
141141
INVALID_PROPERTY_FORMAT: 'Invalid format. Must be one of: uuid, date',
142+
INVALID_TYPE_FOR_FORMAT: 'Format is only supported for type string',
142143
MISSING_ITEMS_ARRAY: 'Array properties must have an "items" field',
143144
NESTED_ARRAYS_NOT_SUPPORTED: 'Nested arrays are not allowed. Array items cannot be of type array',
144145
SECTION_TYPE_INVALID: 'Section type must be "object"',

packages/cli/src/types/action-app.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum JsonDataType {
1313
boolean = 'boolean',
1414
array = 'array',
1515
object = 'object',
16+
file = 'file',
1617
}
1718

1819
export enum JsonFormatType {
@@ -36,6 +37,7 @@ export enum VBDataType {
3637
dateOnly = 'System.DateOnly',
3738
guid = 'System.Guid',
3839
object = 'System.Object',
40+
iresource = 'UiPath.Platform.ResourceHandling.IResource',
3941
}
4042

4143
export const JsonSchemaPropertySchema: z.ZodType<JsonSchemaProperty> = z.lazy(() =>
@@ -47,6 +49,7 @@ export const JsonSchemaPropertySchema: z.ZodType<JsonSchemaProperty> = z.lazy(()
4749
JsonDataType.boolean,
4850
JsonDataType.array,
4951
JsonDataType.object,
52+
JsonDataType.file,
5053
], { message: MESSAGES.ERRORS.INVALID_PROPERTY_TYPE }),
5154
required: z.boolean().optional(),
5255
description: z.string().optional(),
@@ -64,6 +67,14 @@ export const JsonSchemaPropertySchema: z.ZodType<JsonSchemaProperty> = z.lazy(()
6467
}, {
6568
message: MESSAGES.ERRORS.MISSING_ITEMS_ARRAY
6669
})
70+
.refine((data) => {
71+
if (data.format && data.type!== JsonDataType.string) { // for preventing format being used with non string type
72+
return false;
73+
}
74+
return true;
75+
}, {
76+
message: MESSAGES.ERRORS.INVALID_TYPE_FOR_FORMAT,
77+
})
6778
.refine((data) => {
6879
if (data.type === JsonDataType.array && data.items) { // for preventing nested arrays
6980
return data.items.type !== JsonDataType.array;

packages/cli/src/utils/action-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function mapJsonTypeToSystemType(type: JsonDataType, format?: JsonFormatType): V
4747
case JsonDataType.number: return VBDataType.decimal;
4848
case JsonDataType.boolean: return VBDataType.boolean;
4949
case JsonDataType.object: return VBDataType.object;
50+
case JsonDataType.file: return VBDataType.iresource;
5051
default:
5152
throw new Error(`${MESSAGES.ERRORS.UNSUPPORTED_JSON_DATA_TYPE} ${type}`);
5253
}

rollup.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ const serviceEntries = [
159159
input: 'src/services/orchestrator/jobs/index.ts',
160160
output: 'jobs/index'
161161
},
162+
{
163+
name: 'attachments',
164+
input: 'src/services/orchestrator/attachments/index.ts',
165+
output: 'attachments/index'
166+
},
162167
{
163168
name: 'queues',
164169
input: 'src/services/orchestrator/queues/index.ts',

scripts/docs-post-process.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
import { mkdirSync, readFileSync, writeFileSync, unlinkSync, existsSync } from 'fs';
12-
import { join, dirname, relative } from 'path';
12+
import { join, dirname, relative, sep } from 'path';
1313

1414
const DOCS_DIR = join(process.cwd(), 'docs');
1515

@@ -24,6 +24,12 @@ const sections = [
2424
header: '---\ntitle: Entities\n---\n',
2525
removeSource: true,
2626
},
27+
{
28+
source: 'api/interfaces/AttachmentServiceModel.md',
29+
dest: 'api/interfaces/attachments/index.md',
30+
header: '---\ntitle: Attachments\n---\n',
31+
removeSource: true,
32+
},
2733
{
2834
source: 'api/interfaces/ConversationalAgentServiceModel.md',
2935
dest: 'conversational-agent/index.md',
@@ -59,7 +65,7 @@ for (const { source, dest, header, removeSource } of sections) {
5965

6066
const [linkPath, anchor] = link.split('#');
6167
const resolved = join(sourceDir, linkPath);
62-
const rewritten = relative(destDir, resolved);
68+
const rewritten = relative(destDir, resolved).split(sep).join('/');
6369

6470
return `](${anchor ? `${rewritten}#${anchor}` : rewritten})`;
6571
},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Maps fields for Attachment entities to ensure consistent naming
3+
*/
4+
export const AttachmentsMap: { [key: string]: string } = {
5+
creationTime: 'createdTime',
6+
lastModificationTime: 'lastModifiedTime'
7+
};

0 commit comments

Comments
 (0)