quidproquo-web 0.1.3 → 0.1.4
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/lib/commonjs/actions/api/ApiActionType.js +1 -0
- package/lib/commonjs/actions/api/ApiActionType.js.map +1 -0
- package/lib/commonjs/actions/api/ApiRequestActionRequester.js +1 -0
- package/lib/commonjs/actions/api/ApiRequestActionRequester.js.map +1 -0
- package/lib/commonjs/actions/api/ApiRequestActionRequesterTypes.js +1 -0
- package/lib/commonjs/actions/api/ApiRequestActionRequesterTypes.js.map +1 -0
- package/lib/commonjs/actions/api/index.js +1 -0
- package/lib/commonjs/actions/api/index.js.map +1 -0
- package/lib/commonjs/actions/index.js +1 -0
- package/lib/commonjs/actions/index.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsActionType.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsActionType.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetActionRequester.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetActionRequester.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetActionRequesterTypes.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetActionRequesterTypes.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetAllActionRequester.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetAllActionRequester.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetAllActionRequesterTypes.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsGetAllActionRequesterTypes.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsSetActionRequester.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsSetActionRequester.js.map +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsSetActionRequesterTypes.js +1 -0
- package/lib/commonjs/actions/queryParams/QueryParamsSetActionRequesterTypes.js.map +1 -0
- package/lib/commonjs/actions/queryParams/index.js +1 -0
- package/lib/commonjs/actions/queryParams/index.js.map +1 -0
- package/lib/commonjs/actions/window/WindowActionType.js +1 -0
- package/lib/commonjs/actions/window/WindowActionType.js.map +1 -0
- package/lib/commonjs/actions/window/WindowGetLocationActionRequester.js +1 -0
- package/lib/commonjs/actions/window/WindowGetLocationActionRequester.js.map +1 -0
- package/lib/commonjs/actions/window/WindowGetLocationActionRequesterTypes.js +1 -0
- package/lib/commonjs/actions/window/WindowGetLocationActionRequesterTypes.js.map +1 -0
- package/lib/commonjs/actions/window/index.js +1 -0
- package/lib/commonjs/actions/window/index.js.map +1 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/services/WebsocketService.js +1 -0
- package/lib/commonjs/services/WebsocketService.js.map +1 -0
- package/lib/commonjs/services/index.js +1 -0
- package/lib/commonjs/services/index.js.map +1 -0
- package/lib/commonjs/tools/index.js +1 -0
- package/lib/commonjs/tools/index.js.map +1 -0
- package/lib/commonjs/tools/timeAgo.js +1 -0
- package/lib/commonjs/tools/timeAgo.js.map +1 -0
- package/lib/commonjs/tools/uniqueBy.js +1 -0
- package/lib/commonjs/tools/uniqueBy.js.map +1 -0
- package/lib/esm/actions/api/ApiActionType.js +1 -0
- package/lib/esm/actions/api/ApiActionType.js.map +1 -0
- package/lib/esm/actions/api/ApiRequestActionRequester.js +1 -0
- package/lib/esm/actions/api/ApiRequestActionRequester.js.map +1 -0
- package/lib/esm/actions/api/ApiRequestActionRequesterTypes.js +1 -0
- package/lib/esm/actions/api/ApiRequestActionRequesterTypes.js.map +1 -0
- package/lib/esm/actions/api/index.js +1 -0
- package/lib/esm/actions/api/index.js.map +1 -0
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/index.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsActionType.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsActionType.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetActionRequester.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetActionRequester.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetActionRequesterTypes.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetActionRequesterTypes.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetAllActionRequester.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetAllActionRequester.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetAllActionRequesterTypes.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsGetAllActionRequesterTypes.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsSetActionRequester.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsSetActionRequester.js.map +1 -0
- package/lib/esm/actions/queryParams/QueryParamsSetActionRequesterTypes.js +1 -0
- package/lib/esm/actions/queryParams/QueryParamsSetActionRequesterTypes.js.map +1 -0
- package/lib/esm/actions/queryParams/index.js +1 -0
- package/lib/esm/actions/queryParams/index.js.map +1 -0
- package/lib/esm/actions/window/WindowActionType.js +1 -0
- package/lib/esm/actions/window/WindowActionType.js.map +1 -0
- package/lib/esm/actions/window/WindowGetLocationActionRequester.js +1 -0
- package/lib/esm/actions/window/WindowGetLocationActionRequester.js.map +1 -0
- package/lib/esm/actions/window/WindowGetLocationActionRequesterTypes.js +1 -0
- package/lib/esm/actions/window/WindowGetLocationActionRequesterTypes.js.map +1 -0
- package/lib/esm/actions/window/index.js +1 -0
- package/lib/esm/actions/window/index.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/services/WebsocketService.js +1 -0
- package/lib/esm/services/WebsocketService.js.map +1 -0
- package/lib/esm/services/index.js +1 -0
- package/lib/esm/services/index.js.map +1 -0
- package/lib/esm/tools/index.js +1 -0
- package/lib/esm/tools/index.js.map +1 -0
- package/lib/esm/tools/timeAgo.js +1 -0
- package/lib/esm/tools/timeAgo.js.map +1 -0
- package/lib/esm/tools/uniqueBy.js +1 -0
- package/lib/esm/tools/uniqueBy.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiActionType.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiActionType.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,wDAAuC,CAAA;AACzC,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB","sourcesContent":["export enum ApiActionType {\n Request = '@quidproquo-web/Api/Request',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiRequestActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequester.ts"],"names":[],"mappings":";;AAKA,sCAkBC;AArBD,mDAAgD;AAGhD,QAAe,CAAC,CAAC,aAAa,CAC5B,OAAe,EACf,MAAkB,EAClB,QAAgB,EAChB,OAA8B;IAE9B,OAAO,MAAM;QACX,IAAI,EAAE,6BAAa,CAAC,OAAO;QAC3B,OAAO,EAAE;YACP,OAAO;YACP,QAAQ;YACR,MAAM;YACN,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;YACnB,OAAO,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;YACzB,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM;YACvB,YAAY,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,MAAM;SAC9C;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { HTTPMethod } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\nimport { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';\n\nexport function* askApiRequest<T, R>(\n service: string,\n method: HTTPMethod,\n endpoint: string,\n options?: ApiRequestOptions<T>,\n): ApiRequestActionRequester<T, R> {\n return yield {\n type: ApiActionType.Request,\n payload: {\n service,\n endpoint,\n method,\n body: options?.body,\n headers: options?.headers,\n params: options?.params,\n responseType: options?.responseType || 'json',\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiRequestActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\n\n// basePath is resolved by the processor, so it is omitted from the caller options\nexport type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;\n\n// Payload\nexport interface ApiRequestActionPayload<T> {\n service: string;\n endpoint: string;\n method: HTTPMethod;\n body?: T;\n params?: Record<string, string>;\n headers?: Record<string, string>;\n responseType: ResponseType;\n}\n\n// Action\nexport interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {\n type: ApiActionType.Request;\n payload: ApiRequestActionPayload<T>;\n}\n\n// Function Types\nexport type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\nexport type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\n"]}
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ApiActionType"), exports);
|
|
18
18
|
__exportStar(require("./ApiRequestActionRequester"), exports);
|
|
19
19
|
__exportStar(require("./ApiRequestActionRequesterTypes"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8DAA4C;AAC5C,mEAAiD","sourcesContent":["export * from './ApiActionType';\nexport * from './ApiRequestActionRequester';\nexport * from './ApiRequestActionRequesterTypes';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,gDAA8B;AAC9B,2CAAyB","sourcesContent":["export * from './api';\nexport * from './queryParams';\nexport * from './window';\n"]}
|
|
@@ -7,3 +7,4 @@ var QueryParamsActionType;
|
|
|
7
7
|
QueryParamsActionType["GetAll"] = "@quidproquo-web/QueryParams/GetAll";
|
|
8
8
|
QueryParamsActionType["Set"] = "@quidproquo-web/QueryParams/Set";
|
|
9
9
|
})(QueryParamsActionType || (exports.QueryParamsActionType = QueryParamsActionType = {}));
|
|
10
|
+
//# sourceMappingURL=QueryParamsActionType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsActionType.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsActionType.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,gEAAuC,CAAA;IACvC,sEAA6C,CAAA;IAC7C,gEAAuC,CAAA;AACzC,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC","sourcesContent":["export enum QueryParamsActionType {\n Get = '@quidproquo-web/QueryParams/Get',\n GetAll = '@quidproquo-web/QueryParams/GetAll',\n Set = '@quidproquo-web/QueryParams/Set',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetActionRequester.ts"],"names":[],"mappings":";;AAGA,8CAEC;AALD,mEAAgE;AAGhE,QAAe,CAAC,CAAC,iBAAiB,CAAC,GAAW;IAC5C,OAAO,MAAM,EAAE,IAAI,EAAE,6CAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;AACrE,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsGetActionRequester } from './QueryParamsGetActionRequesterTypes';\n\nexport function* askQueryParamsGet(key: string): QueryParamsGetActionRequester {\n return yield { type: QueryParamsActionType.Get, payload: { key } };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsGetActionPayload = {\n key: string;\n};\n\n// Action\nexport interface QueryParamsGetAction extends Action<QueryParamsGetActionPayload> {\n type: QueryParamsActionType.Get;\n payload: QueryParamsGetActionPayload;\n}\n\n// Function Types\nexport type QueryParamsGetActionProcessor = ActionProcessor<QueryParamsGetAction, string[]>;\nexport type QueryParamsGetActionRequester = ActionRequester<QueryParamsGetAction, string[]>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetAllActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetAllActionRequester.ts"],"names":[],"mappings":";;AAGA,oDAEC;AALD,mEAAgE;AAGhE,QAAe,CAAC,CAAC,oBAAoB;IACnC,OAAO,MAAM,EAAE,IAAI,EAAE,6CAAqB,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsGetAllActionRequester } from './QueryParamsGetAllActionRequesterTypes';\n\nexport function* askQueryParamsGetAll(): QueryParamsGetAllActionRequester {\n return yield { type: QueryParamsActionType.GetAll };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetAllActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetAllActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsGetAllActionPayload = undefined;\n\n// Action\nexport interface QueryParamsGetAllAction extends Action<QueryParamsGetAllActionPayload> {\n type: QueryParamsActionType.GetAll;\n}\n\n// Function Types\nexport type QueryParamsGetAllActionProcessor = ActionProcessor<QueryParamsGetAllAction, Record<string, string[]>>;\nexport type QueryParamsGetAllActionRequester = ActionRequester<QueryParamsGetAllAction, Record<string, string[]>>;\n"]}
|
|
@@ -5,3 +5,4 @@ const QueryParamsActionType_1 = require("./QueryParamsActionType");
|
|
|
5
5
|
function* askQueryParamsSet(key, values, createHistoryEntry = false) {
|
|
6
6
|
return yield { type: QueryParamsActionType_1.QueryParamsActionType.Set, payload: { key, values, createHistoryEntry } };
|
|
7
7
|
}
|
|
8
|
+
//# sourceMappingURL=QueryParamsSetActionRequester.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsSetActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsSetActionRequester.ts"],"names":[],"mappings":";;AAGA,8CAEC;AALD,mEAAgE;AAGhE,QAAe,CAAC,CAAC,iBAAiB,CAAC,GAAW,EAAE,MAAgB,EAAE,qBAA8B,KAAK;IACnG,OAAO,MAAM,EAAE,IAAI,EAAE,6CAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,CAAC;AACjG,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsSetActionRequester } from './QueryParamsSetActionRequesterTypes';\n\nexport function* askQueryParamsSet(key: string, values: string[], createHistoryEntry: boolean = false): QueryParamsSetActionRequester {\n return yield { type: QueryParamsActionType.Set, payload: { key, values, createHistoryEntry } };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsSetActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsSetActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsSetActionPayload = {\n key: string;\n values: string[];\n createHistoryEntry: boolean;\n};\n\n// Action\nexport interface QueryParamsSetAction extends Action<QueryParamsSetActionPayload> {\n type: QueryParamsActionType.Set;\n payload: QueryParamsSetActionPayload;\n}\n\n// Function Types\nexport type QueryParamsSetActionProcessor = ActionProcessor<QueryParamsSetAction, void>;\nexport type QueryParamsSetActionRequester = ActionRequester<QueryParamsSetAction, void>;\n"]}
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./QueryParamsGetAllActionRequester"), exports);
|
|
|
21
21
|
__exportStar(require("./QueryParamsGetAllActionRequesterTypes"), exports);
|
|
22
22
|
__exportStar(require("./QueryParamsSetActionRequester"), exports);
|
|
23
23
|
__exportStar(require("./QueryParamsSetActionRequesterTypes"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,qEAAmD;AACnD,0EAAwD;AACxD,kEAAgD;AAChD,uEAAqD","sourcesContent":["export * from './QueryParamsActionType';\nexport * from './QueryParamsGetActionRequester';\nexport * from './QueryParamsGetActionRequesterTypes';\nexport * from './QueryParamsGetAllActionRequester';\nexport * from './QueryParamsGetAllActionRequesterTypes';\nexport * from './QueryParamsSetActionRequester';\nexport * from './QueryParamsSetActionRequesterTypes';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowActionType.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowActionType.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,sEAAkD,CAAA;AACpD,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B","sourcesContent":["export enum WindowActionType {\n GetLocation = '@quidproquo-web/Window/GetLocation',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowGetLocationActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowGetLocationActionRequester.ts"],"names":[],"mappings":";;AAGA,oDAEC;AALD,yDAAsD;AAGtD,QAAe,CAAC,CAAC,oBAAoB;IACnC,OAAO,MAAM,EAAE,IAAI,EAAE,mCAAgB,CAAC,WAAW,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { WindowActionType } from './WindowActionType';\nimport { WindowGetLocationActionRequester } from './WindowGetLocationActionRequesterTypes';\n\nexport function* askWindowGetLocation(): WindowGetLocationActionRequester {\n return yield { type: WindowActionType.GetLocation };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowGetLocationActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowGetLocationActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { WindowActionType } from './WindowActionType';\n\n// A plain, serializable copy of the browser `window.location`.\nexport type WindowLocation = {\n href: string;\n origin: string;\n protocol: string;\n host: string;\n hostname: string;\n port: string;\n pathname: string;\n search: string;\n hash: string;\n};\n\n// Payload\nexport type WindowGetLocationActionPayload = undefined;\n\n// Action\nexport interface WindowGetLocationAction extends Action<WindowGetLocationActionPayload> {\n type: WindowActionType.GetLocation;\n}\n\n// Function Types\nexport type WindowGetLocationActionProcessor = ActionProcessor<WindowGetLocationAction, WindowLocation>;\nexport type WindowGetLocationActionRequester = ActionRequester<WindowGetLocationAction, WindowLocation>;\n"]}
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./WindowActionType"), exports);
|
|
18
18
|
__exportStar(require("./WindowGetLocationActionRequester"), exports);
|
|
19
19
|
__exportStar(require("./WindowGetLocationActionRequesterTypes"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/window/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,qEAAmD;AACnD,0EAAwD","sourcesContent":["export * from './WindowActionType';\nexport * from './WindowGetLocationActionRequester';\nexport * from './WindowGetLocationActionRequesterTypes';\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './actions';\nexport * from './services';\nexport * from './tools';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebsocketService.js","sourceRoot":"","sources":["../../../src/services/WebsocketService.ts"],"names":[],"mappings":";;;AAKA,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,wCAAe,CAAA;IACf,4CAAmB,CAAA;IACnB,wCAAe,CAAA;AACjB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAkBD,MAAa,gBAAgB;IAkB3B,YAAY,GAAW;QAhBf,WAAM,GAAqB,IAAI,CAAC;QAChC,mBAAc,GAAwD,EAAE,CAAC;QACzE,gBAAW,GAAY,KAAK,CAAC;QAC7B,oBAAe,GAA2B,EAAE,CAAC;QAE7C,sBAAiB,GAAW,CAAC,CAAC;QAI9B,kBAAa,GAAkB;YACrC,CAAC,qBAAq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AAqB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAEO,iBAAiB,CAAC,OAA8B,EAAE,KAAa;QACrE,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC/C,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,IAAI,CAAC,IAA0B;;QACpC,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,MAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAEM,SAAS,CAA+C,KAAQ;QACrE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACnC,CAAC;;AArLH,4CAsLC;AA9KyB,kCAAiB,GAAG,IAAI,AAAP,CAAQ;AACzB,iCAAgB,GAAG,KAAM,AAAT,CAAU","sourcesContent":["import { AnyEventMessage, EventMessage } from 'quidproquo-core';\n\n// Private / internal types\ntype WebSocketEventListenerFunction = (this: WebSocket, ev: Event) => any;\n\nexport enum WebsocketServiceEvent {\n OPEN = 'open',\n CLOSE = 'close',\n MESSAGE = 'message',\n ERROR = 'error',\n}\n\nexport type SubscriptionHandle = {\n type: WebsocketServiceEvent;\n};\n\nexport type WebSocketServiceSubscriptionFunction = (websocketService: WebsocketService, event?: Event) => any;\n\ntype SubscriptionMap = Map<SubscriptionHandle, WebSocketServiceSubscriptionFunction>;\n\ntype Subscriptions = {\n [key in WebsocketServiceEvent]: SubscriptionMap;\n};\n\ntype WebsocketSendPayload = string | ArrayBufferLike | Blob | ArrayBufferView;\n\nexport type WebSocketServiceEventSubscriptionFunction<E extends AnyEventMessage> = (websocketService: WebsocketService, event: E) => void;\n\nexport class WebsocketService {\n public readonly url: string;\n private socket: WebSocket | null = null;\n private eventListeners: { [key: string]: WebSocketEventListenerFunction[] } = {};\n private isDestroyed: boolean = false;\n private pendingMessages: WebsocketSendPayload[] = [];\n\n private reconnectAttempts: number = 0;\n private static readonly BASE_RECONNECT_MS = 1000;\n private static readonly MAX_RECONNECT_MS = 60_000;\n\n private subscriptions: Subscriptions = {\n [WebsocketServiceEvent.OPEN]: new Map(),\n [WebsocketServiceEvent.CLOSE]: new Map(),\n [WebsocketServiceEvent.MESSAGE]: new Map(),\n [WebsocketServiceEvent.ERROR]: new Map(),\n };\n\n constructor(url: string) {\n this.url = url;\n\n this.connect();\n }\n\n public destroy() {\n this.isDestroyed = true;\n this.unsubscribeAll();\n this.socket?.close();\n }\n\n public close() {\n this.socket?.close();\n }\n\n public isConnected() {\n return this.socket?.readyState === WebSocket.OPEN;\n }\n\n public hasBeenDestroyed() {\n return this.isDestroyed;\n }\n\n public getSocket() {\n return this.socket;\n }\n\n public subscribe(subscriptionType: WebsocketServiceEvent, callback: WebSocketServiceSubscriptionFunction): SubscriptionHandle {\n const subscriptionHandle: SubscriptionHandle = {\n type: subscriptionType,\n };\n this.subscriptions[subscriptionType].set(subscriptionHandle, callback);\n\n return subscriptionHandle;\n }\n\n public subscribeToEvent<E extends AnyEventMessage>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n ): SubscriptionHandle {\n return this.subscribe(WebsocketServiceEvent.MESSAGE, (websocketService: WebsocketService, event?: Event) => {\n if (event) {\n const data = (event as MessageEvent).data;\n try {\n const parsedEvent: E = JSON.parse(data);\n if (parsedEvent.type === subscriptionType) {\n callback(websocketService, parsedEvent);\n }\n } catch (e) {\n // Must have been some other message format / type do nothing.\n }\n }\n });\n }\n\n public unsubscribe(subscriptionHandle: SubscriptionHandle) {\n this.subscriptions[subscriptionHandle.type].delete(subscriptionHandle);\n }\n\n public unsubscribeAll() {\n for (const subscriptionType in this.subscriptions) {\n if (Object.prototype.hasOwnProperty.call(this.subscriptions, subscriptionType)) {\n this.subscriptions[subscriptionType as WebsocketServiceEvent].clear();\n }\n }\n }\n\n private connect() {\n this.removeAllEventListeners();\n\n this.socket = new WebSocket(this.url);\n\n this.addEventListener(WebsocketServiceEvent.OPEN, this.onConnect.bind(this));\n this.addEventListener(WebsocketServiceEvent.CLOSE, this.onClose.bind(this));\n this.addEventListener(WebsocketServiceEvent.MESSAGE, this.onMessage.bind(this));\n this.addEventListener(WebsocketServiceEvent.ERROR, this.onError.bind(this));\n }\n\n private addEventListener(event: WebsocketServiceEvent, listener: WebSocketEventListenerFunction) {\n if (this.socket) {\n this.socket.addEventListener(event, listener);\n\n if (!this.eventListeners[event]) {\n this.eventListeners[event] = [];\n }\n\n this.eventListeners[event].push(listener);\n }\n }\n\n private removeAllEventListeners() {\n if (this.socket) {\n for (const event in this.eventListeners) {\n if (Object.prototype.hasOwnProperty.call(this.eventListeners, event)) {\n for (const listener of this.eventListeners[event]) {\n this.socket.removeEventListener(event, listener);\n }\n }\n }\n }\n\n this.eventListeners = {};\n }\n\n private reconnectIfNotDestroyed() {\n const baseDelay = Math.min(WebsocketService.BASE_RECONNECT_MS * Math.pow(2, this.reconnectAttempts), WebsocketService.MAX_RECONNECT_MS);\n\n // Add jitter: ±25% of base delay to prevent thundering herd\n const jitter = baseDelay * 0.25 * (Math.random() * 2 - 1);\n const delay = Math.max(0, baseDelay + jitter);\n\n this.reconnectAttempts++;\n\n console.log('Delay: ', delay);\n\n setTimeout(() => {\n if (!this.isDestroyed) {\n this.connect();\n }\n }, delay);\n }\n\n private onConnect() {\n this.reconnectAttempts = 0;\n this.notifySubscribers(WebsocketServiceEvent.OPEN);\n const messages = this.pendingMessages;\n this.pendingMessages = [];\n messages.forEach((message) => {\n this.send(message);\n });\n }\n\n private onClose() {\n this.removeAllEventListeners();\n this.reconnectIfNotDestroyed();\n this.notifySubscribers(WebsocketServiceEvent.CLOSE);\n }\n\n private onMessage(event: Event) {\n this.notifySubscribers(WebsocketServiceEvent.MESSAGE, event);\n }\n\n private onError(event: Event) {\n this.notifySubscribers(WebsocketServiceEvent.ERROR, event);\n }\n\n private notifySubscribers(subType: WebsocketServiceEvent, event?: Event) {\n this.subscriptions[subType].forEach((callback) => {\n callback(this, event);\n });\n }\n\n public send(data: WebsocketSendPayload) {\n if (this.socket?.readyState === WebSocket.OPEN) {\n this.socket.send(data);\n } else {\n this.pendingMessages.push(data);\n }\n }\n\n public sendEvent<E extends EventMessage<any, string | number>>(event: E) {\n this.send(JSON.stringify(event));\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC","sourcesContent":["export * from './WebsocketService';\n"]}
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./timeAgo"), exports);
|
|
18
18
|
__exportStar(require("./uniqueBy"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B","sourcesContent":["export * from './timeAgo';\nexport * from './uniqueBy';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeAgo.js","sourceRoot":"","sources":["../../../src/tools/timeAgo.ts"],"names":[],"mappings":";;;AAKA,uEAAuE;AACvE,MAAM,SAAS,GAAe;IAC5B,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,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CAAC;AACzD,CAAC,CAAC;AApBW,QAAA,aAAa,iBAoBxB;AAEF;;;GAGG;AACI,MAAM,0BAA0B,GAAG,CAAC,IAAU,EAAE,MAAY,IAAI,IAAI,EAAE,EAAU,EAAE;IACvF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAElE,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC,CAAC,oBAAoB;IACnC,CAAC;IACD,IAAI,OAAO,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;QACtB,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,oBAAoB;IACxC,CAAC;IACD,IAAI,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;QAC3B,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,kBAAkB;IAC3C,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,kBAAkB;AAChD,CAAC,CAAC;AAbW,QAAA,0BAA0B,8BAarC","sourcesContent":["type Division = {\n amount: number;\n unit: Intl.RelativeTimeFormatUnit;\n};\n\n// Each amount is \"how many of this unit make up one of the next unit\".\nconst DIVISIONS: Division[] = [\n { amount: 60, unit: 'seconds' },\n { amount: 60, unit: 'minutes' },\n { amount: 24, unit: 'hours' },\n { amount: 7, unit: 'days' },\n { amount: 4.34524, unit: 'weeks' },\n { amount: 12, unit: 'months' },\n { amount: Number.POSITIVE_INFINITY, unit: 'years' },\n];\n\n/**\n * Formats the distance between `date` and `now` as a relative phrase\n * (e.g. \"5 minutes ago\", \"in 2 hours\") using the native Intl.RelativeTimeFormat.\n * Past dates are negative, future dates are positive.\n */\nexport const formatTimeAgo = (date: Date, now: Date = new Date(), locale?: string | string[]): string => {\n // An invalid date (e.g. new Date('')) has a NaN time, which Intl.RelativeTimeFormat\n // rejects — guard so callers never have to.\n if (Number.isNaN(date.getTime())) {\n return '';\n }\n\n const formatter = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });\n\n // Seconds between the two dates; negative for the past.\n let duration = (date.getTime() - now.getTime()) / 1000;\n\n for (const division of DIVISIONS) {\n if (Math.abs(duration) < division.amount) {\n return formatter.format(Math.round(duration), division.unit);\n }\n duration /= division.amount;\n }\n\n return formatter.format(Math.round(duration), 'years');\n};\n\n/**\n * How long until the relative phrase could next change, so callers can\n * re-render no more often than necessary.\n */\nexport const getTimeAgoUpdateIntervalMs = (date: Date, now: Date = new Date()): number => {\n const seconds = Math.abs((date.getTime() - now.getTime()) / 1000);\n\n if (seconds < 60) {\n return 1000; // seconds tick over\n }\n if (seconds < 60 * 60) {\n return 60 * 1000; // minutes tick over\n }\n if (seconds < 60 * 60 * 24) {\n return 60 * 60 * 1000; // hours tick over\n }\n return 60 * 60 * 24 * 1000; // days or coarser\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniqueBy.js","sourceRoot":"","sources":["../../../src/tools/uniqueBy.ts"],"names":[],"mappings":";;AAAA,4BAUC;AAVD,SAAgB,QAAQ,CAAI,KAAU,EAAE,KAAuB;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAO,CAAC;IAC5B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["export function uniqueBy<T>(array: T[], keyFn: (item: T) => any): T[] {\n const seen = new Set<any>();\n return array.filter((item) => {\n const key = keyFn(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiActionType.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiActionType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,wDAAuC,CAAA;AACzC,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB","sourcesContent":["export enum ApiActionType {\n Request = '@quidproquo-web/Api/Request',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiRequestActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequester.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,SAAS,CAAC,CAAC,aAAa,CAC5B,OAAe,EACf,MAAkB,EAClB,QAAgB,EAChB,OAA8B;IAE9B,OAAO,MAAM;QACX,IAAI,EAAE,aAAa,CAAC,OAAO;QAC3B,OAAO,EAAE;YACP,OAAO;YACP,QAAQ;YACR,MAAM;YACN,IAAI,EAAE,OAAO,EAAE,IAAI;YACnB,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,YAAY,EAAE,OAAO,EAAE,YAAY,IAAI,MAAM;SAC9C;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { HTTPMethod } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\nimport { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';\n\nexport function* askApiRequest<T, R>(\n service: string,\n method: HTTPMethod,\n endpoint: string,\n options?: ApiRequestOptions<T>,\n): ApiRequestActionRequester<T, R> {\n return yield {\n type: ApiActionType.Request,\n payload: {\n service,\n endpoint,\n method,\n body: options?.body,\n headers: options?.headers,\n params: options?.params,\n responseType: options?.responseType || 'json',\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiRequestActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\n\n// basePath is resolved by the processor, so it is omitted from the caller options\nexport type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;\n\n// Payload\nexport interface ApiRequestActionPayload<T> {\n service: string;\n endpoint: string;\n method: HTTPMethod;\n body?: T;\n params?: Record<string, string>;\n headers?: Record<string, string>;\n responseType: ResponseType;\n}\n\n// Action\nexport interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {\n type: ApiActionType.Request;\n payload: ApiRequestActionPayload<T>;\n}\n\n// Function Types\nexport type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\nexport type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './ApiActionType';\nexport * from './ApiRequestActionRequester';\nexport * from './ApiRequestActionRequesterTypes';\n"]}
|
package/lib/esm/actions/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC","sourcesContent":["export * from './api';\nexport * from './queryParams';\nexport * from './window';\n"]}
|
|
@@ -4,3 +4,4 @@ export var QueryParamsActionType;
|
|
|
4
4
|
QueryParamsActionType["GetAll"] = "@quidproquo-web/QueryParams/GetAll";
|
|
5
5
|
QueryParamsActionType["Set"] = "@quidproquo-web/QueryParams/Set";
|
|
6
6
|
})(QueryParamsActionType || (QueryParamsActionType = {}));
|
|
7
|
+
//# sourceMappingURL=QueryParamsActionType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsActionType.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsActionType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,gEAAuC,CAAA;IACvC,sEAA6C,CAAA;IAC7C,gEAAuC,CAAA;AACzC,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC","sourcesContent":["export enum QueryParamsActionType {\n Get = '@quidproquo-web/QueryParams/Get',\n GetAll = '@quidproquo-web/QueryParams/GetAll',\n Set = '@quidproquo-web/QueryParams/Set',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetActionRequester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,SAAS,CAAC,CAAC,iBAAiB,CAAC,GAAW;IAC5C,OAAO,MAAM,EAAE,IAAI,EAAE,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;AACrE,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsGetActionRequester } from './QueryParamsGetActionRequesterTypes';\n\nexport function* askQueryParamsGet(key: string): QueryParamsGetActionRequester {\n return yield { type: QueryParamsActionType.Get, payload: { key } };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsGetActionPayload = {\n key: string;\n};\n\n// Action\nexport interface QueryParamsGetAction extends Action<QueryParamsGetActionPayload> {\n type: QueryParamsActionType.Get;\n payload: QueryParamsGetActionPayload;\n}\n\n// Function Types\nexport type QueryParamsGetActionProcessor = ActionProcessor<QueryParamsGetAction, string[]>;\nexport type QueryParamsGetActionRequester = ActionRequester<QueryParamsGetAction, string[]>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetAllActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetAllActionRequester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,SAAS,CAAC,CAAC,oBAAoB;IACnC,OAAO,MAAM,EAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsGetAllActionRequester } from './QueryParamsGetAllActionRequesterTypes';\n\nexport function* askQueryParamsGetAll(): QueryParamsGetAllActionRequester {\n return yield { type: QueryParamsActionType.GetAll };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsGetAllActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsGetAllActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsGetAllActionPayload = undefined;\n\n// Action\nexport interface QueryParamsGetAllAction extends Action<QueryParamsGetAllActionPayload> {\n type: QueryParamsActionType.GetAll;\n}\n\n// Function Types\nexport type QueryParamsGetAllActionProcessor = ActionProcessor<QueryParamsGetAllAction, Record<string, string[]>>;\nexport type QueryParamsGetAllActionRequester = ActionRequester<QueryParamsGetAllAction, Record<string, string[]>>;\n"]}
|
|
@@ -2,3 +2,4 @@ import { QueryParamsActionType } from './QueryParamsActionType';
|
|
|
2
2
|
export function* askQueryParamsSet(key, values, createHistoryEntry = false) {
|
|
3
3
|
return yield { type: QueryParamsActionType.Set, payload: { key, values, createHistoryEntry } };
|
|
4
4
|
}
|
|
5
|
+
//# sourceMappingURL=QueryParamsSetActionRequester.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsSetActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsSetActionRequester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,SAAS,CAAC,CAAC,iBAAiB,CAAC,GAAW,EAAE,MAAgB,EAAE,qBAA8B,KAAK;IACnG,OAAO,MAAM,EAAE,IAAI,EAAE,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,CAAC;AACjG,CAAC","sourcesContent":["import { QueryParamsActionType } from './QueryParamsActionType';\nimport { QueryParamsSetActionRequester } from './QueryParamsSetActionRequesterTypes';\n\nexport function* askQueryParamsSet(key: string, values: string[], createHistoryEntry: boolean = false): QueryParamsSetActionRequester {\n return yield { type: QueryParamsActionType.Set, payload: { key, values, createHistoryEntry } };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryParamsSetActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/QueryParamsSetActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { QueryParamsActionType } from './QueryParamsActionType';\n\n// Payload\nexport type QueryParamsSetActionPayload = {\n key: string;\n values: string[];\n createHistoryEntry: boolean;\n};\n\n// Action\nexport interface QueryParamsSetAction extends Action<QueryParamsSetActionPayload> {\n type: QueryParamsActionType.Set;\n payload: QueryParamsSetActionPayload;\n}\n\n// Function Types\nexport type QueryParamsSetActionProcessor = ActionProcessor<QueryParamsSetAction, void>;\nexport type QueryParamsSetActionRequester = ActionRequester<QueryParamsSetAction, void>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/queryParams/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC","sourcesContent":["export * from './QueryParamsActionType';\nexport * from './QueryParamsGetActionRequester';\nexport * from './QueryParamsGetActionRequesterTypes';\nexport * from './QueryParamsGetAllActionRequester';\nexport * from './QueryParamsGetAllActionRequesterTypes';\nexport * from './QueryParamsSetActionRequester';\nexport * from './QueryParamsSetActionRequesterTypes';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowActionType.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowActionType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,sEAAkD,CAAA;AACpD,CAAC,EAFW,gBAAgB,KAAhB,gBAAgB,QAE3B","sourcesContent":["export enum WindowActionType {\n GetLocation = '@quidproquo-web/Window/GetLocation',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowGetLocationActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowGetLocationActionRequester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,SAAS,CAAC,CAAC,oBAAoB;IACnC,OAAO,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { WindowActionType } from './WindowActionType';\nimport { WindowGetLocationActionRequester } from './WindowGetLocationActionRequesterTypes';\n\nexport function* askWindowGetLocation(): WindowGetLocationActionRequester {\n return yield { type: WindowActionType.GetLocation };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowGetLocationActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/window/WindowGetLocationActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester } from 'quidproquo-core';\n\nimport { WindowActionType } from './WindowActionType';\n\n// A plain, serializable copy of the browser `window.location`.\nexport type WindowLocation = {\n href: string;\n origin: string;\n protocol: string;\n host: string;\n hostname: string;\n port: string;\n pathname: string;\n search: string;\n hash: string;\n};\n\n// Payload\nexport type WindowGetLocationActionPayload = undefined;\n\n// Action\nexport interface WindowGetLocationAction extends Action<WindowGetLocationActionPayload> {\n type: WindowActionType.GetLocation;\n}\n\n// Function Types\nexport type WindowGetLocationActionProcessor = ActionProcessor<WindowGetLocationAction, WindowLocation>;\nexport type WindowGetLocationActionRequester = ActionRequester<WindowGetLocationAction, WindowLocation>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/window/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC","sourcesContent":["export * from './WindowActionType';\nexport * from './WindowGetLocationActionRequester';\nexport * from './WindowGetLocationActionRequesterTypes';\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './actions';\nexport * from './services';\nexport * from './tools';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebsocketService.js","sourceRoot":"","sources":["../../../src/services/WebsocketService.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,wCAAe,CAAA;IACf,4CAAmB,CAAA;IACnB,wCAAe,CAAA;AACjB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAkBD,MAAM,OAAO,gBAAgB;IACX,GAAG,CAAS;IACpB,MAAM,GAAqB,IAAI,CAAC;IAChC,cAAc,GAAwD,EAAE,CAAC;IACzE,WAAW,GAAY,KAAK,CAAC;IAC7B,eAAe,GAA2B,EAAE,CAAC;IAE7C,iBAAiB,GAAW,CAAC,CAAC;IAC9B,MAAM,CAAU,iBAAiB,GAAG,IAAI,CAAC;IACzC,MAAM,CAAU,gBAAgB,GAAG,MAAM,CAAC;IAE1C,aAAa,GAAkB;QACrC,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE;QACvC,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,EAAE;QACxC,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,EAAE;QAC1C,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,EAAE;KACzC,CAAC;IAEF,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAEM,OAAO;QACZ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AAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAEM,SAAS,CAA+C,KAAQ;QACrE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACnC,CAAC","sourcesContent":["import { AnyEventMessage, EventMessage } from 'quidproquo-core';\n\n// Private / internal types\ntype WebSocketEventListenerFunction = (this: WebSocket, ev: Event) => any;\n\nexport enum WebsocketServiceEvent {\n OPEN = 'open',\n CLOSE = 'close',\n MESSAGE = 'message',\n ERROR = 'error',\n}\n\nexport type SubscriptionHandle = {\n type: WebsocketServiceEvent;\n};\n\nexport type WebSocketServiceSubscriptionFunction = (websocketService: WebsocketService, event?: Event) => any;\n\ntype SubscriptionMap = Map<SubscriptionHandle, WebSocketServiceSubscriptionFunction>;\n\ntype Subscriptions = {\n [key in WebsocketServiceEvent]: SubscriptionMap;\n};\n\ntype WebsocketSendPayload = string | ArrayBufferLike | Blob | ArrayBufferView;\n\nexport type WebSocketServiceEventSubscriptionFunction<E extends AnyEventMessage> = (websocketService: WebsocketService, event: E) => void;\n\nexport class WebsocketService {\n public readonly url: string;\n private socket: WebSocket | null = null;\n private eventListeners: { [key: string]: WebSocketEventListenerFunction[] } = {};\n private isDestroyed: boolean = false;\n private pendingMessages: WebsocketSendPayload[] = [];\n\n private reconnectAttempts: number = 0;\n private static readonly BASE_RECONNECT_MS = 1000;\n private static readonly MAX_RECONNECT_MS = 60_000;\n\n private subscriptions: Subscriptions = {\n [WebsocketServiceEvent.OPEN]: new Map(),\n [WebsocketServiceEvent.CLOSE]: new Map(),\n [WebsocketServiceEvent.MESSAGE]: new Map(),\n [WebsocketServiceEvent.ERROR]: new Map(),\n };\n\n constructor(url: string) {\n this.url = url;\n\n this.connect();\n }\n\n public destroy() {\n this.isDestroyed = true;\n this.unsubscribeAll();\n this.socket?.close();\n }\n\n public close() {\n this.socket?.close();\n }\n\n public isConnected() {\n return this.socket?.readyState === WebSocket.OPEN;\n }\n\n public hasBeenDestroyed() {\n return this.isDestroyed;\n }\n\n public getSocket() {\n return this.socket;\n }\n\n public subscribe(subscriptionType: WebsocketServiceEvent, callback: WebSocketServiceSubscriptionFunction): SubscriptionHandle {\n const subscriptionHandle: SubscriptionHandle = {\n type: subscriptionType,\n };\n this.subscriptions[subscriptionType].set(subscriptionHandle, callback);\n\n return subscriptionHandle;\n }\n\n public subscribeToEvent<E extends AnyEventMessage>(\n subscriptionType: E['type'],\n callback: WebSocketServiceEventSubscriptionFunction<E>,\n ): SubscriptionHandle {\n return this.subscribe(WebsocketServiceEvent.MESSAGE, (websocketService: WebsocketService, event?: Event) => {\n if (event) {\n const data = (event as MessageEvent).data;\n try {\n const parsedEvent: E = JSON.parse(data);\n if (parsedEvent.type === subscriptionType) {\n callback(websocketService, parsedEvent);\n }\n } catch (e) {\n // Must have been some other message format / type do nothing.\n }\n }\n });\n }\n\n public unsubscribe(subscriptionHandle: SubscriptionHandle) {\n this.subscriptions[subscriptionHandle.type].delete(subscriptionHandle);\n }\n\n public unsubscribeAll() {\n for (const subscriptionType in this.subscriptions) {\n if (Object.prototype.hasOwnProperty.call(this.subscriptions, subscriptionType)) {\n this.subscriptions[subscriptionType as WebsocketServiceEvent].clear();\n }\n }\n }\n\n private connect() {\n this.removeAllEventListeners();\n\n this.socket = new WebSocket(this.url);\n\n this.addEventListener(WebsocketServiceEvent.OPEN, this.onConnect.bind(this));\n this.addEventListener(WebsocketServiceEvent.CLOSE, this.onClose.bind(this));\n this.addEventListener(WebsocketServiceEvent.MESSAGE, this.onMessage.bind(this));\n this.addEventListener(WebsocketServiceEvent.ERROR, this.onError.bind(this));\n }\n\n private addEventListener(event: WebsocketServiceEvent, listener: WebSocketEventListenerFunction) {\n if (this.socket) {\n this.socket.addEventListener(event, listener);\n\n if (!this.eventListeners[event]) {\n this.eventListeners[event] = [];\n }\n\n this.eventListeners[event].push(listener);\n }\n }\n\n private removeAllEventListeners() {\n if (this.socket) {\n for (const event in this.eventListeners) {\n if (Object.prototype.hasOwnProperty.call(this.eventListeners, event)) {\n for (const listener of this.eventListeners[event]) {\n this.socket.removeEventListener(event, listener);\n }\n }\n }\n }\n\n this.eventListeners = {};\n }\n\n private reconnectIfNotDestroyed() {\n const baseDelay = Math.min(WebsocketService.BASE_RECONNECT_MS * Math.pow(2, this.reconnectAttempts), WebsocketService.MAX_RECONNECT_MS);\n\n // Add jitter: ±25% of base delay to prevent thundering herd\n const jitter = baseDelay * 0.25 * (Math.random() * 2 - 1);\n const delay = Math.max(0, baseDelay + jitter);\n\n this.reconnectAttempts++;\n\n console.log('Delay: ', delay);\n\n setTimeout(() => {\n if (!this.isDestroyed) {\n this.connect();\n }\n }, delay);\n }\n\n private onConnect() {\n this.reconnectAttempts = 0;\n this.notifySubscribers(WebsocketServiceEvent.OPEN);\n const messages = this.pendingMessages;\n this.pendingMessages = [];\n messages.forEach((message) => {\n this.send(message);\n });\n }\n\n private onClose() {\n this.removeAllEventListeners();\n this.reconnectIfNotDestroyed();\n this.notifySubscribers(WebsocketServiceEvent.CLOSE);\n }\n\n private onMessage(event: Event) {\n this.notifySubscribers(WebsocketServiceEvent.MESSAGE, event);\n }\n\n private onError(event: Event) {\n this.notifySubscribers(WebsocketServiceEvent.ERROR, event);\n }\n\n private notifySubscribers(subType: WebsocketServiceEvent, event?: Event) {\n this.subscriptions[subType].forEach((callback) => {\n callback(this, event);\n });\n }\n\n public send(data: WebsocketSendPayload) {\n if (this.socket?.readyState === WebSocket.OPEN) {\n this.socket.send(data);\n } else {\n this.pendingMessages.push(data);\n }\n }\n\n public sendEvent<E extends EventMessage<any, string | number>>(event: E) {\n this.send(JSON.stringify(event));\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './WebsocketService';\n"]}
|
package/lib/esm/tools/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC","sourcesContent":["export * from './timeAgo';\nexport * from './uniqueBy';\n"]}
|
package/lib/esm/tools/timeAgo.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeAgo.js","sourceRoot":"","sources":["../../../src/tools/timeAgo.ts"],"names":[],"mappings":"AAKA,uEAAuE;AACvE,MAAM,SAAS,GAAe;IAC5B,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IAC7B,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3B,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;IAClC,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,EAAE,MAAM,EAAE,MAAM,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE;CACpD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAE,MAAY,IAAI,IAAI,EAAE,EAAE,MAA0B,EAAU,EAAE;IACtG,oFAAoF;IACpF,4CAA4C;IAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,kBAAkB,CA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EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,kBAAkB;AAChD,CAAC,CAAC","sourcesContent":["type Division = {\n amount: number;\n unit: Intl.RelativeTimeFormatUnit;\n};\n\n// Each amount is \"how many of this unit make up one of the next unit\".\nconst DIVISIONS: Division[] = [\n { amount: 60, unit: 'seconds' },\n { amount: 60, unit: 'minutes' },\n { amount: 24, unit: 'hours' },\n { amount: 7, unit: 'days' },\n { amount: 4.34524, unit: 'weeks' },\n { amount: 12, unit: 'months' },\n { amount: Number.POSITIVE_INFINITY, unit: 'years' },\n];\n\n/**\n * Formats the distance between `date` and `now` as a relative phrase\n * (e.g. \"5 minutes ago\", \"in 2 hours\") using the native Intl.RelativeTimeFormat.\n * Past dates are negative, future dates are positive.\n */\nexport const formatTimeAgo = (date: Date, now: Date = new Date(), locale?: string | string[]): string => {\n // An invalid date (e.g. new Date('')) has a NaN time, which Intl.RelativeTimeFormat\n // rejects — guard so callers never have to.\n if (Number.isNaN(date.getTime())) {\n return '';\n }\n\n const formatter = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });\n\n // Seconds between the two dates; negative for the past.\n let duration = (date.getTime() - now.getTime()) / 1000;\n\n for (const division of DIVISIONS) {\n if (Math.abs(duration) < division.amount) {\n return formatter.format(Math.round(duration), division.unit);\n }\n duration /= division.amount;\n }\n\n return formatter.format(Math.round(duration), 'years');\n};\n\n/**\n * How long until the relative phrase could next change, so callers can\n * re-render no more often than necessary.\n */\nexport const getTimeAgoUpdateIntervalMs = (date: Date, now: Date = new Date()): number => {\n const seconds = Math.abs((date.getTime() - now.getTime()) / 1000);\n\n if (seconds < 60) {\n return 1000; // seconds tick over\n }\n if (seconds < 60 * 60) {\n return 60 * 1000; // minutes tick over\n }\n if (seconds < 60 * 60 * 24) {\n return 60 * 60 * 1000; // hours tick over\n }\n return 60 * 60 * 24 * 1000; // days or coarser\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniqueBy.js","sourceRoot":"","sources":["../../../src/tools/uniqueBy.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAI,KAAU,EAAE,KAAuB;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAO,CAAC;IAC5B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["export function uniqueBy<T>(array: T[], keyFn: (item: T) => any): T[] {\n const seen = new Set<any>();\n return array.filter((item) => {\n const key = keyFn(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"quidproquo-core": "0.1.
|
|
36
|
-
"quidproquo-tsconfig": "0.1.
|
|
37
|
-
"quidproquo-webserver": "0.1.
|
|
35
|
+
"quidproquo-core": "0.1.4",
|
|
36
|
+
"quidproquo-tsconfig": "0.1.4",
|
|
37
|
+
"quidproquo-webserver": "0.1.4",
|
|
38
38
|
"typescript": "^5.8.2"
|
|
39
39
|
}
|
|
40
40
|
}
|