@api-client/core 0.12.6 → 0.12.9
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/amf/ApiSchemaValues.d.ts +6 -2
- package/build/src/amf/ApiSchemaValues.d.ts.map +1 -1
- package/build/src/amf/ApiSchemaValues.js +17 -12
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeBase.js +1 -1
- package/build/src/amf/shape/ShapeBase.js.map +1 -1
- package/build/src/browser.d.ts +2 -1
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +2 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +2 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -1
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/LegacyInterfaces.d.ts +1 -1
- package/build/src/mocking/LegacyInterfaces.d.ts.map +1 -1
- package/build/src/mocking/LegacyInterfaces.js.map +1 -1
- package/build/src/mocking/LegacyMock.d.ts +1 -1
- package/build/src/mocking/LegacyMock.d.ts.map +1 -1
- package/build/src/mocking/LegacyMock.js +1 -1
- package/build/src/mocking/LegacyMock.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +2 -1
- package/build/src/mocking/ProjectMock.d.ts.map +1 -1
- package/build/src/mocking/ProjectMock.js +1 -1
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/legacy/Authorization.d.ts +2 -1
- package/build/src/mocking/legacy/Authorization.d.ts.map +1 -1
- package/build/src/mocking/legacy/Authorization.js +2 -1
- package/build/src/mocking/legacy/Authorization.js.map +1 -1
- package/build/src/mocking/legacy/Certificates.d.ts +3 -1
- package/build/src/mocking/legacy/Certificates.d.ts.map +1 -1
- package/build/src/mocking/legacy/Certificates.js +6 -3
- package/build/src/mocking/legacy/Certificates.js.map +1 -1
- package/build/src/mocking/legacy/Cookies.d.ts +3 -1
- package/build/src/mocking/legacy/Cookies.d.ts.map +1 -1
- package/build/src/mocking/legacy/Cookies.js +3 -1
- package/build/src/mocking/legacy/Cookies.js.map +1 -1
- package/build/src/mocking/legacy/HostRules.d.ts +3 -1
- package/build/src/mocking/legacy/HostRules.d.ts.map +1 -1
- package/build/src/mocking/legacy/HostRules.js +3 -1
- package/build/src/mocking/legacy/HostRules.js.map +1 -1
- package/build/src/mocking/legacy/Http.d.ts +6 -1
- package/build/src/mocking/legacy/Http.d.ts.map +1 -1
- package/build/src/mocking/legacy/Http.js +5 -1
- package/build/src/mocking/legacy/Http.js.map +1 -1
- package/build/src/mocking/legacy/HttpResponse.d.ts +3 -2
- package/build/src/mocking/legacy/HttpResponse.d.ts.map +1 -1
- package/build/src/mocking/legacy/HttpResponse.js +2 -2
- package/build/src/mocking/legacy/HttpResponse.js.map +1 -1
- package/build/src/mocking/legacy/RestApi.d.ts +3 -1
- package/build/src/mocking/legacy/RestApi.d.ts.map +1 -1
- package/build/src/mocking/legacy/RestApi.js +3 -1
- package/build/src/mocking/legacy/RestApi.js.map +1 -1
- package/build/src/mocking/legacy/Urls.d.ts +3 -1
- package/build/src/mocking/legacy/Urls.d.ts.map +1 -1
- package/build/src/mocking/legacy/Urls.js +3 -1
- package/build/src/mocking/legacy/Urls.js.map +1 -1
- package/build/src/mocking/legacy/Variables.d.ts +2 -1
- package/build/src/mocking/legacy/Variables.d.ts.map +1 -1
- package/build/src/mocking/legacy/Variables.js +2 -1
- package/build/src/mocking/legacy/Variables.js.map +1 -1
- package/build/src/mocking/lib/Certificates.d.ts +4 -1
- package/build/src/mocking/lib/Certificates.d.ts.map +1 -1
- package/build/src/mocking/lib/Certificates.js +5 -2
- package/build/src/mocking/lib/Certificates.js.map +1 -1
- package/build/src/mocking/lib/History.d.ts +5 -1
- package/build/src/mocking/lib/History.d.ts.map +1 -1
- package/build/src/mocking/lib/History.js +4 -1
- package/build/src/mocking/lib/History.js.map +1 -1
- package/build/src/mocking/lib/HostRules.d.ts +4 -1
- package/build/src/mocking/lib/HostRules.d.ts.map +1 -1
- package/build/src/mocking/lib/HostRules.js +3 -1
- package/build/src/mocking/lib/HostRules.js.map +1 -1
- package/build/src/mocking/lib/Request.d.ts +5 -1
- package/build/src/mocking/lib/Request.d.ts.map +1 -1
- package/build/src/mocking/lib/Request.js +4 -1
- package/build/src/mocking/lib/Request.js.map +1 -1
- package/build/src/mocking/lib/Response.d.ts +7 -1
- package/build/src/mocking/lib/Response.d.ts.map +1 -1
- package/build/src/mocking/lib/Response.js +6 -1
- package/build/src/mocking/lib/Response.js.map +1 -1
- package/build/src/mocking/lib/Url.d.ts +4 -1
- package/build/src/mocking/lib/Url.d.ts.map +1 -1
- package/build/src/mocking/lib/Url.js +3 -1
- package/build/src/mocking/lib/Url.js.map +1 -1
- package/build/src/mocking/lib/User.d.ts +5 -1
- package/build/src/mocking/lib/User.d.ts.map +1 -1
- package/build/src/mocking/lib/User.js +4 -1
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/models/kinds.d.ts +2 -0
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +2 -0
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/Invitation.d.ts +146 -0
- package/build/src/models/store/Invitation.d.ts.map +1 -0
- package/build/src/models/store/Invitation.js +186 -0
- package/build/src/models/store/Invitation.js.map +1 -0
- package/build/src/models/store/Organization.d.ts +4 -4
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js +9 -9
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/runtime/store/HttpWeb.js +5 -5
- package/build/src/runtime/store/HttpWeb.js.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.d.ts +58 -2
- package/build/src/runtime/store/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.js +215 -4
- package/build/src/runtime/store/OrganizationsSdk.js.map +1 -1
- package/build/src/runtime/store/RouteBuilder.d.ts +7 -2
- package/build/src/runtime/store/RouteBuilder.d.ts.map +1 -1
- package/build/src/runtime/store/RouteBuilder.js +21 -6
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +1 -1
- package/build/src/runtime/store/Sdk.d.ts.map +1 -1
- package/build/src/runtime/store/Sdk.js +1 -1
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.d.ts +2 -2
- package/build/src/runtime/store/SdkBase.d.ts.map +1 -1
- package/build/src/runtime/store/SdkBase.js +2 -2
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/data/models/example-generator-api.json +8 -8
- package/eslint.config.js +6 -5
- package/package.json +24 -6
- package/src/amf/ApiSchemaValues.ts +18 -13
- package/src/amf/shape/ShapeBase.ts +1 -1
- package/src/mocking/LegacyInterfaces.ts +1 -1
- package/src/mocking/LegacyMock.ts +1 -1
- package/src/mocking/ProjectMock.ts +2 -1
- package/src/mocking/legacy/Authorization.ts +2 -1
- package/src/mocking/legacy/Certificates.ts +6 -3
- package/src/mocking/legacy/Cookies.ts +3 -1
- package/src/mocking/legacy/HostRules.ts +3 -1
- package/src/mocking/legacy/Http.ts +6 -1
- package/src/mocking/legacy/HttpResponse.ts +3 -7
- package/src/mocking/legacy/RestApi.ts +3 -1
- package/src/mocking/legacy/Urls.ts +3 -1
- package/src/mocking/legacy/Variables.ts +2 -1
- package/src/mocking/lib/Certificates.ts +6 -2
- package/src/mocking/lib/History.ts +5 -1
- package/src/mocking/lib/HostRules.ts +4 -1
- package/src/mocking/lib/Request.ts +5 -1
- package/src/mocking/lib/Response.ts +7 -12
- package/src/mocking/lib/Url.ts +4 -1
- package/src/mocking/lib/User.ts +5 -1
- package/src/models/kinds.ts +2 -0
- package/src/models/store/Invitation.ts +287 -0
- package/src/models/store/Organization.ts +11 -12
- package/src/runtime/store/HttpWeb.ts +5 -5
- package/src/runtime/store/OrganizationsSdk.ts +225 -6
- package/src/runtime/store/RouteBuilder.ts +28 -8
- package/src/runtime/store/Sdk.ts +1 -1
- package/src/runtime/store/SdkBase.ts +2 -2
- package/tests/servers/express-routes/StreamApi.ts +6 -4
- package/tests/unit/models/store/Invitation.spec.ts +223 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAA;AAChD,OAAO,IAAI,MAAM,6BAA6B,CAAA;AAC9C,OAAO,EAAiB,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAG1E,OAAO,EAAqB,IAAI,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAElG,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAatE,MAAM,OAAO,QAAQ;IACnB,KAAK,CAAO;IACZ,KAAK,CAAO;IACZ,IAAI,CAAM;IACV,IAAI,CAAM;IACV,GAAG,CAAK;IACR,QAAQ,CAAU;IAElB,YAAY,OAAsB,EAAE;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GA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D,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAsB,EAAE;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAA;QACnD,MAAM,IAAI,GAAsB;YAC9B,IAAI,EAAE,oBAAoB;YAC1B,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,GAAG;YACZ,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACxB,QAAQ,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;SAC/D,CAAA;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,EAAE,IAAoB;QAC5C,MAAM,MAAM,GAAiC,EAAE,CAAA;QAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;QAClC,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;CACF","sourcesContent":["import type { IDataMockInit, IHttpResponseInit, IHarTimingInit, IHttpPayloadInit } from '@pawel-up/data-mock/types.js'\nimport { Types } from '@pawel-up/data-mock/Types.js'\nimport { Time } from '@pawel-up/data-mock/Time.js'\nimport { Lorem } from '@pawel-up/data-mock/Lorem.js'\nimport { Internet } from '@pawel-up/data-mock/Internet.js'\nimport { Har } from '@pawel-up/data-mock/Har.js'\nimport Http from '@pawel-up/data-mock/Http.js'\nimport { IHttpResponse, HttpResponse } from '../../models/HttpResponse.js'\nimport { IResponse } from '../../models/Response.js'\nimport { IRequestsSize } from '../../models/RequestsSize.js'\nimport { IResponseRedirect, Kind as ResponseRedirectKind } from '../../models/ResponseRedirect.js'\nimport { DeserializedPayload } from '../../lib/transformers/PayloadSerializer.js'\nimport { HttpResponseKind, ResponseKind } from '../../models/kinds.js'\n\nexport interface IResponseInit extends IHttpResponseInit, IHarTimingInit {\n /**\n * The first number of the status group. Other 2 are auto generated\n */\n statusGroup?: number\n /**\n * Whether to generate timings object\n */\n timings?: boolean\n}\n\nexport class Response {\n types: Types\n lorem: Lorem\n time: Time\n http: Http\n har: Har\n internet: Internet\n\n constructor(init: IDataMockInit = {}) {\n this.types = new Types(init.seed)\n this.lorem = new Lorem(init)\n this.time = new Time(init)\n this.http = new Http(init)\n this.har = new Har(init)\n this.internet = new Internet(init)\n }\n\n protected _getPayload(mime?: string): DeserializedPayload {\n if (!mime) {\n return undefined\n }\n switch (mime) {\n case 'multipart/form-data':\n return this.http.formData.form()\n default:\n return this.http.payload.payload(mime as string)\n }\n }\n\n async httpResponse(init: IResponseInit = {}): Promise<IHttpResponse> {\n const mime = this.http.headers.contentType(init.payload as IHttpPayloadInit)\n const body = this._getPayload(mime)\n const headers = this.http.headers.headers('response', { mime: mime })\n const statusGroup = init.statusGroup ? init.statusGroup : this.types.number({ min: 2, max: 5 })\n const sCode = this.types.number({ min: 0, max: 99 }).toString()\n const code = Number(`${statusGroup}${sCode.padStart(2, '0')}`)\n const status = this.lorem.word()\n const result: IHttpResponse = {\n kind: HttpResponseKind,\n status: code,\n statusText: status,\n headers,\n }\n const response = new HttpResponse(result)\n if (body) {\n await response.writePayload(body)\n }\n return response.toJSON()\n }\n\n async response(init: IResponseInit = {}): Promise<IResponse> {\n const base = await this.httpResponse(init)\n const length = this.types.number({ min: 10, max: 4000 })\n const result: IResponse = {\n ...base,\n kind: ResponseKind,\n loadingTime: length,\n }\n if (init.timings) {\n result.timings = this.har.timing(init)\n }\n return result\n }\n\n size(): IRequestsSize {\n const result: IRequestsSize = {\n request: this.types.number({ min: 10 }),\n response: this.types.number({ min: 10 }),\n }\n return result\n }\n\n async redirect(init: IResponseInit = {}): Promise<IResponseRedirect> {\n const start = this.time.timestamp()\n const end = this.time.timestamp({ min: start + 1 })\n const info: IResponseRedirect = {\n kind: ResponseRedirectKind,\n startTime: start,\n endTime: end,\n url: this.internet.uri(),\n response: await this.httpResponse({ ...init, statusGroup: 3 }),\n }\n if (init.timings) {\n info.timings = this.har.timing(init)\n }\n return info\n }\n\n async redirects(size = 1, init?: IResponseInit): Promise<IResponseRedirect[]> {\n const result: Promise<IResponseRedirect>[] = []\n for (let i = 0; i < size; i++) {\n result.push(this.redirect(init))\n }\n return Promise.all(result)\n }\n}\n"]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js';
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js';
|
|
3
|
+
import { Time } from '@pawel-up/data-mock/Time.js';
|
|
4
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js';
|
|
2
5
|
import { IUrl } from '../../models/Url.js';
|
|
3
6
|
export declare class Url {
|
|
4
7
|
types: Types;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Url.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/Url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Url.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/Url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE1C,qBAAa,GAAG;IACd,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,IAAI,CAAA;gBAEE,IAAI,GAAE,aAAkB;IAMpC;;OAEG;IACH,GAAG,IAAI,IAAI;IAYX;;;;OAIG;IACH,IAAI,CAAC,IAAI,SAAK,GAAG,IAAI,EAAE;CAOxB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Types } from '@pawel-up/data-mock/Types.js';
|
|
2
|
+
import { Time } from '@pawel-up/data-mock/Time.js';
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js';
|
|
2
4
|
export class Url {
|
|
3
5
|
types;
|
|
4
6
|
internet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Url.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Url.js","sourceRoot":"","sources":["../../../../src/mocking/lib/Url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAG1D,MAAM,OAAO,GAAG;IACd,KAAK,CAAO;IACZ,QAAQ,CAAU;IAClB,IAAI,CAAM;IAEV,YAAY,OAAsB,EAAE;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,GAAG;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAA;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAA;QAC5C,MAAM,MAAM,GAAS;YACnB,IAAI;YACJ,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAC/C,GAAG,EAAE,GAAG;YACR,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;SACnC,CAAA;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,IAAI,GAAG,EAAE;QACZ,MAAM,MAAM,GAAW,EAAE,CAAA;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;QACzB,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { IDataMockInit } from '@pawel-up/data-mock/types.js'\nimport { Types } from '@pawel-up/data-mock/Types.js'\nimport { Time } from '@pawel-up/data-mock/Time.js'\nimport { Internet } from '@pawel-up/data-mock/Internet.js'\nimport { IUrl } from '../../models/Url.js'\n\nexport class Url {\n types: Types\n internet: Internet\n time: Time\n\n constructor(init: IDataMockInit = {}) {\n this.types = new Types(init.seed)\n this.internet = new Internet(init)\n this.time = new Time(init)\n }\n\n /**\n * Generates a single ARC URL model item.\n */\n url(): IUrl {\n const url = this.internet.uri()\n const time = this.types.datetime().getTime()\n const result: IUrl = {\n time,\n cnt: this.types.number({ min: 100, max: 1000 }),\n key: url,\n midnight: this.time.midnight(time),\n }\n return result\n }\n\n /**\n * Generates list of ARC URL models.\n *\n * @returns List of datastore entries.\n */\n urls(size = 25): IUrl[] {\n const result: IUrl[] = []\n for (let i = 0; i < size; i++) {\n result.push(this.url())\n }\n return result\n }\n}\n"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js';
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js';
|
|
3
|
+
import { Person } from '@pawel-up/data-mock/Person.js';
|
|
4
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js';
|
|
5
|
+
import { Random } from '@pawel-up/data-mock/Random.js';
|
|
2
6
|
import { IUser } from '../../models/store/User.js';
|
|
3
7
|
export interface IUserInit {
|
|
4
8
|
noEmail?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../../src/mocking/lib/User.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAoB,MAAM,4BAA4B,CAAA;AAEpE,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,qBAAa,IAAI;IACf,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;gBAEF,IAAI,GAAE,aAAkB;IAOpC,IAAI,CAAC,IAAI,GAAE,SAAc,GAAG,KAAK;CA0BlC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Types } from '@pawel-up/data-mock/Types.js';
|
|
2
|
+
import { Person } from '@pawel-up/data-mock/Person.js';
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js';
|
|
4
|
+
import { Random } from '@pawel-up/data-mock/Random.js';
|
|
2
5
|
import { Kind as UserKind } from '../../models/store/User.js';
|
|
3
6
|
export class User {
|
|
4
7
|
person;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../../src/mocking/lib/User.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../../src/mocking/lib/User.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAS,IAAI,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAQpE,MAAM,OAAO,IAAI;IACf,MAAM,CAAQ;IACd,KAAK,CAAO;IACZ,QAAQ,CAAU;IAClB,MAAM,CAAQ;IAEd,YAAY,OAAsB,EAAE;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,CAAC,OAAkB,EAAE;QACvB,MAAM,MAAM,GAAU;YACpB,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;SACzB,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,CAAC,KAAK,GAAG;gBACb;oBACE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;oBAC5B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;iBAC/B;aACF,CAAA;QACH,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,GAAG;gBACf,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;aAC5B,CAAA;QACH,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,GAAG;gBAChB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;aACpC,CAAA;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { IDataMockInit } from '@pawel-up/data-mock/types.js'\nimport { Types } from '@pawel-up/data-mock/Types.js'\nimport { Person } from '@pawel-up/data-mock/Person.js'\nimport { Internet } from '@pawel-up/data-mock/Internet.js'\nimport { Random } from '@pawel-up/data-mock/Random.js'\nimport { IUser, Kind as UserKind } from '../../models/store/User.js'\n\nexport interface IUserInit {\n noEmail?: boolean\n noPicture?: boolean\n noProvider?: boolean\n}\n\nexport class User {\n person: Person\n types: Types\n internet: Internet\n random: Random\n\n constructor(init: IDataMockInit = {}) {\n this.person = new Person(init)\n this.types = new Types(init.seed)\n this.internet = new Internet(init)\n this.random = new Random(init.seed)\n }\n\n user(init: IUserInit = {}): IUser {\n const result: IUser = {\n kind: UserKind,\n key: this.types.string(21),\n name: this.person.name(),\n }\n if (!init.noEmail) {\n result.email = [\n {\n email: this.internet.email(),\n verified: this.types.boolean(),\n },\n ]\n }\n if (!init.noPicture) {\n result.picture = {\n url: this.internet.avatar(),\n }\n }\n if (!init.noProvider) {\n result.provider = {\n refreshToken: this.types.string(21),\n }\n }\n return result\n }\n}\n"]}
|
|
@@ -18,6 +18,8 @@ export declare const DomainAssociationKind = "Domain#Association";
|
|
|
18
18
|
export declare const DomainPropertyKind = "Domain#Property";
|
|
19
19
|
export declare const DataCatalogKind = "Core#DataCatalog";
|
|
20
20
|
export declare const DataCatalogVersionKind = "Core#DataCatalogVersion";
|
|
21
|
+
export declare const OrganizationKind = "Core#Organization";
|
|
22
|
+
export declare const InvitationKind = "Core#Invitation";
|
|
21
23
|
/**
|
|
22
24
|
* @deprecated Not used anymore.
|
|
23
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/models/kinds.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AACrD,eAAO,MAAM,YAAY,sBAAsB,CAAA;AAC/C,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AACnD,eAAO,MAAM,mBAAmB,yBAAyB,CAAA;AACzD,eAAO,MAAM,UAAU,gBAAgB,CAAA;AACvC,eAAO,MAAM,WAAW,iBAAiB,CAAA;AACzC,eAAO,MAAM,SAAS,eAAe,CAAA;AACrC,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAC3C,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAC3C,eAAO,MAAM,wBAAwB,8BAA8B,CAAA;AACnE,eAAO,MAAM,QAAQ,cAAc,CAAA;AACnC,eAAO,MAAM,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C/D,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AACnD,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAC3C;;GAEG;AACH,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AACrD;;GAEG;AACH,eAAO,MAAM,aAAa,mBAAmB,CAAA;AAC7C;;GAEG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAC/C;;GAEG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAA;AACzD;;GAEG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAA"}
|
|
@@ -18,6 +18,8 @@ export const DomainAssociationKind = 'Domain#Association';
|
|
|
18
18
|
export const DomainPropertyKind = 'Domain#Property';
|
|
19
19
|
export const DataCatalogKind = 'Core#DataCatalog';
|
|
20
20
|
export const DataCatalogVersionKind = 'Core#DataCatalogVersion';
|
|
21
|
+
export const OrganizationKind = 'Core#Organization';
|
|
22
|
+
export const InvitationKind = 'Core#Invitation';
|
|
21
23
|
/**
|
|
22
24
|
* @deprecated Not used anymore.
|
|
23
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../src/models/kinds.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAA;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAA;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAA;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAA;AAC3C,MAAM,CAAC,M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AAA;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAA;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAA;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAA;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AACnD,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAA;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAA;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAA;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAA;AAC3C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AACrD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAA;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAC/C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;AACzD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAA","sourcesContent":["export const ProjectFolderKind = 'Core#ProjectFolder'\nexport const ResponseKind = 'Core#HttpResponse'\nexport const HttpResponseKind = 'Core#HttpResponse'\nexport const CertificateFileKind = 'Core#CertificateFile'\nexport const FolderKind = 'Core#Folder'\nexport const ProjectKind = 'Core#Project'\nexport const ThingKind = 'Core#Thing'\nexport const DeletionKind = 'Core#Deletion'\nexport const RevisionKind = 'Core#Revision'\nexport const UnresolvedDependencyKind = 'Core#UnresolvedDependency'\nexport const UserKind = 'Core#User'\nexport const DomainFileKind = 'Data#DomainFile'\nexport const DataDomainKind = 'Data#Domain'\nexport const DomainNamespaceKind = 'Domain#Namespace'\nexport const DomainModelKind = 'Domain#Model'\nexport const DomainEntityKind = 'Domain#Entity'\nexport const DomainAssociationKind = 'Domain#Association'\nexport const DomainPropertyKind = 'Domain#Property'\nexport const DataCatalogKind = 'Core#DataCatalog'\nexport const DataCatalogVersionKind = 'Core#DataCatalogVersion'\nexport const OrganizationKind = 'Core#Organization'\nexport const InvitationKind = 'Core#Invitation'\n\n/**\n * @deprecated Not used anymore.\n */\nexport const DataFileKind = 'Core#DataFile'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataNamespaceKind = 'Data#DataNamespace'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataModelKind = 'Data#DataModel'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataEntityKind = 'Data#DataEntity'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataAssociationKind = 'Data#DataAssociation'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataPropertyKind = 'Data#DataProperty'\n"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { InvitationKind } from '../kinds.js';
|
|
2
|
+
import type { IDeletion } from './Deletion.js';
|
|
3
|
+
import type { UserOrganizationGrantType } from './Organization.js';
|
|
4
|
+
import type { Operation } from '@api-client/json/types.js';
|
|
5
|
+
import { Builder } from '@api-client/json/patch/builder.js';
|
|
6
|
+
/**
|
|
7
|
+
* The status of an invitation.
|
|
8
|
+
* - `pending`: The invitation has been sent but not yet responded to.
|
|
9
|
+
* - `accepted`: The invitation has been accepted by the user.
|
|
10
|
+
* - `declined`: The invitation has been declined by the user.
|
|
11
|
+
*/
|
|
12
|
+
export type InvitationStatus = 'pending' | 'accepted' | 'declined';
|
|
13
|
+
/**
|
|
14
|
+
* The schema for an invitation.
|
|
15
|
+
* This defines the structure of an invitation object in the system.
|
|
16
|
+
*/
|
|
17
|
+
export interface InvitationSchema {
|
|
18
|
+
/**
|
|
19
|
+
* The kind of the invitation.
|
|
20
|
+
*/
|
|
21
|
+
kind: typeof InvitationKind;
|
|
22
|
+
/**
|
|
23
|
+
* The database ID of the invitation.
|
|
24
|
+
*/
|
|
25
|
+
key: string;
|
|
26
|
+
/**
|
|
27
|
+
* The user ID of the user who sent the invitation.
|
|
28
|
+
*/
|
|
29
|
+
uid: string;
|
|
30
|
+
/**
|
|
31
|
+
* The organization ID to which the invitation belongs.
|
|
32
|
+
*/
|
|
33
|
+
oid: string;
|
|
34
|
+
/**
|
|
35
|
+
* The email address of the user to whom the invitation is sent.
|
|
36
|
+
*/
|
|
37
|
+
email: string;
|
|
38
|
+
/**
|
|
39
|
+
* The name of the user to whom the invitation is sent.
|
|
40
|
+
* This is optional and can be empty if the user is not known.
|
|
41
|
+
*/
|
|
42
|
+
name?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The token used to respond to the invitation.
|
|
45
|
+
*/
|
|
46
|
+
token: string;
|
|
47
|
+
/**
|
|
48
|
+
* The timestamp when the invitation expires.
|
|
49
|
+
* This is used to determine if the invitation is still valid.
|
|
50
|
+
*/
|
|
51
|
+
expiresAt: number;
|
|
52
|
+
/**
|
|
53
|
+
* The timestamp when the invitation was responded to.
|
|
54
|
+
* This is set when the user accepts or declines the invitation.
|
|
55
|
+
*/
|
|
56
|
+
respondedAt?: number;
|
|
57
|
+
/**
|
|
58
|
+
* The status of the invitation.
|
|
59
|
+
*/
|
|
60
|
+
status: InvitationStatus;
|
|
61
|
+
/**
|
|
62
|
+
* The grant type the user will have in the organization if they accept the invitation.
|
|
63
|
+
*/
|
|
64
|
+
grantType: UserOrganizationGrantType;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the file object is deleted.
|
|
67
|
+
*/
|
|
68
|
+
deleted?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The information about the delete information.
|
|
71
|
+
* Always set when the `delete` is true.
|
|
72
|
+
*/
|
|
73
|
+
deletedInfo?: IDeletion;
|
|
74
|
+
/**
|
|
75
|
+
* The timestamp when the invitation was created.
|
|
76
|
+
*/
|
|
77
|
+
createdAt: number;
|
|
78
|
+
/**
|
|
79
|
+
* The timestamp when the invitation was last updated.
|
|
80
|
+
*/
|
|
81
|
+
updatedAt: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Represents an invitation to join an organization.
|
|
85
|
+
* This class implements the `InvitationSchema` interface and provides methods to create and manipulate invitations.
|
|
86
|
+
*/
|
|
87
|
+
export declare class Invitation implements InvitationSchema {
|
|
88
|
+
#private;
|
|
89
|
+
kind: typeof InvitationKind;
|
|
90
|
+
key: string;
|
|
91
|
+
uid: string;
|
|
92
|
+
oid: string;
|
|
93
|
+
email: string;
|
|
94
|
+
name: string | undefined;
|
|
95
|
+
token: string;
|
|
96
|
+
expiresAt: number;
|
|
97
|
+
respondedAt: number | undefined;
|
|
98
|
+
status: InvitationStatus;
|
|
99
|
+
grantType: UserOrganizationGrantType;
|
|
100
|
+
deleted: boolean;
|
|
101
|
+
deletedInfo: IDeletion | undefined;
|
|
102
|
+
createdAt: number;
|
|
103
|
+
updatedAt: number;
|
|
104
|
+
/**
|
|
105
|
+
* The patch builder for this invitation.
|
|
106
|
+
*/
|
|
107
|
+
get builder(): Builder<InvitationSchema>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a full invitation schema with defaults.
|
|
110
|
+
*
|
|
111
|
+
* @param input The partial invitation schema.
|
|
112
|
+
* @returns The invitation schema.
|
|
113
|
+
*/
|
|
114
|
+
static createSchema(input?: Partial<InvitationSchema>): InvitationSchema;
|
|
115
|
+
constructor(input?: Partial<InvitationSchema>);
|
|
116
|
+
toJSON(): InvitationSchema;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves the patch operations for this invitation.
|
|
119
|
+
* This method builds a JSON Patch representation of the invitation,
|
|
120
|
+
* which can be used to update the invitation in a database or API.
|
|
121
|
+
*
|
|
122
|
+
* Use one of the `set*` methods to modify the invitation before calling this method.
|
|
123
|
+
*
|
|
124
|
+
* @returns An array of patch operations.
|
|
125
|
+
* If no changes have been made, it returns an empty array.
|
|
126
|
+
*/
|
|
127
|
+
getPatch(): Operation[];
|
|
128
|
+
/**
|
|
129
|
+
* Sets the name of the user to whom the invitation is sent.
|
|
130
|
+
* If the name is the same as the current name, no operation is performed.
|
|
131
|
+
*
|
|
132
|
+
* @param name The name to set. If undefined, it will be removed.
|
|
133
|
+
*/
|
|
134
|
+
setName(name?: string): void;
|
|
135
|
+
/**
|
|
136
|
+
* Sets the expiration timestamp of the invitation.
|
|
137
|
+
* @param expiresAt The timestamp when the invitation expires.
|
|
138
|
+
* If the expiresAt is the same as the current expiresAt, no operation is performed.
|
|
139
|
+
*/
|
|
140
|
+
setExpiresAt(expiresAt: number): void;
|
|
141
|
+
/**
|
|
142
|
+
* Sets the grant type of the user in the organization.
|
|
143
|
+
*/
|
|
144
|
+
setGrantType(grantType: UserOrganizationGrantType): void;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=Invitation.d.ts.map
|
|
@@ -0,0 +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;;OA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;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;gBAyDhE,KAAK,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAmB7C,MAAM,IAAI,gBAAgB;IA2B1B;;;;;;;;;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"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid';
|
|
2
|
+
import { InvitationKind } from '../kinds.js';
|
|
3
|
+
import { Builder } from '@api-client/json/patch/builder.js';
|
|
4
|
+
/**
|
|
5
|
+
* Represents an invitation to join an organization.
|
|
6
|
+
* This class implements the `InvitationSchema` interface and provides methods to create and manipulate invitations.
|
|
7
|
+
*/
|
|
8
|
+
export class Invitation {
|
|
9
|
+
kind;
|
|
10
|
+
key;
|
|
11
|
+
uid;
|
|
12
|
+
oid;
|
|
13
|
+
email;
|
|
14
|
+
name;
|
|
15
|
+
token;
|
|
16
|
+
expiresAt;
|
|
17
|
+
respondedAt;
|
|
18
|
+
status;
|
|
19
|
+
grantType;
|
|
20
|
+
deleted;
|
|
21
|
+
deletedInfo;
|
|
22
|
+
createdAt;
|
|
23
|
+
updatedAt;
|
|
24
|
+
#builder;
|
|
25
|
+
/**
|
|
26
|
+
* The patch builder for this invitation.
|
|
27
|
+
*/
|
|
28
|
+
get builder() {
|
|
29
|
+
if (!this.#builder) {
|
|
30
|
+
this.#builder = new Builder(this.toJSON());
|
|
31
|
+
}
|
|
32
|
+
return this.#builder;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a full invitation schema with defaults.
|
|
36
|
+
*
|
|
37
|
+
* @param input The partial invitation schema.
|
|
38
|
+
* @returns The invitation schema.
|
|
39
|
+
*/
|
|
40
|
+
static createSchema(input = {}) {
|
|
41
|
+
const { key = nanoid(), email, oid, grantType, uid = '', updatedAt = 0, createdAt = 0, expiresAt = 0, status = 'pending', token = '', } = input;
|
|
42
|
+
if (!email) {
|
|
43
|
+
throw new Error('Email is required to create an invitation schema.');
|
|
44
|
+
}
|
|
45
|
+
if (!oid) {
|
|
46
|
+
throw new Error('Organization ID is required to create an invitation schema.');
|
|
47
|
+
}
|
|
48
|
+
if (!grantType) {
|
|
49
|
+
throw new Error('Grant type is required to create an invitation schema.');
|
|
50
|
+
}
|
|
51
|
+
const result = {
|
|
52
|
+
kind: InvitationKind,
|
|
53
|
+
key,
|
|
54
|
+
uid,
|
|
55
|
+
oid,
|
|
56
|
+
email,
|
|
57
|
+
grantType,
|
|
58
|
+
token,
|
|
59
|
+
expiresAt,
|
|
60
|
+
status,
|
|
61
|
+
createdAt,
|
|
62
|
+
updatedAt,
|
|
63
|
+
};
|
|
64
|
+
if (input.name) {
|
|
65
|
+
result.name = input.name;
|
|
66
|
+
}
|
|
67
|
+
if (input.token) {
|
|
68
|
+
result.token = input.token;
|
|
69
|
+
}
|
|
70
|
+
if (input.expiresAt) {
|
|
71
|
+
result.expiresAt = input.expiresAt;
|
|
72
|
+
}
|
|
73
|
+
if (input.respondedAt) {
|
|
74
|
+
result.respondedAt = input.respondedAt;
|
|
75
|
+
}
|
|
76
|
+
if (input.status) {
|
|
77
|
+
result.status = input.status;
|
|
78
|
+
}
|
|
79
|
+
if (input.deleted) {
|
|
80
|
+
result.deleted = input.deleted;
|
|
81
|
+
result.deletedInfo = input.deletedInfo;
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
constructor(input) {
|
|
86
|
+
const init = Invitation.createSchema(input);
|
|
87
|
+
this.kind = InvitationKind;
|
|
88
|
+
this.key = init.key;
|
|
89
|
+
this.uid = init.uid;
|
|
90
|
+
this.oid = init.oid;
|
|
91
|
+
this.email = init.email;
|
|
92
|
+
this.name = init.name;
|
|
93
|
+
this.token = init.token;
|
|
94
|
+
this.expiresAt = init.expiresAt;
|
|
95
|
+
this.respondedAt = init.respondedAt;
|
|
96
|
+
this.status = init.status;
|
|
97
|
+
this.grantType = init.grantType;
|
|
98
|
+
this.deleted = init.deleted || false;
|
|
99
|
+
this.deletedInfo = init.deletedInfo;
|
|
100
|
+
this.createdAt = init.createdAt;
|
|
101
|
+
this.updatedAt = init.updatedAt;
|
|
102
|
+
}
|
|
103
|
+
toJSON() {
|
|
104
|
+
const result = {
|
|
105
|
+
kind: this.kind,
|
|
106
|
+
key: this.key,
|
|
107
|
+
uid: this.uid,
|
|
108
|
+
oid: this.oid,
|
|
109
|
+
email: this.email,
|
|
110
|
+
token: this.token,
|
|
111
|
+
expiresAt: this.expiresAt,
|
|
112
|
+
status: this.status,
|
|
113
|
+
grantType: this.grantType,
|
|
114
|
+
deleted: this.deleted,
|
|
115
|
+
createdAt: this.createdAt,
|
|
116
|
+
updatedAt: this.updatedAt,
|
|
117
|
+
};
|
|
118
|
+
if (this.name) {
|
|
119
|
+
result.name = this.name;
|
|
120
|
+
}
|
|
121
|
+
if (this.respondedAt) {
|
|
122
|
+
result.respondedAt = this.respondedAt;
|
|
123
|
+
}
|
|
124
|
+
if (this.deletedInfo) {
|
|
125
|
+
result.deletedInfo = { ...this.deletedInfo };
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the patch operations for this invitation.
|
|
131
|
+
* This method builds a JSON Patch representation of the invitation,
|
|
132
|
+
* which can be used to update the invitation in a database or API.
|
|
133
|
+
*
|
|
134
|
+
* Use one of the `set*` methods to modify the invitation before calling this method.
|
|
135
|
+
*
|
|
136
|
+
* @returns An array of patch operations.
|
|
137
|
+
* If no changes have been made, it returns an empty array.
|
|
138
|
+
*/
|
|
139
|
+
getPatch() {
|
|
140
|
+
if (!this.#builder) {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
return this.builder.build();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Sets the name of the user to whom the invitation is sent.
|
|
147
|
+
* If the name is the same as the current name, no operation is performed.
|
|
148
|
+
*
|
|
149
|
+
* @param name The name to set. If undefined, it will be removed.
|
|
150
|
+
*/
|
|
151
|
+
setName(name) {
|
|
152
|
+
if (name === this.name) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const hasName = !!this.name;
|
|
156
|
+
if (hasName && !name) {
|
|
157
|
+
this.builder.remove('/name');
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// The add method handles both adding and replacing
|
|
161
|
+
this.builder.add('/name', name);
|
|
162
|
+
}
|
|
163
|
+
this.name = name;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Sets the expiration timestamp of the invitation.
|
|
167
|
+
* @param expiresAt The timestamp when the invitation expires.
|
|
168
|
+
* If the expiresAt is the same as the current expiresAt, no operation is performed.
|
|
169
|
+
*/
|
|
170
|
+
setExpiresAt(expiresAt) {
|
|
171
|
+
if (this.expiresAt !== expiresAt) {
|
|
172
|
+
this.builder.replace('/expiresAt', expiresAt);
|
|
173
|
+
this.expiresAt = expiresAt;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Sets the grant type of the user in the organization.
|
|
178
|
+
*/
|
|
179
|
+
setGrantType(grantType) {
|
|
180
|
+
if (this.grantType !== grantType) {
|
|
181
|
+
this.builder.replace('/grantType', grantType);
|
|
182
|
+
this.grantType = grantType;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=Invitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Invitation.js","sourceRoot":"","sources":["../../../../src/models/store/Invitation.ts"],"names":[],"mappings":"AAAA,O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,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,13 +1,13 @@
|
|
|
1
1
|
import type { IDeletion } from './Deletion.js';
|
|
2
|
-
|
|
3
|
-
export type UserOrganizationGrantType = 'owner' | '
|
|
2
|
+
import { OrganizationKind } from '../kinds.js';
|
|
3
|
+
export type UserOrganizationGrantType = 'owner' | 'manager' | 'editor' | 'viewer';
|
|
4
4
|
/**
|
|
5
5
|
* In the system the user identity represents registration information associated with a specific identity provider.
|
|
6
6
|
* This association allows the user to use different identity providers that map to the same user, as long as the
|
|
7
7
|
* email stays consistent.
|
|
8
8
|
*/
|
|
9
9
|
export interface IOrganization {
|
|
10
|
-
kind: typeof
|
|
10
|
+
kind: typeof OrganizationKind;
|
|
11
11
|
/**
|
|
12
12
|
* The database ID
|
|
13
13
|
*/
|
|
@@ -40,7 +40,7 @@ export interface IOrganization {
|
|
|
40
40
|
grantType: UserOrganizationGrantType;
|
|
41
41
|
}
|
|
42
42
|
export declare class Organization implements IOrganization {
|
|
43
|
-
kind: typeof
|
|
43
|
+
kind: typeof OrganizationKind;
|
|
44
44
|
key: string;
|
|
45
45
|
name: string;
|
|
46
46
|
createdBy: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Organization.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Organization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Organization.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Organization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEjF;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,gBAAgB,CAAA;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;;OAGG;IACH,SAAS,EAAE,yBAAyB,CAAA;CACrC;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,IAAI,EAAE,OAAO,gBAAgB,CAAmB;IAChD,GAAG,SAAK;IACR,IAAI,SAAK;IACT,SAAS,SAAK;IACd,WAAW,SAAI;IACf,OAAO,UAAQ;IACf,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,SAAS,EAAE,yBAAyB,CAAW;gBAEnC,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa;IAoB1C,GAAG,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IA2B9B;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAQ9C,MAAM,IAAI,aAAa;CAexB"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { nanoid } from 'nanoid';
|
|
2
|
-
|
|
2
|
+
import { OrganizationKind } from '../kinds.js';
|
|
3
3
|
export class Organization {
|
|
4
|
-
kind =
|
|
4
|
+
kind = OrganizationKind;
|
|
5
5
|
key = '';
|
|
6
6
|
name = '';
|
|
7
7
|
createdBy = '';
|
|
8
8
|
createdDate = 0;
|
|
9
9
|
deleted = false;
|
|
10
10
|
deletedInfo;
|
|
11
|
-
grantType = '
|
|
11
|
+
grantType = 'viewer';
|
|
12
12
|
constructor(input) {
|
|
13
13
|
let init;
|
|
14
14
|
if (typeof input === 'string') {
|
|
@@ -19,13 +19,13 @@ export class Organization {
|
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
init = {
|
|
22
|
-
kind:
|
|
22
|
+
kind: OrganizationKind,
|
|
23
23
|
key: nanoid(),
|
|
24
24
|
name: '',
|
|
25
25
|
createdBy: '',
|
|
26
26
|
createdDate: Date.now(),
|
|
27
27
|
deleted: false,
|
|
28
|
-
grantType: '
|
|
28
|
+
grantType: 'viewer',
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
this.new(init);
|
|
@@ -34,8 +34,8 @@ export class Organization {
|
|
|
34
34
|
if (!Organization.isOrganization(init)) {
|
|
35
35
|
throw new Error(`Not an Organization.`);
|
|
36
36
|
}
|
|
37
|
-
const { key = nanoid(), name, createdBy, createdDate = Date.now(), deleted = false, deletedInfo, grantType = '
|
|
38
|
-
this.kind =
|
|
37
|
+
const { key = nanoid(), name, createdBy, createdDate = Date.now(), deleted = false, deletedInfo, grantType = 'viewer', } = init;
|
|
38
|
+
this.kind = OrganizationKind;
|
|
39
39
|
this.key = key;
|
|
40
40
|
this.name = name;
|
|
41
41
|
this.createdBy = createdBy;
|
|
@@ -54,14 +54,14 @@ export class Organization {
|
|
|
54
54
|
*/
|
|
55
55
|
static isOrganization(input) {
|
|
56
56
|
const typed = input;
|
|
57
|
-
if (!input || typed.kind !==
|
|
57
|
+
if (!input || typed.kind !== OrganizationKind) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
62
|
toJSON() {
|
|
63
63
|
const result = {
|
|
64
|
-
kind:
|
|
64
|
+
kind: OrganizationKind,
|
|
65
65
|
key: this.key,
|
|
66
66
|
name: this.name,
|
|
67
67
|
createdBy: this.createdBy,
|