Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ $ npm i @elimity/insights-client
| Client version | Insights version |
| -------------- | ---------------- |
| 1 | >=3.35 |
| 2 | >=3.38 |
46 changes: 27 additions & 19 deletions example/fixture.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
}
]
}
7 changes: 6 additions & 1 deletion example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
20 changes: 20 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -127,13 +144,16 @@ export async function performImport(
config: Config,
entities: AsyncIterable<Entity> | Iterable<Entity>,
relationships: AsyncIterable<Relationship> | Iterable<Relationship>,
streamItems: AsyncIterable<StreamItem> | Iterable<StreamItem>,
): Promise<void> {
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();
Expand Down
92 changes: 89 additions & 3 deletions openapi/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ export const accessReviewFormSchema = {
"columnGroups",
"createdAt",
"dueDate",
"relationshipChanges",
"relationships",
"rowGroups",
"rowQuestion",
"submitted",
"rowRemovals",
"submissionFinal",
"submittedAt",
"toolbarBackgroundColor",
"welcomeScreenHtml",
],
Expand All @@ -186,6 +189,9 @@ export const accessReviewFormSchema = {
columnGroups: {
$ref: "#/definitions/accessReviewHeaderGroups",
},
relationshipChanges: {
$ref: "#/definitions/accessReviewRelationshipChanges",
},
relationships: {
$ref: "#/definitions/accessReviewRelationships",
},
Expand All @@ -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",
},
Expand Down Expand Up @@ -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",
},
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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: [
Expand Down