mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
Merge pull request #1318 from XiaochenCui/xiaochen/dev
dev: extension prefix update, doc helper & docs update
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,65 +1,14 @@
|
||||
### `core.email.validate`
|
||||
|
||||
This event is emitted when an email is being validated.
|
||||
The event can be used to block certain emails from being validated.
|
||||
|
||||
#### Property `email`
|
||||
|
||||
the email being validated
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
- The email may have already been cleaned.
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the email is allowed
|
||||
- **Type**: boolean
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
- If set to false, the email will be considered invalid.
|
||||
|
||||
### `core.request.measured`
|
||||
|
||||
This event is emitted when a requests incoming and outgoing bytes
|
||||
have been measured.
|
||||
|
||||
#### Example
|
||||
|
||||
```javascript
|
||||
extension.on('core.request.measured', data => {
|
||||
const measurements = data.measurements;
|
||||
// measurements = { sz_incoming: integer, sz_outgoing: integer }
|
||||
|
||||
const actor = data.actor; // instance of Actor
|
||||
|
||||
console.log('\x1B[36;1m === MEASUREMENT ===\x1B[0m\n', {
|
||||
actor: data.actor.uid,
|
||||
measurements: data.measurements
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### `core.fs.create.directory`
|
||||
|
||||
This event is emitted when a directory is created.
|
||||
|
||||
#### Property `node`
|
||||
|
||||
the directory that was created
|
||||
- **Type**: FSNodeContext
|
||||
- **Mutability**: no-effect
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
- **Type**: Context
|
||||
- **Mutability**: no-effect
|
||||
|
||||
### `core.ai.prompt.check-usage`
|
||||
### `ai.prompt.check-usage`
|
||||
|
||||
This event is emitted for ai prompt check usage operations.
|
||||
|
||||
#### Property `completionId`
|
||||
|
||||
completionId
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the operation is allowed
|
||||
@@ -81,17 +30,11 @@ parameters
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
### `core.ai.prompt.complete`
|
||||
|
||||
### `ai.prompt.complete`
|
||||
|
||||
This event is emitted for ai prompt complete operations.
|
||||
|
||||
#### Property `username`
|
||||
|
||||
username
|
||||
- **Type**: string
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `intended_service`
|
||||
|
||||
intended service
|
||||
@@ -128,16 +71,28 @@ service used
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.ai.prompt.report-usage`
|
||||
### `ai.prompt.cost-calculated`
|
||||
|
||||
This event is emitted for ai prompt cost calculated operations.
|
||||
|
||||
|
||||
### `ai.prompt.report-usage`
|
||||
|
||||
This event is emitted for ai prompt report usage operations.
|
||||
|
||||
|
||||
### `core.ai.prompt.validate`
|
||||
### `ai.prompt.validate`
|
||||
|
||||
This event is emitted when a validate is being validated.
|
||||
The event can be used to block certain validates from being validated.
|
||||
|
||||
#### Property `completionId`
|
||||
|
||||
completionId
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the operation is allowed
|
||||
@@ -161,17 +116,10 @@ parameters
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.app.new-icon`
|
||||
### `app.new-icon`
|
||||
|
||||
This event is emitted for app new icon operations.
|
||||
|
||||
#### Property `app_uid`
|
||||
|
||||
app uid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `data_url`
|
||||
|
||||
data url
|
||||
@@ -180,17 +128,10 @@ data url
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.app.rename`
|
||||
### `app.rename`
|
||||
|
||||
This event is emitted for app rename operations.
|
||||
|
||||
#### Property `app_uid`
|
||||
|
||||
app uid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `data_url`
|
||||
|
||||
data url
|
||||
@@ -199,18 +140,11 @@ data url
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.apps.invalidate`
|
||||
### `apps.invalidate`
|
||||
|
||||
This event is emitted when a invalidate is being validated.
|
||||
The event can be used to block certain invalidates from being validated.
|
||||
|
||||
#### Property `options`
|
||||
|
||||
options
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `apps`
|
||||
|
||||
apps
|
||||
@@ -218,17 +152,180 @@ apps
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
### `core.fs.create.file`
|
||||
|
||||
This event is emitted when a file is created.
|
||||
### `captcha.check`
|
||||
|
||||
This event is emitted for captcha check operations.
|
||||
|
||||
#### Property `required`
|
||||
|
||||
required
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.email.validate`
|
||||
|
||||
This event is emitted when an email is being validated.
|
||||
The event can be used to block certain emails from being validated.
|
||||
|
||||
#### Property `email`
|
||||
|
||||
the email being validated
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
- The email may have already been cleaned.
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the email is allowed
|
||||
- **Type**: boolean
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
- If set to false, the email will be considered invalid.
|
||||
|
||||
|
||||
### `core.fs.create.directory`
|
||||
|
||||
This event is emitted when a directory is created.
|
||||
|
||||
#### Property `node`
|
||||
|
||||
the file that was affected
|
||||
the directory that was created
|
||||
- **Type**: FSNodeContext
|
||||
- **Mutability**: no-effect
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
- **Type**: Context
|
||||
- **Mutability**: no-effect
|
||||
|
||||
|
||||
### `core.request.measured`
|
||||
|
||||
This event is emitted when a requests incoming and outgoing bytes
|
||||
have been measured.
|
||||
|
||||
#### Example
|
||||
|
||||
```javascript
|
||||
extension.on('core.request.measured', data => {
|
||||
const measurements = data.measurements;
|
||||
// measurements = { sz_incoming: integer, sz_outgoing: integer }
|
||||
|
||||
const actor = data.actor; // instance of Actor
|
||||
|
||||
console.log('[36;1m === MEASUREMENT ===[0m
|
||||
', {
|
||||
actor: data.actor.uid,
|
||||
measurements: data.measurements
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### `credit.check-available`
|
||||
|
||||
This event is emitted for credit check available operations.
|
||||
|
||||
#### Property `available`
|
||||
|
||||
available
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `cost_uuid`
|
||||
|
||||
cost uuid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `credit.funding-update`
|
||||
|
||||
This event is emitted when a funding-update is updated.
|
||||
|
||||
#### Property `available`
|
||||
|
||||
available
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `cost_uuid`
|
||||
|
||||
cost uuid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `credit.record-cost`
|
||||
|
||||
This event is emitted for credit record cost operations.
|
||||
|
||||
#### Property `available`
|
||||
|
||||
available
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `cost_uuid`
|
||||
|
||||
cost uuid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `driver.create-call-context`
|
||||
|
||||
This event is emitted when a create-call-context is created.
|
||||
|
||||
#### Property `usages`
|
||||
|
||||
usages
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `email.validate`
|
||||
|
||||
This event is emitted when a validate is being validated.
|
||||
The event can be used to block certain validates from being validated.
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the operation is allowed
|
||||
- **Type**: boolean
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
- If set to false, the email will be considered invalid.
|
||||
|
||||
#### Property `email`
|
||||
|
||||
email
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
- The email may have already been cleaned.
|
||||
|
||||
|
||||
### `fs.create.directory`
|
||||
|
||||
This event is emitted when a directory is created.
|
||||
|
||||
|
||||
### `fs.create.file`
|
||||
|
||||
This event is emitted when a file is created.
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
@@ -237,27 +334,20 @@ current context
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.fs.create.shortcut`
|
||||
### `fs.create.shortcut`
|
||||
|
||||
This event is emitted when a shortcut is created.
|
||||
|
||||
|
||||
### `core.fs.create.symlink`
|
||||
### `fs.create.symlink`
|
||||
|
||||
This event is emitted when a symlink is created.
|
||||
|
||||
|
||||
### `core.fs.move.file`
|
||||
### `fs.move.file`
|
||||
|
||||
This event is emitted for fs move file operations.
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
- **Type**: Context
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `moved`
|
||||
|
||||
moved
|
||||
@@ -273,22 +363,15 @@ path to the affected resource
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.fs.pending.file`
|
||||
### `fs.pending.file`
|
||||
|
||||
This event is emitted for fs pending file operations.
|
||||
|
||||
|
||||
### `core.fs.storage.progress.copy`
|
||||
### `fs.storage.progress.copy`
|
||||
|
||||
This event reports progress of a copy operation.
|
||||
|
||||
#### Property `upload_tracker`
|
||||
|
||||
tracks progress of the operation
|
||||
- **Type**: ProgressTracker
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
@@ -311,22 +394,15 @@ path to the affected resource
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.fs.storage.upload-progress`
|
||||
### `fs.storage.upload-progress`
|
||||
|
||||
This event reports progress of a upload-progress operation.
|
||||
|
||||
|
||||
### `core.fs.write.file`
|
||||
### `fs.write.file`
|
||||
|
||||
This event is emitted when a file is updated.
|
||||
|
||||
#### Property `node`
|
||||
|
||||
the file that was affected
|
||||
- **Type**: FSNodeContext
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `context`
|
||||
|
||||
current context
|
||||
@@ -335,38 +411,37 @@ current context
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.ip.validate`
|
||||
### `ip.validate`
|
||||
|
||||
This event is emitted when a validate is being validated.
|
||||
The event can be used to block certain validates from being validated.
|
||||
|
||||
#### Property `allow`
|
||||
#### Property `res`
|
||||
|
||||
whether the operation is allowed
|
||||
- **Type**: boolean
|
||||
res
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
- If set to false, the ip will be considered invalid.
|
||||
|
||||
#### Property `ip`
|
||||
#### Property `end_`
|
||||
|
||||
ip
|
||||
end
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `end`
|
||||
|
||||
end
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.fs.write-hash`
|
||||
### `outer.fs.write-hash`
|
||||
|
||||
This event is emitted when a write-hash is updated.
|
||||
|
||||
#### Property `hash`
|
||||
|
||||
hash
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `uuid`
|
||||
|
||||
uuid
|
||||
@@ -375,17 +450,10 @@ uuid
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.item.added`
|
||||
### `outer.gui.item.added`
|
||||
|
||||
This event is emitted for outer gui item added operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -394,17 +462,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.item.moved`
|
||||
### `outer.gui.item.moved`
|
||||
|
||||
This event is emitted for outer gui item moved operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -413,17 +474,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.item.pending`
|
||||
### `outer.gui.item.pending`
|
||||
|
||||
This event is emitted for outer gui item pending operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -432,17 +486,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.item.updated`
|
||||
### `outer.gui.item.updated`
|
||||
|
||||
This event is emitted when a updated is updated.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -451,17 +498,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.notif.ack`
|
||||
### `outer.gui.notif.ack`
|
||||
|
||||
This event is emitted for outer gui notif ack operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -470,17 +510,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.notif.message`
|
||||
### `outer.gui.notif.message`
|
||||
|
||||
This event is emitted for outer gui notif message operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -496,17 +529,10 @@ notification
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.notif.persisted`
|
||||
### `outer.gui.notif.persisted`
|
||||
|
||||
This event is emitted for outer gui notif persisted operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -515,17 +541,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.notif.unreads`
|
||||
### `outer.gui.notif.unreads`
|
||||
|
||||
This event is emitted for outer gui notif unreads operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -534,17 +553,10 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.outer.gui.submission.done`
|
||||
### `outer.gui.submission.done`
|
||||
|
||||
This event is emitted for outer gui submission done operations.
|
||||
|
||||
#### Property `user_id_list`
|
||||
|
||||
user id list
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `response`
|
||||
|
||||
response
|
||||
@@ -553,11 +565,109 @@ response
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.puter-exec.submission.done`
|
||||
### `outer.gui.usage.update`
|
||||
|
||||
This event is emitted for puter-exec submission done operations.
|
||||
This event is emitted when a update is updated.
|
||||
|
||||
### `core.sns`
|
||||
|
||||
### `outer.thread.notify-subscribers`
|
||||
|
||||
This event is emitted for outer thread notify subscribers operations.
|
||||
|
||||
#### Property `uid`
|
||||
|
||||
uid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `action`
|
||||
|
||||
action
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `data`
|
||||
|
||||
data
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `puter.signup`
|
||||
|
||||
This event is emitted for puter signup operations.
|
||||
|
||||
#### Property `ip`
|
||||
|
||||
ip
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `user_agent`
|
||||
|
||||
user agent
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `body`
|
||||
|
||||
body
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `request.measured`
|
||||
|
||||
This event is emitted for request measured operations.
|
||||
|
||||
#### Property `req`
|
||||
|
||||
req
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `res`
|
||||
|
||||
res
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `request.will-be-handled`
|
||||
|
||||
This event is emitted for request will be handled operations.
|
||||
|
||||
#### Property `res`
|
||||
|
||||
res
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `end_`
|
||||
|
||||
end
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `end`
|
||||
|
||||
end
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `sns`
|
||||
|
||||
This event is emitted for sns operations.
|
||||
|
||||
@@ -569,29 +679,15 @@ message
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.template-service.hello`
|
||||
### `template-service.hello`
|
||||
|
||||
This event is emitted for template-service hello operations.
|
||||
|
||||
#### Property `message`
|
||||
|
||||
message
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.usages.query`
|
||||
### `usages.query`
|
||||
|
||||
This event is emitted for usages query operations.
|
||||
|
||||
#### Property `actor`
|
||||
|
||||
actor
|
||||
- **Type**: any
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `usages`
|
||||
|
||||
usages
|
||||
@@ -600,17 +696,10 @@ usages
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.user.email-changed`
|
||||
### `user.email-changed`
|
||||
|
||||
This event is emitted for user email changed operations.
|
||||
|
||||
#### Property `user_id`
|
||||
|
||||
user id
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `new_email`
|
||||
|
||||
new email
|
||||
@@ -619,17 +708,10 @@ new email
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.user.email-confirmed`
|
||||
### `user.email-confirmed`
|
||||
|
||||
This event is emitted for user email confirmed operations.
|
||||
|
||||
#### Property `user_uid`
|
||||
|
||||
user uid
|
||||
- **Type**: string
|
||||
- **Mutability**: no-effect
|
||||
- **Notes**:
|
||||
|
||||
#### Property `email`
|
||||
|
||||
email
|
||||
@@ -638,7 +720,7 @@ email
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.user.save_account`
|
||||
### `user.save_account`
|
||||
|
||||
This event is emitted for user save_account operations.
|
||||
|
||||
@@ -650,17 +732,10 @@ user associated with the operation
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.web.socket.connected`
|
||||
### `web.socket.connected`
|
||||
|
||||
This event is emitted for web socket connected operations.
|
||||
|
||||
#### Property `socket`
|
||||
|
||||
socket
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `user`
|
||||
|
||||
user associated with the operation
|
||||
@@ -669,17 +744,10 @@ user associated with the operation
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.web.socket.user-connected`
|
||||
### `web.socket.user-connected`
|
||||
|
||||
This event is emitted for web socket user connected operations.
|
||||
|
||||
#### Property `socket`
|
||||
|
||||
socket
|
||||
- **Type**: any
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `user`
|
||||
|
||||
user associated with the operation
|
||||
@@ -688,17 +756,10 @@ user associated with the operation
|
||||
- **Notes**:
|
||||
|
||||
|
||||
### `core.wisp.get-policy`
|
||||
### `wisp.get-policy`
|
||||
|
||||
This event is emitted for wisp get policy operations.
|
||||
|
||||
#### Property `allow`
|
||||
|
||||
whether the operation is allowed
|
||||
- **Type**: boolean
|
||||
- **Mutability**: mutable
|
||||
- **Notes**:
|
||||
|
||||
#### Property `policy`
|
||||
|
||||
policy information for the operation
|
||||
|
||||
@@ -1,158 +1,158 @@
|
||||
// Test extension for event listeners
|
||||
|
||||
extension.on('core.ai.prompt.check-usage', event => {
|
||||
extension.on('ai.prompt.check-usage', event => {
|
||||
console.log('GOT AI.PROMPT.CHECK-USAGE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.ai.prompt.complete', event => {
|
||||
extension.on('ai.prompt.complete', event => {
|
||||
console.log('GOT AI.PROMPT.COMPLETE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.ai.prompt.report-usage', event => {
|
||||
extension.on('ai.prompt.report-usage', event => {
|
||||
console.log('GOT AI.PROMPT.REPORT-USAGE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.ai.prompt.validate', event => {
|
||||
extension.on('ai.prompt.validate', event => {
|
||||
console.log('GOT AI.PROMPT.VALIDATE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.app.new-icon', event => {
|
||||
extension.on('app.new-icon', event => {
|
||||
console.log('GOT APP.NEW-ICON EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.app.rename', event => {
|
||||
extension.on('app.rename', event => {
|
||||
console.log('GOT APP.RENAME EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.apps.invalidate', event => {
|
||||
extension.on('apps.invalidate', event => {
|
||||
console.log('GOT APPS.INVALIDATE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.email.validate', event => {
|
||||
extension.on('email.validate', event => {
|
||||
console.log('GOT EMAIL.VALIDATE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.create.directory', event => {
|
||||
extension.on('fs.create.directory', event => {
|
||||
console.log('GOT FS.CREATE.DIRECTORY EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.create.file', event => {
|
||||
extension.on('fs.create.file', event => {
|
||||
console.log('GOT FS.CREATE.FILE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.create.shortcut', event => {
|
||||
extension.on('fs.create.shortcut', event => {
|
||||
console.log('GOT FS.CREATE.SHORTCUT EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.create.symlink', event => {
|
||||
extension.on('fs.create.symlink', event => {
|
||||
console.log('GOT FS.CREATE.SYMLINK EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.move.file', event => {
|
||||
extension.on('fs.move.file', event => {
|
||||
console.log('GOT FS.MOVE.FILE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.pending.file', event => {
|
||||
extension.on('fs.pending.file', event => {
|
||||
console.log('GOT FS.PENDING.FILE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.storage.progress.copy', event => {
|
||||
extension.on('fs.storage.progress.copy', event => {
|
||||
console.log('GOT FS.STORAGE.PROGRESS.COPY EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.storage.upload-progress', event => {
|
||||
extension.on('fs.storage.upload-progress', event => {
|
||||
console.log('GOT FS.STORAGE.UPLOAD-PROGRESS EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.fs.write.file', event => {
|
||||
extension.on('fs.write.file', event => {
|
||||
console.log('GOT FS.WRITE.FILE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.ip.validate', event => {
|
||||
extension.on('ip.validate', event => {
|
||||
console.log('GOT IP.VALIDATE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.fs.write-hash', event => {
|
||||
extension.on('outer.fs.write-hash', event => {
|
||||
console.log('GOT OUTER.FS.WRITE-HASH EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.item.added', event => {
|
||||
extension.on('outer.gui.item.added', event => {
|
||||
console.log('GOT OUTER.GUI.ITEM.ADDED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.item.moved', event => {
|
||||
extension.on('outer.gui.item.moved', event => {
|
||||
console.log('GOT OUTER.GUI.ITEM.MOVED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.item.pending', event => {
|
||||
extension.on('outer.gui.item.pending', event => {
|
||||
console.log('GOT OUTER.GUI.ITEM.PENDING EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.item.updated', event => {
|
||||
extension.on('outer.gui.item.updated', event => {
|
||||
console.log('GOT OUTER.GUI.ITEM.UPDATED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.notif.ack', event => {
|
||||
extension.on('outer.gui.notif.ack', event => {
|
||||
console.log('GOT OUTER.GUI.NOTIF.ACK EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.notif.message', event => {
|
||||
extension.on('outer.gui.notif.message', event => {
|
||||
console.log('GOT OUTER.GUI.NOTIF.MESSAGE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.notif.persisted', event => {
|
||||
extension.on('outer.gui.notif.persisted', event => {
|
||||
console.log('GOT OUTER.GUI.NOTIF.PERSISTED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.notif.unreads', event => {
|
||||
extension.on('outer.gui.notif.unreads', event => {
|
||||
console.log('GOT OUTER.GUI.NOTIF.UNREADS EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.outer.gui.submission.done', event => {
|
||||
extension.on('outer.gui.submission.done', event => {
|
||||
console.log('GOT OUTER.GUI.SUBMISSION.DONE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.puter-exec.submission.done', event => {
|
||||
extension.on('puter-exec.submission.done', event => {
|
||||
console.log('GOT PUTER-EXEC.SUBMISSION.DONE EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.request.measured', event => {
|
||||
extension.on('request.measured', event => {
|
||||
console.log('GOT REQUEST.MEASURED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.sns', event => {
|
||||
extension.on('sns', event => {
|
||||
console.log('GOT SNS EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.template-service.hello', event => {
|
||||
extension.on('template-service.hello', event => {
|
||||
console.log('GOT TEMPLATE-SERVICE.HELLO EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.usages.query', event => {
|
||||
extension.on('usages.query', event => {
|
||||
console.log('GOT USAGES.QUERY EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.user.email-changed', event => {
|
||||
extension.on('user.email-changed', event => {
|
||||
console.log('GOT USER.EMAIL-CHANGED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.user.email-confirmed', event => {
|
||||
extension.on('user.email-confirmed', event => {
|
||||
console.log('GOT USER.EMAIL-CONFIRMED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.user.save_account', event => {
|
||||
extension.on('user.save_account', event => {
|
||||
console.log('GOT USER.SAVE_ACCOUNT EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.web.socket.connected', event => {
|
||||
extension.on('web.socket.connected', event => {
|
||||
console.log('GOT WEB.SOCKET.CONNECTED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.web.socket.user-connected', event => {
|
||||
extension.on('web.socket.user-connected', event => {
|
||||
console.log('GOT WEB.SOCKET.USER-CONNECTED EVENT', event);
|
||||
});
|
||||
|
||||
extension.on('core.wisp.get-policy', event => {
|
||||
extension.on('wisp.get-policy', event => {
|
||||
console.log('GOT WISP.GET-POLICY EVENT', event);
|
||||
});
|
||||
|
||||
|
||||
@@ -94,7 +94,13 @@ class ExtensionService extends BaseService {
|
||||
svc_event.on_all(async (key, data, meta = {}) => {
|
||||
meta.from_outside_of_extension = true;
|
||||
|
||||
await this.state.extension.emit(`core.${key}`, data, meta);
|
||||
// register for both `core.` and the extension name
|
||||
const promises = [];
|
||||
promises.push(
|
||||
this.state.extension.emit(`core.${key}`, data, meta));
|
||||
promises.push(
|
||||
this.state.extension.emit(key, data, meta));
|
||||
await Promise.all(promises);
|
||||
});
|
||||
|
||||
this.state.extension.on_all(async (key, data, meta) => {
|
||||
|
||||
+20
-3
@@ -32,6 +32,7 @@ function checkForDuplicateEvent(eventId, filePath, seenEvents) {
|
||||
|
||||
function extractEventsFromFile(filePath, seenEvents, debugMode) {
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
|
||||
|
||||
// Use a more general regex to capture all event emissions
|
||||
// This captures the event name and whatever is passed as the second argument
|
||||
@@ -40,7 +41,7 @@ function extractEventsFromFile(filePath, seenEvents, debugMode) {
|
||||
|
||||
while ((match = regex.exec(content)) !== null) {
|
||||
const eventName = match[1];
|
||||
const eventId = `core.${eventName}`;
|
||||
const eventId = eventName;
|
||||
const eventArg = match[2].trim();
|
||||
|
||||
// Check if this file contains code that might affect event.allow
|
||||
@@ -103,10 +104,24 @@ function extractEventsFromFile(filePath, seenEvents, debugMode) {
|
||||
|
||||
// Helper function to extract properties from a properties text string
|
||||
function extractProperties(propertiesText, propertyDetails, hasAllowEffect, eventName) {
|
||||
const properties = propertiesText
|
||||
// filter out all comments (lines starting with //)
|
||||
const lines = propertiesText.split('\n').map(line => line.trim()).filter(line => !line.startsWith('//'));
|
||||
|
||||
// glue all lines together, then split by commas
|
||||
const gluedTest = lines.join('\n');
|
||||
|
||||
const properties = gluedTest
|
||||
.split(/\s*,\s*/)
|
||||
.map(prop => prop.split(':')[0].trim())
|
||||
.map(prop => prop.split(/[^_A-Za-z0-9]/)[0].trim())
|
||||
.filter(prop => prop);
|
||||
|
||||
// // const event = { allow: true, email };
|
||||
// // text: allow: true, email
|
||||
// // split to: [allow: true] [email]
|
||||
// const properties = propertiesText
|
||||
// .split(/\s*,\s*/)
|
||||
// .map(prop => prop.split(':')[0].trim())
|
||||
// .filter(prop => prop);
|
||||
|
||||
// Generate property details
|
||||
properties.forEach(prop => {
|
||||
@@ -216,6 +231,8 @@ function main() {
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 1) {
|
||||
console.error('Usage: node doc_helper.js <directory> [output_file] [--generate-test] [--test-dir=<directory>] [--debug]');
|
||||
// node tools/doc_helper.js . doc/contributors/extensions/events.json.js
|
||||
// [output_file] [--generate-test] [--test-dir=<directory>] [--debug]');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user