@photon-os/sdk 0.5.1 → 1.0.0-alpha.1

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.
Files changed (65) hide show
  1. package/dist/index.d.mts +156 -0
  2. package/dist/index.d.ts +156 -0
  3. package/dist/index.js +1323 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +1313 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +41 -29
  8. package/lib/CoreServices/Apps/App.d.ts +0 -6
  9. package/lib/CoreServices/Apps/App.js +0 -9
  10. package/lib/CoreServices/Apps/AppRegistry.d.ts +0 -6
  11. package/lib/CoreServices/Apps/AppRegistry.js +0 -15
  12. package/lib/CoreServices/Apps/Launcher.d.ts +0 -5
  13. package/lib/CoreServices/Apps/Launcher.js +0 -9
  14. package/lib/CoreServices/Apps/PhotonApp.d.ts +0 -6
  15. package/lib/CoreServices/Apps/PhotonApp.js +0 -33
  16. package/lib/CoreServices/Apps/PhotonAppMode.d.ts +0 -5
  17. package/lib/CoreServices/Apps/PhotonAppMode.js +0 -8
  18. package/lib/CoreServices/Apps/UserPreferences.d.ts +0 -6
  19. package/lib/CoreServices/Apps/UserPreferences.js +0 -15
  20. package/lib/CoreServices/HomeBar.d.ts +0 -4
  21. package/lib/CoreServices/HomeBar.js +0 -8
  22. package/lib/CoreServices/StatusBar/StatusBar.d.ts +0 -8
  23. package/lib/CoreServices/StatusBar/StatusBar.js +0 -36
  24. package/lib/CoreServices/StatusBar/StatusBarContentType.d.ts +0 -5
  25. package/lib/CoreServices/StatusBar/StatusBarContentType.js +0 -8
  26. package/lib/SecondLife/PhotonTool.d.ts +0 -33
  27. package/lib/SecondLife/PhotonTool.js +0 -100
  28. package/lib/SecondLife/SecondLifeDevice.d.ts +0 -9
  29. package/lib/SecondLife/SecondLifeDevice.js +0 -12
  30. package/lib/SecondLife/SecondLifeIdentity.d.ts +0 -4
  31. package/lib/SecondLife/SecondLifeIdentity.js +0 -9
  32. package/lib/SecondLife/SecondLifeProxy.d.ts +0 -5
  33. package/lib/SecondLife/SecondLifeProxy.js +0 -8
  34. package/lib/SecondLife/SecondLifeRegistry.d.ts +0 -5
  35. package/lib/SecondLife/SecondLifeRegistry.js +0 -22
  36. package/lib/Sensor/Sensor.d.ts +0 -6
  37. package/lib/Sensor/Sensor.js +0 -31
  38. package/lib/Sensor/SensorResult.d.ts +0 -14
  39. package/lib/Sensor/SensorResult.js +0 -1
  40. package/lib/SystemEvents/EventManager.d.ts +0 -14
  41. package/lib/SystemEvents/EventManager.js +0 -38
  42. package/lib/SystemEvents/LifecycleEventNames.d.ts +0 -5
  43. package/lib/SystemEvents/LifecycleEventNames.js +0 -8
  44. package/lib/SystemEvents/LifecycleEvents.d.ts +0 -5
  45. package/lib/SystemEvents/LifecycleEvents.js +0 -18
  46. package/lib/SystemMessaging/BrowserMessageListener.d.ts +0 -11
  47. package/lib/SystemMessaging/BrowserMessageListener.js +0 -21
  48. package/lib/SystemMessaging/BrowserMessagingTarget.d.ts +0 -9
  49. package/lib/SystemMessaging/BrowserMessagingTarget.js +0 -13
  50. package/lib/SystemMessaging/IMessage.d.ts +0 -6
  51. package/lib/SystemMessaging/IMessage.js +0 -2
  52. package/lib/SystemMessaging/IMessageListener.d.ts +0 -9
  53. package/lib/SystemMessaging/IMessageListener.js +0 -2
  54. package/lib/SystemMessaging/IMessagingTarget.d.ts +0 -5
  55. package/lib/SystemMessaging/IMessagingTarget.js +0 -2
  56. package/lib/SystemMessaging/MessageBroker.d.ts +0 -30
  57. package/lib/SystemMessaging/MessageBroker.js +0 -147
  58. package/lib/SystemMessaging/SecondLIfeMessagingListener.d.ts +0 -14
  59. package/lib/SystemMessaging/SecondLIfeMessagingListener.js +0 -28
  60. package/lib/SystemMessaging/SecondLifeMessagingTarget.d.ts +0 -9
  61. package/lib/SystemMessaging/SecondLifeMessagingTarget.js +0 -13
  62. package/lib/SystemMessaging/VoidMessagingTarget.d.ts +0 -7
  63. package/lib/SystemMessaging/VoidMessagingTarget.js +0 -12
  64. package/lib/index.d.ts +0 -22
  65. package/lib/index.js +0 -46
@@ -0,0 +1,156 @@
1
+ type AppBundleId = string;
2
+ type AppDefinition = {
3
+ bundleId: AppBundleId;
4
+ name: string;
5
+ author: string;
6
+ url: string;
7
+ };
8
+ type RunningAppInstance = {
9
+ definition: AppDefinition;
10
+ startedAt: Date;
11
+ lastForegroundedAt: Date;
12
+ isInBackground: boolean;
13
+ };
14
+
15
+ /**
16
+ * Value types supported for preferences.
17
+ * Stored as JSONB in the database.
18
+ */
19
+ type PreferenceValue = string | number | boolean | null | PreferenceValue[] | {
20
+ [key: string]: PreferenceValue;
21
+ };
22
+
23
+ /**
24
+ * Represents a linked Second Life account visible to apps via the SDK.
25
+ */
26
+ type SecondLifeAccount = {
27
+ /** Second Life avatar UUID (key) */
28
+ avatarUuid: string;
29
+ /** Second Life avatar display name */
30
+ avatarName: string;
31
+ /** When the account was linked (ISO 8601 timestamp) */
32
+ linkedAt: string;
33
+ };
34
+
35
+ /**
36
+ * Represents the authenticated user visible to apps via the SDK.
37
+ * This is a read-only, minimal representation.
38
+ */
39
+ type PhotonUser = {
40
+ /** Unique user identifier */
41
+ id: string;
42
+ /** User's display name */
43
+ displayName: string;
44
+ };
45
+
46
+ type AppLaunchResult = {
47
+ launched: boolean;
48
+ error: Error | null;
49
+ app: AppDefinition;
50
+ };
51
+ type LinkingCode = {
52
+ code: string;
53
+ expiresAt: string;
54
+ };
55
+ type OperatingSystemAPI = {
56
+ system_homeButton: () => Promise<void>;
57
+ apps_getInstalledApps: () => Promise<AppDefinition[]>;
58
+ apps_launchApp: (app: AppDefinition) => Promise<AppLaunchResult>;
59
+ apps_foregroundApp: (app: AppDefinition) => Promise<void>;
60
+ apps_requestAppInstall: (app: AppDefinition) => Promise<void>;
61
+ apps_requestAppUninstall: (app: AppDefinition) => Promise<void>;
62
+ user_getCurrentUser: () => Promise<PhotonUser>;
63
+ prefs_getSandboxed: (key: string) => Promise<PreferenceValue>;
64
+ prefs_setSandboxed: (key: string, value: PreferenceValue) => Promise<void>;
65
+ prefs_deleteSandboxed: (key: string) => Promise<void>;
66
+ prefs_getShared: (key: string) => Promise<PreferenceValue>;
67
+ prefs_setShared: (key: string, value: PreferenceValue) => Promise<void>;
68
+ prefs_deleteShared: (key: string) => Promise<void>;
69
+ accounts_getLinkedSecondLifeAccounts: () => Promise<SecondLifeAccount[]>;
70
+ accounts_unlinkSecondLifeAccount: (avatarUuid: string) => Promise<void>;
71
+ accounts_generateLinkingCode: () => Promise<LinkingCode>;
72
+ };
73
+
74
+ declare class AccountManager {
75
+ private os;
76
+ constructor(os: OS);
77
+ /** Get all Second Life accounts linked to the current user */
78
+ getLinkedSecondLifeAccounts(): Promise<SecondLifeAccount[]>;
79
+ /** Unlink a Second Life account from the current user */
80
+ unlinkSecondLifeAccount(avatarUuid: string): Promise<void>;
81
+ /** Generate a linking code for connecting a Second Life account */
82
+ generateLinkingCode(): Promise<LinkingCode>;
83
+ }
84
+
85
+ declare class AppManager {
86
+ private os;
87
+ constructor(os: OS);
88
+ getInstalledApps(): Promise<AppDefinition[]>;
89
+ launchApp(app: AppDefinition): Promise<AppLaunchResult>;
90
+ requestAppInstall(app: AppDefinition): Promise<void>;
91
+ requestAppUninstall(app: AppDefinition): Promise<void>;
92
+ }
93
+
94
+ /**
95
+ * Manages user preferences for apps.
96
+ *
97
+ * Sandboxed methods (get, set, delete) store preferences scoped to the calling app.
98
+ * Shared methods (getShared, setShared, deleteShared) store preferences accessible by all apps.
99
+ */
100
+ declare class PreferencesManager {
101
+ private os;
102
+ constructor(os: OS);
103
+ /**
104
+ * Get a sandboxed preference value (app-specific).
105
+ * Only accessible by the app that set it.
106
+ */
107
+ get(key: string): Promise<PreferenceValue>;
108
+ /**
109
+ * Set a sandboxed preference value (app-specific).
110
+ * Only accessible by the app that set it.
111
+ */
112
+ set(key: string, value: PreferenceValue): Promise<void>;
113
+ /**
114
+ * Delete a sandboxed preference (app-specific).
115
+ */
116
+ delete(key: string): Promise<void>;
117
+ /**
118
+ * Get a shared preference value.
119
+ * Accessible by all apps.
120
+ */
121
+ getShared(key: string): Promise<PreferenceValue>;
122
+ /**
123
+ * Set a shared preference value.
124
+ * Accessible by all apps.
125
+ */
126
+ setShared(key: string, value: PreferenceValue): Promise<void>;
127
+ /**
128
+ * Delete a shared preference.
129
+ */
130
+ deleteShared(key: string): Promise<void>;
131
+ }
132
+
133
+ declare class UserManager {
134
+ private os;
135
+ constructor(os: OS);
136
+ /** Get the current authenticated user */
137
+ getCurrentUser(): Promise<PhotonUser>;
138
+ }
139
+
140
+ type OSConfig = {
141
+ target: Window;
142
+ };
143
+ declare class OS {
144
+ accounts: AccountManager;
145
+ apps: AppManager;
146
+ prefs: PreferencesManager;
147
+ user: UserManager;
148
+ private config;
149
+ constructor(config?: OSConfig);
150
+ homeButton(): Promise<void>;
151
+ getRPCAPI(): Promise<OperatingSystemAPI>;
152
+ }
153
+
154
+ declare const VERSION = "1.0.0";
155
+
156
+ export { type AppBundleId, type AppDefinition, type AppLaunchResult, type LinkingCode, OS, type OSConfig, type OperatingSystemAPI, type PhotonUser, type PreferenceValue, type RunningAppInstance, type SecondLifeAccount, VERSION };
@@ -0,0 +1,156 @@
1
+ type AppBundleId = string;
2
+ type AppDefinition = {
3
+ bundleId: AppBundleId;
4
+ name: string;
5
+ author: string;
6
+ url: string;
7
+ };
8
+ type RunningAppInstance = {
9
+ definition: AppDefinition;
10
+ startedAt: Date;
11
+ lastForegroundedAt: Date;
12
+ isInBackground: boolean;
13
+ };
14
+
15
+ /**
16
+ * Value types supported for preferences.
17
+ * Stored as JSONB in the database.
18
+ */
19
+ type PreferenceValue = string | number | boolean | null | PreferenceValue[] | {
20
+ [key: string]: PreferenceValue;
21
+ };
22
+
23
+ /**
24
+ * Represents a linked Second Life account visible to apps via the SDK.
25
+ */
26
+ type SecondLifeAccount = {
27
+ /** Second Life avatar UUID (key) */
28
+ avatarUuid: string;
29
+ /** Second Life avatar display name */
30
+ avatarName: string;
31
+ /** When the account was linked (ISO 8601 timestamp) */
32
+ linkedAt: string;
33
+ };
34
+
35
+ /**
36
+ * Represents the authenticated user visible to apps via the SDK.
37
+ * This is a read-only, minimal representation.
38
+ */
39
+ type PhotonUser = {
40
+ /** Unique user identifier */
41
+ id: string;
42
+ /** User's display name */
43
+ displayName: string;
44
+ };
45
+
46
+ type AppLaunchResult = {
47
+ launched: boolean;
48
+ error: Error | null;
49
+ app: AppDefinition;
50
+ };
51
+ type LinkingCode = {
52
+ code: string;
53
+ expiresAt: string;
54
+ };
55
+ type OperatingSystemAPI = {
56
+ system_homeButton: () => Promise<void>;
57
+ apps_getInstalledApps: () => Promise<AppDefinition[]>;
58
+ apps_launchApp: (app: AppDefinition) => Promise<AppLaunchResult>;
59
+ apps_foregroundApp: (app: AppDefinition) => Promise<void>;
60
+ apps_requestAppInstall: (app: AppDefinition) => Promise<void>;
61
+ apps_requestAppUninstall: (app: AppDefinition) => Promise<void>;
62
+ user_getCurrentUser: () => Promise<PhotonUser>;
63
+ prefs_getSandboxed: (key: string) => Promise<PreferenceValue>;
64
+ prefs_setSandboxed: (key: string, value: PreferenceValue) => Promise<void>;
65
+ prefs_deleteSandboxed: (key: string) => Promise<void>;
66
+ prefs_getShared: (key: string) => Promise<PreferenceValue>;
67
+ prefs_setShared: (key: string, value: PreferenceValue) => Promise<void>;
68
+ prefs_deleteShared: (key: string) => Promise<void>;
69
+ accounts_getLinkedSecondLifeAccounts: () => Promise<SecondLifeAccount[]>;
70
+ accounts_unlinkSecondLifeAccount: (avatarUuid: string) => Promise<void>;
71
+ accounts_generateLinkingCode: () => Promise<LinkingCode>;
72
+ };
73
+
74
+ declare class AccountManager {
75
+ private os;
76
+ constructor(os: OS);
77
+ /** Get all Second Life accounts linked to the current user */
78
+ getLinkedSecondLifeAccounts(): Promise<SecondLifeAccount[]>;
79
+ /** Unlink a Second Life account from the current user */
80
+ unlinkSecondLifeAccount(avatarUuid: string): Promise<void>;
81
+ /** Generate a linking code for connecting a Second Life account */
82
+ generateLinkingCode(): Promise<LinkingCode>;
83
+ }
84
+
85
+ declare class AppManager {
86
+ private os;
87
+ constructor(os: OS);
88
+ getInstalledApps(): Promise<AppDefinition[]>;
89
+ launchApp(app: AppDefinition): Promise<AppLaunchResult>;
90
+ requestAppInstall(app: AppDefinition): Promise<void>;
91
+ requestAppUninstall(app: AppDefinition): Promise<void>;
92
+ }
93
+
94
+ /**
95
+ * Manages user preferences for apps.
96
+ *
97
+ * Sandboxed methods (get, set, delete) store preferences scoped to the calling app.
98
+ * Shared methods (getShared, setShared, deleteShared) store preferences accessible by all apps.
99
+ */
100
+ declare class PreferencesManager {
101
+ private os;
102
+ constructor(os: OS);
103
+ /**
104
+ * Get a sandboxed preference value (app-specific).
105
+ * Only accessible by the app that set it.
106
+ */
107
+ get(key: string): Promise<PreferenceValue>;
108
+ /**
109
+ * Set a sandboxed preference value (app-specific).
110
+ * Only accessible by the app that set it.
111
+ */
112
+ set(key: string, value: PreferenceValue): Promise<void>;
113
+ /**
114
+ * Delete a sandboxed preference (app-specific).
115
+ */
116
+ delete(key: string): Promise<void>;
117
+ /**
118
+ * Get a shared preference value.
119
+ * Accessible by all apps.
120
+ */
121
+ getShared(key: string): Promise<PreferenceValue>;
122
+ /**
123
+ * Set a shared preference value.
124
+ * Accessible by all apps.
125
+ */
126
+ setShared(key: string, value: PreferenceValue): Promise<void>;
127
+ /**
128
+ * Delete a shared preference.
129
+ */
130
+ deleteShared(key: string): Promise<void>;
131
+ }
132
+
133
+ declare class UserManager {
134
+ private os;
135
+ constructor(os: OS);
136
+ /** Get the current authenticated user */
137
+ getCurrentUser(): Promise<PhotonUser>;
138
+ }
139
+
140
+ type OSConfig = {
141
+ target: Window;
142
+ };
143
+ declare class OS {
144
+ accounts: AccountManager;
145
+ apps: AppManager;
146
+ prefs: PreferencesManager;
147
+ user: UserManager;
148
+ private config;
149
+ constructor(config?: OSConfig);
150
+ homeButton(): Promise<void>;
151
+ getRPCAPI(): Promise<OperatingSystemAPI>;
152
+ }
153
+
154
+ declare const VERSION = "1.0.0";
155
+
156
+ export { type AppBundleId, type AppDefinition, type AppLaunchResult, type LinkingCode, OS, type OSConfig, type OperatingSystemAPI, type PhotonUser, type PreferenceValue, type RunningAppInstance, type SecondLifeAccount, VERSION };