@api-client/core 0.12.14 → 0.12.15
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/build/src/models/store/Invitation.d.ts +11 -0
- package/build/src/models/store/Invitation.d.ts.map +1 -1
- package/build/src/models/store/Invitation.js +9 -1
- package/build/src/models/store/Invitation.js.map +1 -1
- package/data/models/example-generator-api.json +17 -17
- package/package.json +1 -1
- package/src/models/store/Invitation.ts +19 -0
- package/tests/unit/models/store/Invitation.spec.ts +4 -0
|
@@ -79,6 +79,15 @@ export interface InvitationSchema {
|
|
|
79
79
|
* The timestamp when the invitation was last updated.
|
|
80
80
|
*/
|
|
81
81
|
updatedAt: number;
|
|
82
|
+
/**
|
|
83
|
+
* Number of times the invitation was resent to the user.
|
|
84
|
+
*/
|
|
85
|
+
resent: number;
|
|
86
|
+
/**
|
|
87
|
+
* The timestamp when the invitation was last sent.
|
|
88
|
+
* This is used to track when the invitation was last communicated to the user.
|
|
89
|
+
*/
|
|
90
|
+
lastSentAt: number;
|
|
82
91
|
}
|
|
83
92
|
/**
|
|
84
93
|
* Represents an invitation to join an organization.
|
|
@@ -101,6 +110,8 @@ export declare class Invitation implements InvitationSchema {
|
|
|
101
110
|
deletedInfo: IDeletion | undefined;
|
|
102
111
|
createdAt: number;
|
|
103
112
|
updatedAt: number;
|
|
113
|
+
resent: number;
|
|
114
|
+
lastSentAt: number;
|
|
104
115
|
/**
|
|
105
116
|
* The patch builder for this invitation.
|
|
106
117
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Invitation.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Invitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,OAAO,cAAc,CAAA;IAC3B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAA;IACxB;;OAEG;IACH,SAAS,EAAE,yBAAyB,CAAA;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Invitation.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Invitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC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IAC/B,MAAM,EAAE,gBAAgB,CAAA;IACxB,SAAS,EAAE,yBAAyB,CAAA;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,SAAS,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAIlB;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAKvC;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;gBA6DhE,KAAK,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAqB7C,MAAM,IAAI,gBAAgB;IA6B1B;;;;;;;;;OASG;IACH,QAAQ,IAAI,SAAS,EAAE;IAOvB;;;;;OAKG;IACH,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAc5B;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAOrC;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,yBAAyB,GAAG,IAAI;CAMzD"}
|
|
@@ -21,6 +21,8 @@ export class Invitation {
|
|
|
21
21
|
deletedInfo;
|
|
22
22
|
createdAt;
|
|
23
23
|
updatedAt;
|
|
24
|
+
resent;
|
|
25
|
+
lastSentAt;
|
|
24
26
|
#builder;
|
|
25
27
|
/**
|
|
26
28
|
* The patch builder for this invitation.
|
|
@@ -38,7 +40,7 @@ export class Invitation {
|
|
|
38
40
|
* @returns The invitation schema.
|
|
39
41
|
*/
|
|
40
42
|
static createSchema(input = {}) {
|
|
41
|
-
const { key = nanoid(), email, oid, grantType, uid = '', updatedAt = 0, createdAt = 0, expiresAt = 0, status = 'pending', token = '', } = input;
|
|
43
|
+
const { key = nanoid(), email, oid, grantType, uid = '', updatedAt = 0, createdAt = 0, expiresAt = 0, resent = 0, lastSentAt = 0, status = 'pending', token = '', } = input;
|
|
42
44
|
if (!email) {
|
|
43
45
|
throw new Error('Email is required to create an invitation schema.');
|
|
44
46
|
}
|
|
@@ -60,6 +62,8 @@ export class Invitation {
|
|
|
60
62
|
status,
|
|
61
63
|
createdAt,
|
|
62
64
|
updatedAt,
|
|
65
|
+
resent,
|
|
66
|
+
lastSentAt,
|
|
63
67
|
};
|
|
64
68
|
if (input.name) {
|
|
65
69
|
result.name = input.name;
|
|
@@ -99,6 +103,8 @@ export class Invitation {
|
|
|
99
103
|
this.deletedInfo = init.deletedInfo;
|
|
100
104
|
this.createdAt = init.createdAt;
|
|
101
105
|
this.updatedAt = init.updatedAt;
|
|
106
|
+
this.resent = init.resent;
|
|
107
|
+
this.lastSentAt = init.lastSentAt;
|
|
102
108
|
}
|
|
103
109
|
toJSON() {
|
|
104
110
|
const result = {
|
|
@@ -114,6 +120,8 @@ export class Invitation {
|
|
|
114
120
|
deleted: this.deleted,
|
|
115
121
|
createdAt: this.createdAt,
|
|
116
122
|
updatedAt: this.updatedAt,
|
|
123
|
+
resent: this.resent,
|
|
124
|
+
lastSentAt: this.lastSentAt,
|
|
117
125
|
};
|
|
118
126
|
if (this.name) {
|
|
119
127
|
result.name = this.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Invitation.js","sourceRoot":"","sources":["../../../../src/models/store/Invitation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAI5C,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAiF3D;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB,IAAI,CAAuB;IAC3B,GAAG,CAAQ;IACX,GAAG,CAAQ;IACX,GAAG,CAAQ;IACX,KAAK,CAAQ;IACb,IAAI,CAAoB;IACxB,KAAK,CAAQ;IACb,SAAS,CAAQ;IAC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QAAQ,EAAE,CAAC;YACnB,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAa;QACnB,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACvB,OAAM;QACR,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QAC3B,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9B,CAAC;aAAM,CAAC;YACN,mDAAmD;YACnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAiB;QAC5B,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;YAC7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC5B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,SAAoC;QAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;YAC7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import { nanoid } from 'nanoid'\nimport { InvitationKind } from '../kinds.js'\nimport type { IDeletion } from './Deletion.js'\nimport type { UserOrganizationGrantType } from './Organization.js'\nimport type { Operation } from '@api-client/json/types.js'\nimport { Builder } from '@api-client/json/patch/builder.js'\n\n/**\n * The status of an invitation.\n * - `pending`: The invitation has been sent but not yet responded to.\n * - `accepted`: The invitation has been accepted by the user.\n * - `declined`: The invitation has been declined by the user.\n */\nexport type InvitationStatus = 'pending' | 'accepted' | 'declined'\n\n/**\n * The schema for an invitation.\n * This defines the structure of an invitation object in the system.\n */\nexport interface InvitationSchema {\n /**\n * The kind of the invitation.\n */\n kind: typeof InvitationKind\n /**\n * The database ID of the invitation.\n */\n key: string\n /**\n * The user ID of the user who sent the invitation.\n */\n uid: string\n /**\n * The organization ID to which the invitation belongs.\n */\n oid: string\n /**\n * The email address of the user to whom the invitation is sent.\n */\n email: string\n /**\n * The name of the user to whom the invitation is sent.\n * This is optional and can be empty if the user is not known.\n */\n name?: string\n /**\n * The token used to respond to the invitation.\n */\n token: string\n /**\n * The timestamp when the invitation expires.\n * This is used to determine if the invitation is still valid.\n */\n expiresAt: number\n /**\n * The timestamp when the invitation was responded to.\n * This is set when the user accepts or declines the invitation.\n */\n respondedAt?: number\n /**\n * The status of the invitation.\n */\n status: InvitationStatus\n /**\n * The grant type the user will have in the organization if they accept the invitation.\n */\n grantType: UserOrganizationGrantType\n /**\n * Whether the file object is deleted.\n */\n deleted?: boolean\n /**\n * The information about the delete information.\n * Always set when the `delete` is true.\n */\n deletedInfo?: IDeletion\n /**\n * The timestamp when the invitation was created.\n */\n createdAt: number\n /**\n * The timestamp when the invitation was last updated.\n */\n updatedAt: number\n}\n\n/**\n * Represents an invitation to join an organization.\n * This class implements the `InvitationSchema` interface and provides methods to create and manipulate invitations.\n */\nexport class Invitation implements InvitationSchema {\n kind: typeof InvitationKind\n key: string\n uid: string\n oid: string\n email: string\n name: string | undefined\n token: string\n expiresAt: number\n respondedAt: number | undefined\n status: InvitationStatus\n grantType: UserOrganizationGrantType\n deleted: boolean\n deletedInfo: IDeletion | undefined\n createdAt: number\n updatedAt: number\n\n #builder?: Builder<InvitationSchema>\n\n /**\n * The patch builder for this invitation.\n */\n get builder(): Builder<InvitationSchema> {\n if (!this.#builder) {\n this.#builder = new Builder(this.toJSON())\n }\n return this.#builder\n }\n\n /**\n * Creates a full invitation schema with defaults.\n *\n * @param input The partial invitation schema.\n * @returns The invitation schema.\n */\n static createSchema(input: Partial<InvitationSchema> = {}): InvitationSchema {\n const {\n key = nanoid(),\n email,\n oid,\n grantType,\n uid = '',\n updatedAt = 0,\n createdAt = 0,\n expiresAt = 0,\n status = 'pending',\n token = '',\n } = input\n if (!email) {\n throw new Error('Email is required to create an invitation schema.')\n }\n if (!oid) {\n throw new Error('Organization ID is required to create an invitation schema.')\n }\n if (!grantType) {\n throw new Error('Grant type is required to create an invitation schema.')\n }\n const result: InvitationSchema = {\n kind: InvitationKind,\n key,\n uid,\n oid,\n email,\n grantType,\n token,\n expiresAt,\n status,\n createdAt,\n updatedAt,\n }\n if (input.name) {\n result.name = input.name\n }\n if (input.token) {\n result.token = input.token\n }\n if (input.expiresAt) {\n result.expiresAt = input.expiresAt\n }\n if (input.respondedAt) {\n result.respondedAt = input.respondedAt\n }\n if (input.status) {\n result.status = input.status\n }\n if (input.deleted) {\n result.deleted = input.deleted\n result.deletedInfo = input.deletedInfo\n }\n return result\n }\n\n constructor(input?: Partial<InvitationSchema>) {\n const init: InvitationSchema = Invitation.createSchema(input)\n this.kind = InvitationKind\n this.key = init.key\n this.uid = init.uid\n this.oid = init.oid\n this.email = init.email\n this.name = init.name\n this.token = init.token\n this.expiresAt = init.expiresAt\n this.respondedAt = init.respondedAt\n this.status = init.status\n this.grantType = init.grantType\n this.deleted = init.deleted || false\n this.deletedInfo = init.deletedInfo\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n }\n\n toJSON(): InvitationSchema {\n const result: InvitationSchema = {\n kind: this.kind,\n key: this.key,\n uid: this.uid,\n oid: this.oid,\n email: this.email,\n token: this.token,\n expiresAt: this.expiresAt,\n status: this.status,\n grantType: this.grantType,\n deleted: this.deleted,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.name) {\n result.name = this.name\n }\n if (this.respondedAt) {\n result.respondedAt = this.respondedAt\n }\n if (this.deletedInfo) {\n result.deletedInfo = { ...this.deletedInfo }\n }\n return result\n }\n\n /**\n * Retrieves the patch operations for this invitation.\n * This method builds a JSON Patch representation of the invitation,\n * which can be used to update the invitation in a database or API.\n *\n * Use one of the `set*` methods to modify the invitation before calling this method.\n *\n * @returns An array of patch operations.\n * If no changes have been made, it returns an empty array.\n */\n getPatch(): Operation[] {\n if (!this.#builder) {\n return []\n }\n return this.builder.build()\n }\n\n /**\n * Sets the name of the user to whom the invitation is sent.\n * If the name is the same as the current name, no operation is performed.\n *\n * @param name The name to set. If undefined, it will be removed.\n */\n setName(name?: string): void {\n if (name === this.name) {\n return\n }\n const hasName = !!this.name\n if (hasName && !name) {\n this.builder.remove('/name')\n } else {\n // The add method handles both adding and replacing\n this.builder.add('/name', name)\n }\n this.name = name\n }\n\n /**\n * Sets the expiration timestamp of the invitation.\n * @param expiresAt The timestamp when the invitation expires.\n * If the expiresAt is the same as the current expiresAt, no operation is performed.\n */\n setExpiresAt(expiresAt: number): void {\n if (this.expiresAt !== expiresAt) {\n this.builder.replace('/expiresAt', expiresAt)\n this.expiresAt = expiresAt\n }\n }\n\n /**\n * Sets the grant type of the user in the organization.\n */\n setGrantType(grantType: UserOrganizationGrantType): void {\n if (this.grantType !== grantType) {\n this.builder.replace('/grantType', grantType)\n this.grantType = grantType\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Invitation.js","sourceRoot":"","sources":["../../../../src/models/store/Invitation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAI5C,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AA0F3D;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB,IAAI,CAAuB;IAC3B,GAAG,CAAQ;IACX,GAAG,CAAQ;IACX,GAAG,CAAQ;IACX,KAAK,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AAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;YAC7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import { nanoid } from 'nanoid'\nimport { InvitationKind } from '../kinds.js'\nimport type { IDeletion } from './Deletion.js'\nimport type { UserOrganizationGrantType } from './Organization.js'\nimport type { Operation } from '@api-client/json/types.js'\nimport { Builder } from '@api-client/json/patch/builder.js'\n\n/**\n * The status of an invitation.\n * - `pending`: The invitation has been sent but not yet responded to.\n * - `accepted`: The invitation has been accepted by the user.\n * - `declined`: The invitation has been declined by the user.\n */\nexport type InvitationStatus = 'pending' | 'accepted' | 'declined'\n\n/**\n * The schema for an invitation.\n * This defines the structure of an invitation object in the system.\n */\nexport interface InvitationSchema {\n /**\n * The kind of the invitation.\n */\n kind: typeof InvitationKind\n /**\n * The database ID of the invitation.\n */\n key: string\n /**\n * The user ID of the user who sent the invitation.\n */\n uid: string\n /**\n * The organization ID to which the invitation belongs.\n */\n oid: string\n /**\n * The email address of the user to whom the invitation is sent.\n */\n email: string\n /**\n * The name of the user to whom the invitation is sent.\n * This is optional and can be empty if the user is not known.\n */\n name?: string\n /**\n * The token used to respond to the invitation.\n */\n token: string\n /**\n * The timestamp when the invitation expires.\n * This is used to determine if the invitation is still valid.\n */\n expiresAt: number\n /**\n * The timestamp when the invitation was responded to.\n * This is set when the user accepts or declines the invitation.\n */\n respondedAt?: number\n /**\n * The status of the invitation.\n */\n status: InvitationStatus\n /**\n * The grant type the user will have in the organization if they accept the invitation.\n */\n grantType: UserOrganizationGrantType\n /**\n * Whether the file object is deleted.\n */\n deleted?: boolean\n /**\n * The information about the delete information.\n * Always set when the `delete` is true.\n */\n deletedInfo?: IDeletion\n /**\n * The timestamp when the invitation was created.\n */\n createdAt: number\n /**\n * The timestamp when the invitation was last updated.\n */\n updatedAt: number\n /**\n * Number of times the invitation was resent to the user.\n */\n resent: number\n /**\n * The timestamp when the invitation was last sent.\n * This is used to track when the invitation was last communicated to the user.\n */\n lastSentAt: number\n}\n\n/**\n * Represents an invitation to join an organization.\n * This class implements the `InvitationSchema` interface and provides methods to create and manipulate invitations.\n */\nexport class Invitation implements InvitationSchema {\n kind: typeof InvitationKind\n key: string\n uid: string\n oid: string\n email: string\n name: string | undefined\n token: string\n expiresAt: number\n respondedAt: number | undefined\n status: InvitationStatus\n grantType: UserOrganizationGrantType\n deleted: boolean\n deletedInfo: IDeletion | undefined\n createdAt: number\n updatedAt: number\n resent: number\n lastSentAt: number\n\n #builder?: Builder<InvitationSchema>\n\n /**\n * The patch builder for this invitation.\n */\n get builder(): Builder<InvitationSchema> {\n if (!this.#builder) {\n this.#builder = new Builder(this.toJSON())\n }\n return this.#builder\n }\n\n /**\n * Creates a full invitation schema with defaults.\n *\n * @param input The partial invitation schema.\n * @returns The invitation schema.\n */\n static createSchema(input: Partial<InvitationSchema> = {}): InvitationSchema {\n const {\n key = nanoid(),\n email,\n oid,\n grantType,\n uid = '',\n updatedAt = 0,\n createdAt = 0,\n expiresAt = 0,\n resent = 0,\n lastSentAt = 0,\n status = 'pending',\n token = '',\n } = input\n if (!email) {\n throw new Error('Email is required to create an invitation schema.')\n }\n if (!oid) {\n throw new Error('Organization ID is required to create an invitation schema.')\n }\n if (!grantType) {\n throw new Error('Grant type is required to create an invitation schema.')\n }\n const result: InvitationSchema = {\n kind: InvitationKind,\n key,\n uid,\n oid,\n email,\n grantType,\n token,\n expiresAt,\n status,\n createdAt,\n updatedAt,\n resent,\n lastSentAt,\n }\n if (input.name) {\n result.name = input.name\n }\n if (input.token) {\n result.token = input.token\n }\n if (input.expiresAt) {\n result.expiresAt = input.expiresAt\n }\n if (input.respondedAt) {\n result.respondedAt = input.respondedAt\n }\n if (input.status) {\n result.status = input.status\n }\n if (input.deleted) {\n result.deleted = input.deleted\n result.deletedInfo = input.deletedInfo\n }\n return result\n }\n\n constructor(input?: Partial<InvitationSchema>) {\n const init: InvitationSchema = Invitation.createSchema(input)\n this.kind = InvitationKind\n this.key = init.key\n this.uid = init.uid\n this.oid = init.oid\n this.email = init.email\n this.name = init.name\n this.token = init.token\n this.expiresAt = init.expiresAt\n this.respondedAt = init.respondedAt\n this.status = init.status\n this.grantType = init.grantType\n this.deleted = init.deleted || false\n this.deletedInfo = init.deletedInfo\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.resent = init.resent\n this.lastSentAt = init.lastSentAt\n }\n\n toJSON(): InvitationSchema {\n const result: InvitationSchema = {\n kind: this.kind,\n key: this.key,\n uid: this.uid,\n oid: this.oid,\n email: this.email,\n token: this.token,\n expiresAt: this.expiresAt,\n status: this.status,\n grantType: this.grantType,\n deleted: this.deleted,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n resent: this.resent,\n lastSentAt: this.lastSentAt,\n }\n if (this.name) {\n result.name = this.name\n }\n if (this.respondedAt) {\n result.respondedAt = this.respondedAt\n }\n if (this.deletedInfo) {\n result.deletedInfo = { ...this.deletedInfo }\n }\n return result\n }\n\n /**\n * Retrieves the patch operations for this invitation.\n * This method builds a JSON Patch representation of the invitation,\n * which can be used to update the invitation in a database or API.\n *\n * Use one of the `set*` methods to modify the invitation before calling this method.\n *\n * @returns An array of patch operations.\n * If no changes have been made, it returns an empty array.\n */\n getPatch(): Operation[] {\n if (!this.#builder) {\n return []\n }\n return this.builder.build()\n }\n\n /**\n * Sets the name of the user to whom the invitation is sent.\n * If the name is the same as the current name, no operation is performed.\n *\n * @param name The name to set. If undefined, it will be removed.\n */\n setName(name?: string): void {\n if (name === this.name) {\n return\n }\n const hasName = !!this.name\n if (hasName && !name) {\n this.builder.remove('/name')\n } else {\n // The add method handles both adding and replacing\n this.builder.add('/name', name)\n }\n this.name = name\n }\n\n /**\n * Sets the expiration timestamp of the invitation.\n * @param expiresAt The timestamp when the invitation expires.\n * If the expiresAt is the same as the current expiresAt, no operation is performed.\n */\n setExpiresAt(expiresAt: number): void {\n if (this.expiresAt !== expiresAt) {\n this.builder.replace('/expiresAt', expiresAt)\n this.expiresAt = expiresAt\n }\n }\n\n /**\n * Sets the grant type of the user in the organization.\n */\n setGrantType(grantType: UserOrganizationGrantType): void {\n if (this.grantType !== grantType) {\n this.builder.replace('/grantType', grantType)\n this.grantType = grantType\n }\n }\n}\n"]}
|
|
@@ -41722,22 +41722,22 @@
|
|
|
41722
41722
|
"@id": "#209"
|
|
41723
41723
|
},
|
|
41724
41724
|
{
|
|
41725
|
-
"@id": "#
|
|
41725
|
+
"@id": "#194"
|
|
41726
41726
|
},
|
|
41727
41727
|
{
|
|
41728
|
-
"@id": "#
|
|
41728
|
+
"@id": "#191"
|
|
41729
41729
|
},
|
|
41730
41730
|
{
|
|
41731
|
-
"@id": "#
|
|
41731
|
+
"@id": "#197"
|
|
41732
41732
|
},
|
|
41733
41733
|
{
|
|
41734
|
-
"@id": "#
|
|
41734
|
+
"@id": "#200"
|
|
41735
41735
|
},
|
|
41736
41736
|
{
|
|
41737
|
-
"@id": "#
|
|
41737
|
+
"@id": "#203"
|
|
41738
41738
|
},
|
|
41739
41739
|
{
|
|
41740
|
-
"@id": "#
|
|
41740
|
+
"@id": "#206"
|
|
41741
41741
|
},
|
|
41742
41742
|
{
|
|
41743
41743
|
"@id": "#209"
|
|
@@ -43096,7 +43096,7 @@
|
|
|
43096
43096
|
"doc:ExternalDomainElement",
|
|
43097
43097
|
"doc:DomainElement"
|
|
43098
43098
|
],
|
|
43099
|
-
"doc:raw": "
|
|
43099
|
+
"doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
|
|
43100
43100
|
"core:mediaType": "application/yaml",
|
|
43101
43101
|
"sourcemaps:sources": [
|
|
43102
43102
|
{
|
|
@@ -43117,7 +43117,7 @@
|
|
|
43117
43117
|
"doc:ExternalDomainElement",
|
|
43118
43118
|
"doc:DomainElement"
|
|
43119
43119
|
],
|
|
43120
|
-
"doc:raw": "
|
|
43120
|
+
"doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
|
|
43121
43121
|
"core:mediaType": "application/yaml",
|
|
43122
43122
|
"sourcemaps:sources": [
|
|
43123
43123
|
{
|
|
@@ -43138,7 +43138,7 @@
|
|
|
43138
43138
|
"doc:ExternalDomainElement",
|
|
43139
43139
|
"doc:DomainElement"
|
|
43140
43140
|
],
|
|
43141
|
-
"doc:raw": "code: '
|
|
43141
|
+
"doc:raw": "code: '5'\ndescription: 'Limited company'\n",
|
|
43142
43142
|
"core:mediaType": "application/yaml",
|
|
43143
43143
|
"sourcemaps:sources": [
|
|
43144
43144
|
{
|
|
@@ -43159,7 +43159,7 @@
|
|
|
43159
43159
|
"doc:ExternalDomainElement",
|
|
43160
43160
|
"doc:DomainElement"
|
|
43161
43161
|
],
|
|
43162
|
-
"doc:raw": "
|
|
43162
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43163
43163
|
"core:mediaType": "application/yaml",
|
|
43164
43164
|
"sourcemaps:sources": [
|
|
43165
43165
|
{
|
|
@@ -43180,7 +43180,7 @@
|
|
|
43180
43180
|
"doc:ExternalDomainElement",
|
|
43181
43181
|
"doc:DomainElement"
|
|
43182
43182
|
],
|
|
43183
|
-
"doc:raw": "
|
|
43183
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43184
43184
|
"core:mediaType": "application/yaml",
|
|
43185
43185
|
"sourcemaps:sources": [
|
|
43186
43186
|
{
|
|
@@ -43201,7 +43201,7 @@
|
|
|
43201
43201
|
"doc:ExternalDomainElement",
|
|
43202
43202
|
"doc:DomainElement"
|
|
43203
43203
|
],
|
|
43204
|
-
"doc:raw": "code: '
|
|
43204
|
+
"doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
|
|
43205
43205
|
"core:mediaType": "application/yaml",
|
|
43206
43206
|
"sourcemaps:sources": [
|
|
43207
43207
|
{
|
|
@@ -44416,12 +44416,12 @@
|
|
|
44416
44416
|
{
|
|
44417
44417
|
"@id": "#193/source-map/lexical/element_0",
|
|
44418
44418
|
"sourcemaps:element": "amf://id#193",
|
|
44419
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44419
|
+
"sourcemaps:value": "[(1,0)-(10,0)]"
|
|
44420
44420
|
},
|
|
44421
44421
|
{
|
|
44422
44422
|
"@id": "#196/source-map/lexical/element_0",
|
|
44423
44423
|
"sourcemaps:element": "amf://id#196",
|
|
44424
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44424
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
44425
44425
|
},
|
|
44426
44426
|
{
|
|
44427
44427
|
"@id": "#199/source-map/lexical/element_0",
|
|
@@ -44431,17 +44431,17 @@
|
|
|
44431
44431
|
{
|
|
44432
44432
|
"@id": "#202/source-map/lexical/element_0",
|
|
44433
44433
|
"sourcemaps:element": "amf://id#202",
|
|
44434
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44434
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44435
44435
|
},
|
|
44436
44436
|
{
|
|
44437
44437
|
"@id": "#205/source-map/lexical/element_0",
|
|
44438
44438
|
"sourcemaps:element": "amf://id#205",
|
|
44439
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44439
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44440
44440
|
},
|
|
44441
44441
|
{
|
|
44442
44442
|
"@id": "#208/source-map/lexical/element_0",
|
|
44443
44443
|
"sourcemaps:element": "amf://id#208",
|
|
44444
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44444
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
44445
44445
|
},
|
|
44446
44446
|
{
|
|
44447
44447
|
"@id": "#223/source-map/lexical/element_0",
|
package/package.json
CHANGED
|
@@ -82,6 +82,15 @@ export interface InvitationSchema {
|
|
|
82
82
|
* The timestamp when the invitation was last updated.
|
|
83
83
|
*/
|
|
84
84
|
updatedAt: number
|
|
85
|
+
/**
|
|
86
|
+
* Number of times the invitation was resent to the user.
|
|
87
|
+
*/
|
|
88
|
+
resent: number
|
|
89
|
+
/**
|
|
90
|
+
* The timestamp when the invitation was last sent.
|
|
91
|
+
* This is used to track when the invitation was last communicated to the user.
|
|
92
|
+
*/
|
|
93
|
+
lastSentAt: number
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
/**
|
|
@@ -104,6 +113,8 @@ export class Invitation implements InvitationSchema {
|
|
|
104
113
|
deletedInfo: IDeletion | undefined
|
|
105
114
|
createdAt: number
|
|
106
115
|
updatedAt: number
|
|
116
|
+
resent: number
|
|
117
|
+
lastSentAt: number
|
|
107
118
|
|
|
108
119
|
#builder?: Builder<InvitationSchema>
|
|
109
120
|
|
|
@@ -133,6 +144,8 @@ export class Invitation implements InvitationSchema {
|
|
|
133
144
|
updatedAt = 0,
|
|
134
145
|
createdAt = 0,
|
|
135
146
|
expiresAt = 0,
|
|
147
|
+
resent = 0,
|
|
148
|
+
lastSentAt = 0,
|
|
136
149
|
status = 'pending',
|
|
137
150
|
token = '',
|
|
138
151
|
} = input
|
|
@@ -157,6 +170,8 @@ export class Invitation implements InvitationSchema {
|
|
|
157
170
|
status,
|
|
158
171
|
createdAt,
|
|
159
172
|
updatedAt,
|
|
173
|
+
resent,
|
|
174
|
+
lastSentAt,
|
|
160
175
|
}
|
|
161
176
|
if (input.name) {
|
|
162
177
|
result.name = input.name
|
|
@@ -197,6 +212,8 @@ export class Invitation implements InvitationSchema {
|
|
|
197
212
|
this.deletedInfo = init.deletedInfo
|
|
198
213
|
this.createdAt = init.createdAt
|
|
199
214
|
this.updatedAt = init.updatedAt
|
|
215
|
+
this.resent = init.resent
|
|
216
|
+
this.lastSentAt = init.lastSentAt
|
|
200
217
|
}
|
|
201
218
|
|
|
202
219
|
toJSON(): InvitationSchema {
|
|
@@ -213,6 +230,8 @@ export class Invitation implements InvitationSchema {
|
|
|
213
230
|
deleted: this.deleted,
|
|
214
231
|
createdAt: this.createdAt,
|
|
215
232
|
updatedAt: this.updatedAt,
|
|
233
|
+
resent: this.resent,
|
|
234
|
+
lastSentAt: this.lastSentAt,
|
|
216
235
|
}
|
|
217
236
|
if (this.name) {
|
|
218
237
|
result.name = this.name
|
|
@@ -48,6 +48,8 @@ test.group('Invitation', (group) => {
|
|
|
48
48
|
deletedInfo: { time: Date.now(), user: 'admin-user', byMe: false, name: 'Admin' },
|
|
49
49
|
createdAt: Date.now() - 7200000,
|
|
50
50
|
updatedAt: Date.now() - 3600000,
|
|
51
|
+
resent: 0,
|
|
52
|
+
lastSentAt: Date.now() - 180000,
|
|
51
53
|
}
|
|
52
54
|
const invitation = new Invitation(fullInput)
|
|
53
55
|
assert.deepEqual(invitation.toJSON(), fullInput)
|
|
@@ -89,6 +91,8 @@ test.group('Invitation', (group) => {
|
|
|
89
91
|
deletedInfo: deletionInfo,
|
|
90
92
|
createdAt: 1230000000,
|
|
91
93
|
updatedAt: 1234000000,
|
|
94
|
+
resent: 0, // default
|
|
95
|
+
lastSentAt: 0, // default
|
|
92
96
|
})
|
|
93
97
|
})
|
|
94
98
|
|