shutro-erp 0.3.3 → 0.3.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/dist/account_portal/.kosh/bindings.js +1 -1
- package/dist/account_portal/.kosh/schema.d.ts +128 -1
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +128 -1
- package/dist/contacts/.kosh/bindings.js +1 -1
- package/dist/contacts/.kosh/schema.d.ts +128 -1
- package/dist/integrations/index.js +12 -0
- package/dist/integrations/web/OAuthAppsPage.d.ts +9 -0
- package/dist/integrations/web/OAuthAppsPage.js +79 -0
- package/dist/integrations/web/index.d.ts +1 -0
- package/dist/integrations/web/index.js +3 -0
- package/dist/integrations/web/messages.js +58 -0
- package/dist/l10n_bd/.kosh/bindings.js +1 -1
- package/dist/l10n_bd/.kosh/schema.d.ts +128 -1
- package/dist/l10n_in/.kosh/bindings.js +1 -1
- package/dist/l10n_in/.kosh/schema.d.ts +128 -1
- package/dist/messaging/web/index.js +1 -1
- package/dist/notify/web/index.js +1 -1
- package/dist/payment/.kosh/bindings.js +1 -1
- package/dist/payment/.kosh/schema.d.ts +128 -1
- package/dist/portal/.kosh/bindings.js +1 -1
- package/dist/portal/.kosh/schema.d.ts +128 -1
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +128 -1
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +128 -1
- package/dist/project_portal/.kosh/bindings.js +1 -1
- package/dist/project_portal/.kosh/schema.d.ts +128 -1
- package/dist/purchase/.kosh/bindings.js +1 -1
- package/dist/purchase/.kosh/schema.d.ts +128 -1
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +128 -1
- package/dist/purchase_portal/.kosh/bindings.js +1 -1
- package/dist/purchase_portal/.kosh/schema.d.ts +128 -1
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +128 -1
- package/dist/sale_portal/.kosh/bindings.js +1 -1
- package/dist/sale_portal/.kosh/schema.d.ts +128 -1
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +128 -1
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +128 -1
- package/dist/server/auth/base.js +76 -0
- package/dist/server/auth/oauth.d.ts +21 -0
- package/dist/server/auth/oauth.js +579 -0
- package/dist/server/auth/service.d.ts +4 -0
- package/dist/server/auth/service.js +17 -0
- package/dist/server/identity.d.ts +2 -0
- package/dist/server/images.d.ts +12 -0
- package/dist/server/images.js +139 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/server.d.ts +4 -0
- package/dist/server/server.js +9 -1
- package/dist/settings/company.js +3 -1
- package/dist/settings/people.js +3 -1
- package/dist/settings/web/CompaniesPage.js +2 -2
- package/dist/settings/web/CompanyPage.js +13 -2
- package/dist/settings/web/ConnectedAppsPage.d.ts +7 -0
- package/dist/settings/web/ConnectedAppsPage.js +33 -0
- package/dist/settings/web/OverviewPage.js +12 -1
- package/dist/settings/web/PeoplePage.js +3 -12
- package/dist/settings/web/ProfilePage.js +9 -7
- package/dist/settings/web/index.d.ts +1 -0
- package/dist/settings/web/index.js +5 -0
- package/dist/settings/web/messages.js +28 -0
- package/dist/ui/api.d.ts +4 -0
- package/dist/ui/app.js +49 -16
- package/dist/ui/components/AppIcon.js +11 -1
- package/dist/ui/components/Avatar.d.ts +21 -0
- package/dist/ui/components/Avatar.js +71 -0
- package/dist/ui/i18n/messages.d.ts +30 -0
- package/dist/ui/i18n/messages.js +60 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/registry.d.ts +7 -1
- package/dist/ui/registry.js +10 -1
- package/dist/ui/search/ViewTabs.d.ts +14 -0
- package/dist/ui/search/ViewTabs.js +42 -0
- package/dist/ui/shell/Consent.d.ts +5 -0
- package/dist/ui/shell/Consent.js +35 -0
- package/dist/ui/shell/Home.js +85 -16
- package/dist/ui/shell/Sidebar.js +15 -22
- package/dist/ui/views/ListView.js +49 -22
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 8041dee6bf9e07ba
|
|
2
2
|
// Bindings of module `sale_portal`: import the definition API from here to get types scoped to what it can see.
|
|
3
3
|
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
4
4
|
import { definitions } from '../../server/orm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 8041dee6bf9e07ba
|
|
2
2
|
// Schema view of module `sale_portal` (RFC 0002 §7.7): the models it owns or depends on, with the extensions it can see.
|
|
3
3
|
import type { F } from '../../server/orm.js';
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ export interface SchemaView {
|
|
|
12
12
|
readonly 'auth.session': AuthSession;
|
|
13
13
|
readonly 'auth.user_grant': AuthUserGrant;
|
|
14
14
|
readonly 'auth.user_group': AuthUserGroup;
|
|
15
|
+
readonly 'kosh.image': KoshImage;
|
|
15
16
|
readonly 'kosh.saved_view': KoshSavedView;
|
|
16
17
|
readonly 'mail.activity': MailActivity;
|
|
17
18
|
readonly 'mail.activity.type': MailActivityType;
|
|
@@ -20,6 +21,10 @@ export interface SchemaView {
|
|
|
20
21
|
readonly 'mail.follower': MailFollower;
|
|
21
22
|
readonly 'mail.message': MailMessage;
|
|
22
23
|
readonly 'mail.message.reaction': MailMessageReaction;
|
|
24
|
+
readonly 'oauth.app': OauthApp;
|
|
25
|
+
readonly 'oauth.code': OauthCode;
|
|
26
|
+
readonly 'oauth.grant': OauthGrant;
|
|
27
|
+
readonly 'oauth.token': OauthToken;
|
|
23
28
|
readonly 'portal.announcement': PortalAnnouncement;
|
|
24
29
|
readonly 'portal.invitation': PortalInvitation;
|
|
25
30
|
readonly 'portal.signature': PortalSignature;
|
|
@@ -232,6 +237,29 @@ export interface AuthUserGroup {
|
|
|
232
237
|
export interface AuthUserGroupMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'auth.user_group'> {
|
|
233
238
|
}
|
|
234
239
|
|
|
240
|
+
/** `kosh.image` (owner: base). */
|
|
241
|
+
export interface KoshImage {
|
|
242
|
+
readonly name: 'kosh.image';
|
|
243
|
+
readonly fields: {
|
|
244
|
+
readonly id: F.Id<'kosh.image'>;
|
|
245
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
246
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
247
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
248
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
249
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
250
|
+
readonly ownerModel: F.Char<{ readonly required: true }>;
|
|
251
|
+
readonly ownerId: F.Integer<{ readonly required: true }>;
|
|
252
|
+
readonly mime: F.Char<{ readonly required: true }>;
|
|
253
|
+
readonly data: F.Text<{ readonly required: true }>;
|
|
254
|
+
readonly hash: F.Char<{ readonly required: true }>;
|
|
255
|
+
};
|
|
256
|
+
readonly methods: KoshImageMethods;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Methods of `kosh.image`: declared ones and transitions. */
|
|
260
|
+
export interface KoshImageMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'kosh.image'> {
|
|
261
|
+
}
|
|
262
|
+
|
|
235
263
|
/** `kosh.saved_view` (owner: base). */
|
|
236
264
|
export interface KoshSavedView {
|
|
237
265
|
readonly name: 'kosh.saved_view';
|
|
@@ -434,6 +462,105 @@ export interface MailMessageReaction {
|
|
|
434
462
|
export interface MailMessageReactionMethods extends F.Methods<typeof import('../../messaging/index.js').messagingShutro, 'mail.message.reaction'> {
|
|
435
463
|
}
|
|
436
464
|
|
|
465
|
+
/** `oauth.app` (owner: base). */
|
|
466
|
+
export interface OauthApp {
|
|
467
|
+
readonly name: 'oauth.app';
|
|
468
|
+
readonly fields: {
|
|
469
|
+
readonly id: F.Id<'oauth.app'>;
|
|
470
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
471
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
472
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
473
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
474
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
475
|
+
readonly name: F.Char<{ readonly required: true }>;
|
|
476
|
+
readonly clientId: F.Char<{ readonly required: true }>;
|
|
477
|
+
readonly secretHash: F.Char;
|
|
478
|
+
readonly confidential: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
479
|
+
readonly redirectUris: F.Text<{ readonly required: true }>;
|
|
480
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
481
|
+
readonly homepage: F.Char;
|
|
482
|
+
readonly active: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
483
|
+
readonly owner: F.Many2one<'res.users'>;
|
|
484
|
+
};
|
|
485
|
+
readonly methods: OauthAppMethods;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** Methods of `oauth.app`: declared ones and transitions. */
|
|
489
|
+
export interface OauthAppMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.app'> {
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** `oauth.code` (owner: base). */
|
|
493
|
+
export interface OauthCode {
|
|
494
|
+
readonly name: 'oauth.code';
|
|
495
|
+
readonly fields: {
|
|
496
|
+
readonly id: F.Id<'oauth.code'>;
|
|
497
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
498
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
499
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
500
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
501
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
502
|
+
readonly codeHash: F.Char<{ readonly required: true }>;
|
|
503
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
504
|
+
readonly redirectUri: F.Char<{ readonly required: true }>;
|
|
505
|
+
readonly challenge: F.Char;
|
|
506
|
+
readonly expiresAt: F.Datetime<{ readonly required: true }>;
|
|
507
|
+
readonly used: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
508
|
+
};
|
|
509
|
+
readonly methods: OauthCodeMethods;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** Methods of `oauth.code`: declared ones and transitions. */
|
|
513
|
+
export interface OauthCodeMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.code'> {
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** `oauth.grant` (owner: base). */
|
|
517
|
+
export interface OauthGrant {
|
|
518
|
+
readonly name: 'oauth.grant';
|
|
519
|
+
readonly fields: {
|
|
520
|
+
readonly id: F.Id<'oauth.grant'>;
|
|
521
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
522
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
523
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
524
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
525
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
526
|
+
readonly user: F.Many2one<'res.users', { readonly required: true }>;
|
|
527
|
+
readonly app: F.Many2one<'oauth.app', { readonly required: true }>;
|
|
528
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
529
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
530
|
+
readonly lastUsedAt: F.Datetime;
|
|
531
|
+
};
|
|
532
|
+
readonly methods: OauthGrantMethods;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** Methods of `oauth.grant`: declared ones and transitions. */
|
|
536
|
+
export interface OauthGrantMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.grant'> {
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/** `oauth.token` (owner: base). */
|
|
540
|
+
export interface OauthToken {
|
|
541
|
+
readonly name: 'oauth.token';
|
|
542
|
+
readonly fields: {
|
|
543
|
+
readonly id: F.Id<'oauth.token'>;
|
|
544
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
545
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
546
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
547
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
548
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
549
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
550
|
+
readonly accessHash: F.Char<{ readonly required: true }>;
|
|
551
|
+
readonly refreshHash: F.Char<{ readonly required: true }>;
|
|
552
|
+
readonly accessExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
553
|
+
readonly refreshExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
554
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
555
|
+
readonly rotated: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
556
|
+
};
|
|
557
|
+
readonly methods: OauthTokenMethods;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** Methods of `oauth.token`: declared ones and transitions. */
|
|
561
|
+
export interface OauthTokenMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.token'> {
|
|
562
|
+
}
|
|
563
|
+
|
|
437
564
|
/** `portal.announcement` (owner: portal). */
|
|
438
565
|
export interface PortalAnnouncement {
|
|
439
566
|
readonly name: 'portal.announcement';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 7dbe00f1ac846381
|
|
2
2
|
// Bindings of module `sale_project`: import the definition API from here to get types scoped to what it can see.
|
|
3
3
|
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
4
4
|
import { definitions } from '../../server/orm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 7dbe00f1ac846381
|
|
2
2
|
// Schema view of module `sale_project` (RFC 0002 §7.7): the models it owns or depends on, with the extensions it can see.
|
|
3
3
|
import type { F } from '../../server/orm.js';
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ export interface SchemaView {
|
|
|
12
12
|
readonly 'auth.session': AuthSession;
|
|
13
13
|
readonly 'auth.user_grant': AuthUserGrant;
|
|
14
14
|
readonly 'auth.user_group': AuthUserGroup;
|
|
15
|
+
readonly 'kosh.image': KoshImage;
|
|
15
16
|
readonly 'kosh.saved_view': KoshSavedView;
|
|
16
17
|
readonly 'mail.activity': MailActivity;
|
|
17
18
|
readonly 'mail.activity.type': MailActivityType;
|
|
@@ -20,6 +21,10 @@ export interface SchemaView {
|
|
|
20
21
|
readonly 'mail.follower': MailFollower;
|
|
21
22
|
readonly 'mail.message': MailMessage;
|
|
22
23
|
readonly 'mail.message.reaction': MailMessageReaction;
|
|
24
|
+
readonly 'oauth.app': OauthApp;
|
|
25
|
+
readonly 'oauth.code': OauthCode;
|
|
26
|
+
readonly 'oauth.grant': OauthGrant;
|
|
27
|
+
readonly 'oauth.token': OauthToken;
|
|
23
28
|
readonly 'product.category': ProductCategory;
|
|
24
29
|
readonly 'product.product': ProductProduct;
|
|
25
30
|
readonly 'project.project': ProjectProject;
|
|
@@ -233,6 +238,29 @@ export interface AuthUserGroup {
|
|
|
233
238
|
export interface AuthUserGroupMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'auth.user_group'> {
|
|
234
239
|
}
|
|
235
240
|
|
|
241
|
+
/** `kosh.image` (owner: base). */
|
|
242
|
+
export interface KoshImage {
|
|
243
|
+
readonly name: 'kosh.image';
|
|
244
|
+
readonly fields: {
|
|
245
|
+
readonly id: F.Id<'kosh.image'>;
|
|
246
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
247
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
248
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
249
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
250
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
251
|
+
readonly ownerModel: F.Char<{ readonly required: true }>;
|
|
252
|
+
readonly ownerId: F.Integer<{ readonly required: true }>;
|
|
253
|
+
readonly mime: F.Char<{ readonly required: true }>;
|
|
254
|
+
readonly data: F.Text<{ readonly required: true }>;
|
|
255
|
+
readonly hash: F.Char<{ readonly required: true }>;
|
|
256
|
+
};
|
|
257
|
+
readonly methods: KoshImageMethods;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Methods of `kosh.image`: declared ones and transitions. */
|
|
261
|
+
export interface KoshImageMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'kosh.image'> {
|
|
262
|
+
}
|
|
263
|
+
|
|
236
264
|
/** `kosh.saved_view` (owner: base). */
|
|
237
265
|
export interface KoshSavedView {
|
|
238
266
|
readonly name: 'kosh.saved_view';
|
|
@@ -435,6 +463,105 @@ export interface MailMessageReaction {
|
|
|
435
463
|
export interface MailMessageReactionMethods extends F.Methods<typeof import('../../messaging/index.js').messagingShutro, 'mail.message.reaction'> {
|
|
436
464
|
}
|
|
437
465
|
|
|
466
|
+
/** `oauth.app` (owner: base). */
|
|
467
|
+
export interface OauthApp {
|
|
468
|
+
readonly name: 'oauth.app';
|
|
469
|
+
readonly fields: {
|
|
470
|
+
readonly id: F.Id<'oauth.app'>;
|
|
471
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
472
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
473
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
474
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
475
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
476
|
+
readonly name: F.Char<{ readonly required: true }>;
|
|
477
|
+
readonly clientId: F.Char<{ readonly required: true }>;
|
|
478
|
+
readonly secretHash: F.Char;
|
|
479
|
+
readonly confidential: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
480
|
+
readonly redirectUris: F.Text<{ readonly required: true }>;
|
|
481
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
482
|
+
readonly homepage: F.Char;
|
|
483
|
+
readonly active: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
484
|
+
readonly owner: F.Many2one<'res.users'>;
|
|
485
|
+
};
|
|
486
|
+
readonly methods: OauthAppMethods;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Methods of `oauth.app`: declared ones and transitions. */
|
|
490
|
+
export interface OauthAppMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.app'> {
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** `oauth.code` (owner: base). */
|
|
494
|
+
export interface OauthCode {
|
|
495
|
+
readonly name: 'oauth.code';
|
|
496
|
+
readonly fields: {
|
|
497
|
+
readonly id: F.Id<'oauth.code'>;
|
|
498
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
499
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
500
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
501
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
502
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
503
|
+
readonly codeHash: F.Char<{ readonly required: true }>;
|
|
504
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
505
|
+
readonly redirectUri: F.Char<{ readonly required: true }>;
|
|
506
|
+
readonly challenge: F.Char;
|
|
507
|
+
readonly expiresAt: F.Datetime<{ readonly required: true }>;
|
|
508
|
+
readonly used: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
509
|
+
};
|
|
510
|
+
readonly methods: OauthCodeMethods;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** Methods of `oauth.code`: declared ones and transitions. */
|
|
514
|
+
export interface OauthCodeMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.code'> {
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** `oauth.grant` (owner: base). */
|
|
518
|
+
export interface OauthGrant {
|
|
519
|
+
readonly name: 'oauth.grant';
|
|
520
|
+
readonly fields: {
|
|
521
|
+
readonly id: F.Id<'oauth.grant'>;
|
|
522
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
523
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
524
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
525
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
526
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
527
|
+
readonly user: F.Many2one<'res.users', { readonly required: true }>;
|
|
528
|
+
readonly app: F.Many2one<'oauth.app', { readonly required: true }>;
|
|
529
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
530
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
531
|
+
readonly lastUsedAt: F.Datetime;
|
|
532
|
+
};
|
|
533
|
+
readonly methods: OauthGrantMethods;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Methods of `oauth.grant`: declared ones and transitions. */
|
|
537
|
+
export interface OauthGrantMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.grant'> {
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/** `oauth.token` (owner: base). */
|
|
541
|
+
export interface OauthToken {
|
|
542
|
+
readonly name: 'oauth.token';
|
|
543
|
+
readonly fields: {
|
|
544
|
+
readonly id: F.Id<'oauth.token'>;
|
|
545
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
546
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
547
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
548
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
549
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
550
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
551
|
+
readonly accessHash: F.Char<{ readonly required: true }>;
|
|
552
|
+
readonly refreshHash: F.Char<{ readonly required: true }>;
|
|
553
|
+
readonly accessExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
554
|
+
readonly refreshExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
555
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
556
|
+
readonly rotated: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
557
|
+
};
|
|
558
|
+
readonly methods: OauthTokenMethods;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** Methods of `oauth.token`: declared ones and transitions. */
|
|
562
|
+
export interface OauthTokenMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.token'> {
|
|
563
|
+
}
|
|
564
|
+
|
|
438
565
|
/** `product.category` (owner: product). */
|
|
439
566
|
export interface ProductCategory {
|
|
440
567
|
readonly name: 'product.category';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 680b65ef8ba5f90d
|
|
2
2
|
// Bindings of module `sales`: import the definition API from here to get types scoped to what it can see.
|
|
3
3
|
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
4
4
|
import { definitions } from '../../server/orm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash:
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 680b65ef8ba5f90d
|
|
2
2
|
// Schema view of module `sales` (RFC 0002 §7.7): the models it owns or depends on, with the extensions it can see.
|
|
3
3
|
import type { F } from '../../server/orm.js';
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ export interface SchemaView {
|
|
|
12
12
|
readonly 'auth.session': AuthSession;
|
|
13
13
|
readonly 'auth.user_grant': AuthUserGrant;
|
|
14
14
|
readonly 'auth.user_group': AuthUserGroup;
|
|
15
|
+
readonly 'kosh.image': KoshImage;
|
|
15
16
|
readonly 'kosh.saved_view': KoshSavedView;
|
|
16
17
|
readonly 'mail.activity': MailActivity;
|
|
17
18
|
readonly 'mail.activity.type': MailActivityType;
|
|
@@ -20,6 +21,10 @@ export interface SchemaView {
|
|
|
20
21
|
readonly 'mail.follower': MailFollower;
|
|
21
22
|
readonly 'mail.message': MailMessage;
|
|
22
23
|
readonly 'mail.message.reaction': MailMessageReaction;
|
|
24
|
+
readonly 'oauth.app': OauthApp;
|
|
25
|
+
readonly 'oauth.code': OauthCode;
|
|
26
|
+
readonly 'oauth.grant': OauthGrant;
|
|
27
|
+
readonly 'oauth.token': OauthToken;
|
|
23
28
|
readonly 'product.category': ProductCategory;
|
|
24
29
|
readonly 'product.product': ProductProduct;
|
|
25
30
|
readonly 'res.company': ResCompany;
|
|
@@ -229,6 +234,29 @@ export interface AuthUserGroup {
|
|
|
229
234
|
export interface AuthUserGroupMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'auth.user_group'> {
|
|
230
235
|
}
|
|
231
236
|
|
|
237
|
+
/** `kosh.image` (owner: base). */
|
|
238
|
+
export interface KoshImage {
|
|
239
|
+
readonly name: 'kosh.image';
|
|
240
|
+
readonly fields: {
|
|
241
|
+
readonly id: F.Id<'kosh.image'>;
|
|
242
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
243
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
244
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
245
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
246
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
247
|
+
readonly ownerModel: F.Char<{ readonly required: true }>;
|
|
248
|
+
readonly ownerId: F.Integer<{ readonly required: true }>;
|
|
249
|
+
readonly mime: F.Char<{ readonly required: true }>;
|
|
250
|
+
readonly data: F.Text<{ readonly required: true }>;
|
|
251
|
+
readonly hash: F.Char<{ readonly required: true }>;
|
|
252
|
+
};
|
|
253
|
+
readonly methods: KoshImageMethods;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Methods of `kosh.image`: declared ones and transitions. */
|
|
257
|
+
export interface KoshImageMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'kosh.image'> {
|
|
258
|
+
}
|
|
259
|
+
|
|
232
260
|
/** `kosh.saved_view` (owner: base). */
|
|
233
261
|
export interface KoshSavedView {
|
|
234
262
|
readonly name: 'kosh.saved_view';
|
|
@@ -431,6 +459,105 @@ export interface MailMessageReaction {
|
|
|
431
459
|
export interface MailMessageReactionMethods extends F.Methods<typeof import('../../messaging/index.js').messagingShutro, 'mail.message.reaction'> {
|
|
432
460
|
}
|
|
433
461
|
|
|
462
|
+
/** `oauth.app` (owner: base). */
|
|
463
|
+
export interface OauthApp {
|
|
464
|
+
readonly name: 'oauth.app';
|
|
465
|
+
readonly fields: {
|
|
466
|
+
readonly id: F.Id<'oauth.app'>;
|
|
467
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
468
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
469
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
470
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
471
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
472
|
+
readonly name: F.Char<{ readonly required: true }>;
|
|
473
|
+
readonly clientId: F.Char<{ readonly required: true }>;
|
|
474
|
+
readonly secretHash: F.Char;
|
|
475
|
+
readonly confidential: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
476
|
+
readonly redirectUris: F.Text<{ readonly required: true }>;
|
|
477
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
478
|
+
readonly homepage: F.Char;
|
|
479
|
+
readonly active: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
480
|
+
readonly owner: F.Many2one<'res.users'>;
|
|
481
|
+
};
|
|
482
|
+
readonly methods: OauthAppMethods;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Methods of `oauth.app`: declared ones and transitions. */
|
|
486
|
+
export interface OauthAppMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.app'> {
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** `oauth.code` (owner: base). */
|
|
490
|
+
export interface OauthCode {
|
|
491
|
+
readonly name: 'oauth.code';
|
|
492
|
+
readonly fields: {
|
|
493
|
+
readonly id: F.Id<'oauth.code'>;
|
|
494
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
495
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
496
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
497
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
498
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
499
|
+
readonly codeHash: F.Char<{ readonly required: true }>;
|
|
500
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
501
|
+
readonly redirectUri: F.Char<{ readonly required: true }>;
|
|
502
|
+
readonly challenge: F.Char;
|
|
503
|
+
readonly expiresAt: F.Datetime<{ readonly required: true }>;
|
|
504
|
+
readonly used: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
505
|
+
};
|
|
506
|
+
readonly methods: OauthCodeMethods;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** Methods of `oauth.code`: declared ones and transitions. */
|
|
510
|
+
export interface OauthCodeMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.code'> {
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** `oauth.grant` (owner: base). */
|
|
514
|
+
export interface OauthGrant {
|
|
515
|
+
readonly name: 'oauth.grant';
|
|
516
|
+
readonly fields: {
|
|
517
|
+
readonly id: F.Id<'oauth.grant'>;
|
|
518
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
519
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
520
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
521
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
522
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
523
|
+
readonly user: F.Many2one<'res.users', { readonly required: true }>;
|
|
524
|
+
readonly app: F.Many2one<'oauth.app', { readonly required: true }>;
|
|
525
|
+
readonly scopes: F.Char<{ readonly required: true }>;
|
|
526
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
527
|
+
readonly lastUsedAt: F.Datetime;
|
|
528
|
+
};
|
|
529
|
+
readonly methods: OauthGrantMethods;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** Methods of `oauth.grant`: declared ones and transitions. */
|
|
533
|
+
export interface OauthGrantMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.grant'> {
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** `oauth.token` (owner: base). */
|
|
537
|
+
export interface OauthToken {
|
|
538
|
+
readonly name: 'oauth.token';
|
|
539
|
+
readonly fields: {
|
|
540
|
+
readonly id: F.Id<'oauth.token'>;
|
|
541
|
+
readonly createdAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
542
|
+
readonly updatedAt: F.Datetime<{ readonly required: true; readonly readonly: true }>;
|
|
543
|
+
readonly createdBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
544
|
+
readonly updatedBy: F.Many2one<'res.users', { readonly readonly: true }>;
|
|
545
|
+
readonly displayName: F.Char<{ readonly required: true; readonly readonly: true; readonly compute: true }>;
|
|
546
|
+
readonly grant: F.Many2one<'oauth.grant', { readonly required: true }>;
|
|
547
|
+
readonly accessHash: F.Char<{ readonly required: true }>;
|
|
548
|
+
readonly refreshHash: F.Char<{ readonly required: true }>;
|
|
549
|
+
readonly accessExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
550
|
+
readonly refreshExpiresAt: F.Datetime<{ readonly required: true }>;
|
|
551
|
+
readonly revoked: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
552
|
+
readonly rotated: F.Bool<{ readonly required: true; readonly default: true }>;
|
|
553
|
+
};
|
|
554
|
+
readonly methods: OauthTokenMethods;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** Methods of `oauth.token`: declared ones and transitions. */
|
|
558
|
+
export interface OauthTokenMethods extends F.Methods<typeof import('../../server/index.js').baseShutro, 'oauth.token'> {
|
|
559
|
+
}
|
|
560
|
+
|
|
434
561
|
/** `product.category` (owner: product). */
|
|
435
562
|
export interface ProductCategory {
|
|
436
563
|
readonly name: 'product.category';
|
package/dist/server/auth/base.js
CHANGED
|
@@ -147,6 +147,72 @@ const AuthPolicy = defineModel('auth.policy', {
|
|
|
147
147
|
sessionDays: f.integer({ label: 'Session lifetime (days)' }),
|
|
148
148
|
},
|
|
149
149
|
});
|
|
150
|
+
/**
|
|
151
|
+
* OAuth 2.0 apps (RFC 0017 §5.2): third-party applications that act for a user who consented, within scopes. The
|
|
152
|
+
* client secret (confidential apps) is stored as a digest; public apps rely on PKCE. Private: managed by the
|
|
153
|
+
* Integrations routes and the OAuth flow.
|
|
154
|
+
*/
|
|
155
|
+
const OAuthApp = defineModel('oauth.app', {
|
|
156
|
+
fields: {
|
|
157
|
+
name: f.char({ required: true }),
|
|
158
|
+
clientId: f.char({ required: true, index: 'unique' }),
|
|
159
|
+
secretHash: f.char(),
|
|
160
|
+
confidential: f.boolean({ default: true }),
|
|
161
|
+
/** One per line; the redirect must match one exactly. */
|
|
162
|
+
redirectUris: f.text({ required: true }),
|
|
163
|
+
/** The scopes it may ask for, space separated (`*`, `read:<app>`, `write:<app>`). */
|
|
164
|
+
scopes: f.char({ required: true }),
|
|
165
|
+
homepage: f.char(),
|
|
166
|
+
active: f.boolean({ default: true }),
|
|
167
|
+
owner: f.many2one('res.users', { ondelete: 'set null' }),
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
/** A user's consent to an app, with the scopes granted; revoking it ends every token of it. */
|
|
171
|
+
const OAuthGrant = defineModel('oauth.grant', {
|
|
172
|
+
fields: {
|
|
173
|
+
user: f.many2one('res.users', { required: true, ondelete: 'cascade' }),
|
|
174
|
+
app: f.many2one('oauth.app', { required: true, ondelete: 'cascade' }),
|
|
175
|
+
scopes: f.char({ required: true }),
|
|
176
|
+
revoked: f.boolean({ default: false }),
|
|
177
|
+
lastUsedAt: f.datetime(),
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
/** An authorization code: once, for 10 minutes, bound to its redirect and its PKCE challenge. */
|
|
181
|
+
const OAuthCode = defineModel('oauth.code', {
|
|
182
|
+
fields: {
|
|
183
|
+
codeHash: f.char({ required: true, index: 'unique' }),
|
|
184
|
+
grant: f.many2one('oauth.grant', { required: true, ondelete: 'cascade' }),
|
|
185
|
+
redirectUri: f.char({ required: true }),
|
|
186
|
+
challenge: f.char(),
|
|
187
|
+
expiresAt: f.datetime({ required: true }),
|
|
188
|
+
used: f.boolean({ default: false }),
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
/** An access token (1 hour) and its refresh token (rotated at each use), both stored as digests. */
|
|
192
|
+
const OAuthToken = defineModel('oauth.token', {
|
|
193
|
+
fields: {
|
|
194
|
+
grant: f.many2one('oauth.grant', { required: true, ondelete: 'cascade' }),
|
|
195
|
+
accessHash: f.char({ required: true, index: 'unique' }),
|
|
196
|
+
refreshHash: f.char({ required: true, index: 'unique' }),
|
|
197
|
+
accessExpiresAt: f.datetime({ required: true }),
|
|
198
|
+
refreshExpiresAt: f.datetime({ required: true }),
|
|
199
|
+
/** No longer valid: replaced by a newer pair, or revoked. */
|
|
200
|
+
revoked: f.boolean({ default: false }),
|
|
201
|
+
/** Replaced by a newer pair: its refresh token coming back means someone else holds it. */
|
|
202
|
+
rotated: f.boolean({ default: false }),
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
/** Profile photos and company logos (`images.ts`): small images, their bytes in base64. Private: served by routes. */
|
|
206
|
+
const KoshImage = defineModel('kosh.image', {
|
|
207
|
+
fields: {
|
|
208
|
+
ownerModel: f.char({ required: true, index: true }),
|
|
209
|
+
ownerId: f.integer({ required: true, index: true }),
|
|
210
|
+
mime: f.char({ required: true }),
|
|
211
|
+
data: f.text({ required: true }),
|
|
212
|
+
/** The bytes' digest (16 hex): the version in the image's URL. */
|
|
213
|
+
hash: f.char({ required: true }),
|
|
214
|
+
},
|
|
215
|
+
});
|
|
150
216
|
/**
|
|
151
217
|
* The security audit log (CLAUDE.md: logins, permission changes, exports, sensitive actions). Append-only: no one
|
|
152
218
|
* may change or delete events (administrators included: the REST API never serves it, and the admin API only reads).
|
|
@@ -217,6 +283,11 @@ export const baseShutro = defineModule({
|
|
|
217
283
|
AuthUserGroup,
|
|
218
284
|
AuthUserGrant,
|
|
219
285
|
AuthPolicy,
|
|
286
|
+
OAuthApp,
|
|
287
|
+
OAuthGrant,
|
|
288
|
+
OAuthCode,
|
|
289
|
+
OAuthToken,
|
|
290
|
+
KoshImage,
|
|
220
291
|
AuditEvent,
|
|
221
292
|
SavedView,
|
|
222
293
|
],
|
|
@@ -236,6 +307,11 @@ export const base = defineKoshModule({
|
|
|
236
307
|
'auth.user_group',
|
|
237
308
|
'auth.user_grant',
|
|
238
309
|
'auth.policy',
|
|
310
|
+
'oauth.app',
|
|
311
|
+
'oauth.grant',
|
|
312
|
+
'oauth.code',
|
|
313
|
+
'oauth.token',
|
|
314
|
+
'kosh.image',
|
|
239
315
|
'audit.event',
|
|
240
316
|
],
|
|
241
317
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import type { Env, Shutro } from '../orm.js';
|
|
3
|
+
import type { KoshRegistry } from '../registry.js';
|
|
4
|
+
import type { AuthService } from './service.js';
|
|
5
|
+
export declare const ACCESS_SECONDS = 3600;
|
|
6
|
+
/** Access tokens start with it: the server tells them from sessions and API keys at a glance. */
|
|
7
|
+
export declare const ACCESS_PREFIX = "oat_";
|
|
8
|
+
export interface OAuthOptions {
|
|
9
|
+
/** The back-office's address: the consent page is `<baseUrl>/oauth/authorize`. */
|
|
10
|
+
readonly baseUrl: string;
|
|
11
|
+
}
|
|
12
|
+
/** A resolved access token: who it acts as, within which scopes. */
|
|
13
|
+
export interface OAuthAccess {
|
|
14
|
+
readonly token: number;
|
|
15
|
+
readonly user: number;
|
|
16
|
+
readonly app: number;
|
|
17
|
+
readonly scopes: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Finds the access token `token` (`oat_…`), live, of an active app and a grant not revoked. */
|
|
20
|
+
export declare function resolveAccessToken(env: Env, token: string): Promise<OAuthAccess | null>;
|
|
21
|
+
export declare function registerOAuthRoutes(app: FastifyInstance, auth: AuthService, shutro: () => Shutro, registry: KoshRegistry, options: OAuthOptions): void;
|