@sneat/core 0.24.0 → 0.25.0
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/esm2022/lib/app.service.js +3 -2
- package/esm2022/lib/app.service.js.map +1 -1
- package/esm2022/lib/current-space-storage.js +11 -4
- package/esm2022/lib/current-space-storage.js.map +1 -1
- package/esm2022/lib/team-type.js +24 -0
- package/esm2022/lib/team-type.js.map +1 -1
- package/lib/app.service.d.ts +1 -9
- package/lib/team-type.d.ts +7 -1
- package/package.json +7 -2
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Compatibility export: the runtime token lives in the physically public
|
|
2
|
+
// package so public bootstrap consumers do not import the broad core barrel.
|
|
3
|
+
export { APP_INFO } from '@sneat/core-public';
|
|
3
4
|
//# sourceMappingURL=app.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/app.service.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/app.service.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,OAAO,EAAE,QAAQ,EAAgC,MAAM,oBAAoB,CAAC","sourcesContent":["// Compatibility export: the runtime token lives in the physically public\n// package so public bootstrap consumers do not import the broad core barrel.\nexport { APP_INFO, type IAppInfo, type SneatApp } from '@sneat/core-public';\n"]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { parseSpaceType } from './team-type';
|
|
1
2
|
const CURRENT_SPACE_STORAGE_KEY = 'sneat.currentSpace';
|
|
2
3
|
/** Persists the user's current space so it can be restored after login. */
|
|
3
4
|
export function writeCurrentSpace(space) {
|
|
4
|
-
|
|
5
|
+
const type = parseSpaceType(space.type);
|
|
6
|
+
if (!space.id || !type) {
|
|
5
7
|
return;
|
|
6
8
|
}
|
|
7
9
|
try {
|
|
8
|
-
localStorage.setItem(CURRENT_SPACE_STORAGE_KEY, JSON.stringify({ id: space.id, type
|
|
10
|
+
localStorage.setItem(CURRENT_SPACE_STORAGE_KEY, JSON.stringify({ id: space.id, type }));
|
|
9
11
|
}
|
|
10
12
|
catch {
|
|
11
13
|
// Ignore storage errors (e.g. disabled/full storage in private mode).
|
|
@@ -28,8 +30,13 @@ export function readCurrentSpace() {
|
|
|
28
30
|
return undefined;
|
|
29
31
|
}
|
|
30
32
|
const parsed = JSON.parse(value);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const { id, type } = parsed;
|
|
37
|
+
const parsedType = parseSpaceType(type);
|
|
38
|
+
return typeof id === 'string' && id && parsedType
|
|
39
|
+
? { id, type: parsedType }
|
|
33
40
|
: undefined;
|
|
34
41
|
}
|
|
35
42
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-space-storage.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/current-space-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"current-space-storage.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/current-space-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,KAAgB;IAChD,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,YAAY,CAAC,OAAO,CAClB,yBAAyB,EACzB,IAAI,CAAC,SAAS,CAAC,E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AAChE,CAAC","sourcesContent":["import { ISpaceRef } from './interfaces';\nimport { parseSpaceType } from './team-type';\n\nconst CURRENT_SPACE_STORAGE_KEY = 'sneat.currentSpace';\n\n/** Persists the user's current space so it can be restored after login. */\nexport function writeCurrentSpace(space: ISpaceRef): void {\n const type = parseSpaceType(space.type);\n if (!space.id || !type) {\n return;\n }\n try {\n localStorage.setItem(\n CURRENT_SPACE_STORAGE_KEY,\n JSON.stringify({ id: space.id, type }),\n );\n } catch {\n // Ignore storage errors (e.g. disabled/full storage in private mode).\n }\n}\n\n/** Clears the persisted current space (e.g. when the user leaves all spaces). */\nexport function clearCurrentSpace(): void {\n try {\n localStorage.removeItem(CURRENT_SPACE_STORAGE_KEY);\n } catch {\n // Ignore storage errors (e.g. disabled storage in private mode).\n }\n}\n\n/** Reads the persisted current space, or undefined when none/invalid. */\nexport function readCurrentSpace(): ISpaceRef | undefined {\n try {\n const value = localStorage.getItem(CURRENT_SPACE_STORAGE_KEY);\n if (!value) {\n return undefined;\n }\n const parsed: unknown = JSON.parse(value);\n if (!parsed || typeof parsed !== 'object') {\n return undefined;\n }\n const { id, type } = parsed as Record<string, unknown>;\n const parsedType = parseSpaceType(type);\n return typeof id === 'string' && id && parsedType\n ? { id, type: parsedType }\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Router path for the persisted current space, or undefined when none. */\nexport function currentSpacePath(): string | undefined {\n const space = readCurrentSpace();\n return space ? `/space/${space.type}/${space.id}` : undefined;\n}\n"]}
|
package/esm2022/lib/team-type.js
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
export const SpaceTypeFamily = 'family';
|
|
2
2
|
export const SpaceTypePersonal = 'personal';
|
|
3
|
+
export const SpaceTypeGroup = 'group';
|
|
4
|
+
// A restricted-visibility space type may be introduced later if a real use
|
|
5
|
+
// case arises; it was intentionally left out to avoid confusion with 'personal'.
|
|
6
|
+
const concreteSpaceTypes = new Set([
|
|
7
|
+
SpaceTypeFamily,
|
|
8
|
+
SpaceTypePersonal,
|
|
9
|
+
SpaceTypeGroup,
|
|
10
|
+
'company',
|
|
11
|
+
'team',
|
|
12
|
+
'parish',
|
|
13
|
+
'educator',
|
|
14
|
+
'realtor',
|
|
15
|
+
'sport_club',
|
|
16
|
+
'cohabit',
|
|
17
|
+
]);
|
|
18
|
+
/** Returns whether a value is a concrete space type accepted at an external boundary. */
|
|
19
|
+
export function isSpaceType(value) {
|
|
20
|
+
return (typeof value === 'string' &&
|
|
21
|
+
concreteSpaceTypes.has(value));
|
|
22
|
+
}
|
|
23
|
+
/** Parses a concrete space type from untyped external input. */
|
|
24
|
+
export function parseSpaceType(value) {
|
|
25
|
+
return isSpaceType(value) ? value : undefined;
|
|
26
|
+
}
|
|
3
27
|
//# sourceMappingURL=team-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team-type.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/team-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"team-type.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/team-type.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,2EAA2E;AAC3E,iFAAiF;AACjF,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAgC;IAChE,eAAe;IACf,iBAAiB;IACjB,cAAc;IACd,SAAS;IACT,MAAM;IACN,QAAQ;IACR,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;CACV,CAAC,CAAC;AAEH,yFAAyF;AACzF,MAAM,UAAU,WAAW,CACzB,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,kBAAkB,CAAC,GAAG,CAAC,KAAsC,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC","sourcesContent":["import { SpaceType } from '@sneat/core-public';\n\nexport type { SpaceType } from '@sneat/core-public';\n\nexport const SpaceTypeFamily = 'family';\nexport const SpaceTypePersonal = 'personal';\nexport const SpaceTypeGroup = 'group';\n\n// A restricted-visibility space type may be introduced later if a real use\n// case arises; it was intentionally left out to avoid confusion with 'personal'.\nconst concreteSpaceTypes = new Set<Exclude<SpaceType, 'unknown'>>([\n SpaceTypeFamily,\n SpaceTypePersonal,\n SpaceTypeGroup,\n 'company',\n 'team',\n 'parish',\n 'educator',\n 'realtor',\n 'sport_club',\n 'cohabit',\n]);\n\n/** Returns whether a value is a concrete space type accepted at an external boundary. */\nexport function isSpaceType(\n value: unknown,\n): value is Exclude<SpaceType, 'unknown'> {\n return (\n typeof value === 'string' &&\n concreteSpaceTypes.has(value as Exclude<SpaceType, 'unknown'>)\n );\n}\n\n/** Parses a concrete space type from untyped external input. */\nexport function parseSpaceType(value: unknown): Exclude<SpaceType, 'unknown'> | undefined {\n return isSpaceType(value) ? value : undefined;\n}\n"]}
|
package/lib/app.service.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SpaceType } from './team-type';
|
|
3
|
-
export type SneatApp = 'sneat' | 'aaproject' | 'agendum' | 'budgetus' | 'class' | 'contactus' | 'creche' | 'debtus' | 'docus' | 'dream7' | 'eventus' | 'feis' | 'gameboard' | 'logist' | 'listus' | 'neighbours' | 'parish' | 'renterra' | 'rsvp' | 'sizeus' | 'splitus' | 'sportclubs' | 'template' | 'tournament' | 'trackus' | 'datatug' | 'motorius' | 'yachtius' | (string & {});
|
|
4
|
-
export interface IAppInfo {
|
|
5
|
-
readonly appId: SneatApp;
|
|
6
|
-
readonly appTitle: string;
|
|
7
|
-
readonly requiredSpaceType?: SpaceType;
|
|
8
|
-
}
|
|
9
|
-
export declare const APP_INFO: InjectionToken<IAppInfo>;
|
|
1
|
+
export { APP_INFO, type IAppInfo, type SneatApp } from '@sneat/core-public';
|
package/lib/team-type.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { SpaceType } from '@sneat/core-public';
|
|
2
|
+
export type { SpaceType } from '@sneat/core-public';
|
|
1
3
|
export declare const SpaceTypeFamily = "family";
|
|
2
4
|
export declare const SpaceTypePersonal = "personal";
|
|
3
|
-
export
|
|
5
|
+
export declare const SpaceTypeGroup = "group";
|
|
6
|
+
/** Returns whether a value is a concrete space type accepted at an external boundary. */
|
|
7
|
+
export declare function isSpaceType(value: unknown): value is Exclude<SpaceType, 'unknown'>;
|
|
8
|
+
/** Parses a concrete space type from untyped external input. */
|
|
9
|
+
export declare function parseSpaceType(value: unknown): Exclude<SpaceType, 'unknown'> | undefined;
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sneat/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
+
"@angular/animations": ">=21.0.0",
|
|
8
9
|
"@angular/common": ">=21.0.0",
|
|
9
|
-
"@angular/core": ">=21.0.0"
|
|
10
|
+
"@angular/core": ">=21.0.0",
|
|
11
|
+
"@angular/router": ">=21.0.0",
|
|
12
|
+
"@ionic/angular": ">=8.0.0",
|
|
13
|
+
"@sneat/core-public": "^0.25.0",
|
|
14
|
+
"rxjs": ">=7.8.0"
|
|
10
15
|
},
|
|
11
16
|
"dependencies": {
|
|
12
17
|
"tslib": "2.8.1"
|