@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.
@@ -1,3 +1,4 @@
1
- import { InjectionToken } from '@angular/core';
2
- export const APP_INFO = new InjectionToken('app_info');
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,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAoD/C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAW,UAAU,CAAC,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { SpaceType } from './team-type';\n\n// Sneat app identifier. The type is intentionally OPEN: third-party / niche\n// apps can use their own appId without being enumerated here (the `string & {}`\n// arm accepts any string). The explicit first-party literals are kept only for\n// editor autocomplete and documentation — `string & {}` preserves those\n// suggestions while still accepting arbitrary strings (plain `| string` would\n// collapse the whole union to `string` and drop the autocomplete).\nexport type SneatApp =\n | 'sneat'\n | 'aaproject'\n | 'agendum'\n | 'budgetus'\n | 'class'\n | 'contactus'\n | 'creche'\n | 'debtus'\n | 'docus'\n | 'dream7'\n | 'eventus'\n | 'feis'\n | 'gameboard'\n | 'logist'\n | 'listus'\n | 'neighbours'\n | 'parish'\n | 'renterra'\n | 'rsvp'\n // 'sizeus' was previously registered as 'sizechart'; the legacy literal is\n // still accepted via the open `string & {}` arm below, so the rename is\n // non-breaking for any caller that still passes 'sizechart'.\n | 'sizeus'\n | 'splitus'\n | 'sportclubs'\n | 'template'\n | 'tournament'\n | 'trackus'\n | 'datatug'\n | 'motorius'\n | 'yachtius'\n // Open arm: accept any appId (e.g. third-party apps) while keeping the\n // literal suggestions above. Do not remove — this is what makes the union\n // extensible without a platform release per new app.\n | (string & {});\n\nexport interface IAppInfo {\n readonly appId: SneatApp;\n readonly appTitle: string;\n readonly requiredSpaceType?: SpaceType;\n}\n\nexport const APP_INFO = new InjectionToken<IAppInfo>('app_info');\n"]}
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
- if (!space.id || !space.type) {
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: space.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
- return parsed.id && parsed.type
32
- ? { id: parsed.id, type: parsed.type }
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":["../../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B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC","sourcesContent":["import { ISpaceRef } from './interfaces';\nimport { SpaceType } 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 if (!space.id || !space.type) {\n return;\n }\n try {\n localStorage.setItem(\n CURRENT_SPACE_STORAGE_KEY,\n JSON.stringify({ id: space.id, type: space.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 = JSON.parse(value) as Partial<ISpaceRef>;\n return parsed.id && parsed.type\n ? { id: parsed.id, type: parsed.type as SpaceType }\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"]}
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,KAAg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,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;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"]}
@@ -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":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC","sourcesContent":["export const SpaceTypeFamily = 'family';\nexport const SpaceTypePersonal = 'personal';\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'.\nexport type SpaceType =\n | 'family'\n | 'personal'\n | 'company'\n | 'team'\n | 'parish'\n | 'educator'\n | 'realtor'\n | 'sport_club'\n | 'cohabit'\n | 'unknown';\n"]}
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"]}
@@ -1,9 +1 @@
1
- import { InjectionToken } from '@angular/core';
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';
@@ -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 type SpaceType = 'family' | 'personal' | 'company' | 'team' | 'parish' | 'educator' | 'realtor' | 'sport_club' | 'cohabit' | 'unknown';
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.24.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"