diff --git a/README.md b/README.md index 2942e08..c014c34 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,4 @@ $ npm i @elimity/insights-client | Client version | Insights version | | -------------- | ---------------- | | 1 | >=3.35 | +| 2 | >=3.38 | diff --git a/example/fixture.json b/example/fixture.json index 12dcb67..e613d15 100644 --- a/example/fixture.json +++ b/example/fixture.json @@ -69,20 +69,6 @@ "id": "1", "name": "Reader", "type": "role" - }, - { - "attributeAssignments": [ - { - "attributeTypeId": "securityLevel", - "value": { - "type": "number", - "value": 1 - } - } - ], - "id": "2", - "name": "Writer", - "type": "role" } ], "relationships": [ @@ -99,13 +85,35 @@ "fromEntityType": "user", "toEntityId": "1", "toEntityType": "role" + } + ], + "streamItems": [ + { + "entity": { + "attributeAssignments": [ + { + "attributeTypeId": "securityLevel", + "value": { + "type": "number", + "value": 1 + } + } + ], + "id": "2", + "name": "Writer", + "type": "role" + }, + "type": "entity" }, { - "attributeAssignments": [], - "fromEntityId": "2", - "fromEntityType": "user", - "toEntityId": "2", - "toEntityType": "role" + "relationship": { + "attributeAssignments": [], + "fromEntityId": "2", + "fromEntityType": "user", + "toEntityId": "2", + "toEntityType": "role" + }, + "type": "relationship" } ] } diff --git a/example/index.js b/example/index.js index 04074b2..0bf6840 100644 --- a/example/index.js +++ b/example/index.js @@ -6,4 +6,9 @@ const config = { sourceId: 1, sourceToken: "my-token", }; -await performImport(config, fixture.entities, fixture.relationships); +await performImport( + config, + fixture.entities, + fixture.relationships, + fixture.streamItems, +); diff --git a/index.ts b/index.ts index 253dae8..7cec71e 100644 --- a/index.ts +++ b/index.ts @@ -59,6 +59,11 @@ export interface Entity { readonly type: string; } +export interface EntityStreamItem { + readonly entity: Entity; + readonly type: StreamItemType.Entity; +} + /** Represents a number attribute assignment value. */ export interface NumberValue { readonly type: ValueType.Number; @@ -74,6 +79,18 @@ export interface Relationship { readonly toEntityType: string; } +export interface RelationshipStreamItem { + readonly relationship: Relationship; + readonly type: StreamItemType.Relationship; +} + +export type StreamItem = EntityStreamItem | RelationshipStreamItem; + +export enum StreamItemType { + Entity = "entity", + Relationship = "relationship", +} + /** Represents a string attribute assignment value. */ export interface StringValue { readonly type: ValueType.String; @@ -127,13 +144,16 @@ export async function performImport( config: Config, entities: AsyncIterable | Iterable, relationships: AsyncIterable | Iterable, + streamItems: AsyncIterable | Iterable, ): Promise { const service = createService(config); const entityStream = Readable.from(entities); const relationshipStream = Readable.from(relationships); + const itemStream = Readable.from(streamItems); const graph = { entities: entityStream, relationships: relationshipStream, + streamItems: itemStream, }; const stringify = new JsonStreamStringify(graph); const deflate = new Deflate(); diff --git a/openapi/schemas.gen.ts b/openapi/schemas.gen.ts index dca8f4f..66d63b4 100644 --- a/openapi/schemas.gen.ts +++ b/openapi/schemas.gen.ts @@ -166,10 +166,13 @@ export const accessReviewFormSchema = { "columnGroups", "createdAt", "dueDate", + "relationshipChanges", "relationships", "rowGroups", "rowQuestion", - "submitted", + "rowRemovals", + "submissionFinal", + "submittedAt", "toolbarBackgroundColor", "welcomeScreenHtml", ], @@ -186,6 +189,9 @@ export const accessReviewFormSchema = { columnGroups: { $ref: "#/definitions/accessReviewHeaderGroups", }, + relationshipChanges: { + $ref: "#/definitions/accessReviewRelationshipChanges", + }, relationships: { $ref: "#/definitions/accessReviewRelationships", }, @@ -195,9 +201,19 @@ export const accessReviewFormSchema = { rowQuestion: { type: "string", }, - submitted: { + rowRemovals: { + $ref: "#/definitions/accessReviewRowRemovals", + }, + submissionComment: { + type: "string", + "x-nullable": true, + }, + submissionFinal: { type: "boolean", }, + submittedAt: { + $ref: "#/definitions/dateTime", + }, toolbarBackgroundColor: { type: "string", }, @@ -595,11 +611,20 @@ export const accessReviewRowRemovalsSchema = { export const accessReviewSubmissionSchema = { type: "object", - required: ["comment", "relationshipChanges", "rowRemovals", "token"], + required: [ + "comment", + "isFinal", + "relationshipChanges", + "rowRemovals", + "token", + ], properties: { comment: { type: "string", }, + isFinal: { + type: "boolean", + }, relationshipChanges: { $ref: "#/definitions/accessReviewSubmissionRelationshipChanges", }, @@ -958,6 +983,11 @@ export const authModeSchema = { enum: ["oidc", "password"], } as const; +export const autofillPropertySchema = { + type: "string", + pattern: "^(attribute:.*|id|name)$", +} as const; + export const badRequestResponseSchema = { type: "object", required: ["errorMessage"], @@ -1347,6 +1377,46 @@ export const campaignTemplateGroupAssignmentSchema = { }, } as const; +export const campaignTemplateGroupAssignmentAutofillSchema = { + type: "object", + required: [ + "emailProperty", + "entityTypeId", + "matchOperator", + "matchProperty", + "matchReverse", + "nameProperty", + "overrideExisting", + "sourceId", + ], + properties: { + emailProperty: { + $ref: "#/definitions/autofillProperty", + }, + entityTypeId: { + type: "string", + }, + matchOperator: { + type: "string", + }, + matchProperty: { + $ref: "#/definitions/autofillProperty", + }, + matchReverse: { + type: "boolean", + }, + nameProperty: { + $ref: "#/definitions/autofillProperty", + }, + overrideExisting: { + type: "boolean", + }, + sourceId: { + type: "integer", + }, + }, +} as const; + export const campaignTemplateGroupAssignmentInputSchema = { type: "object", required: ["assigneeEmail", "assigneeName"], @@ -3921,6 +3991,22 @@ export const storedQueryDataSchema = { }, } as const; +export const storedQueryDefinitionSchema = { + type: "object", + required: ["condition", "entityType", "sourceId"], + properties: { + condition: { + $ref: "#/definitions/rawMessage", + }, + entityType: { + type: "string", + }, + sourceId: { + type: "integer", + }, + }, +} as const; + export const storedQueryDetailsSchema = { type: "object", required: [