@degenerate/generic 0.1.9 → 0.1.10

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 (45) hide show
  1. package/dist/application/audit-log/create-application-audit-log.d.ts.map +1 -1
  2. package/dist/application/audit-log/create-application-audit-log.js +1 -1
  3. package/dist/application/database/firestore/generics/add-items-to-database.d.ts.map +1 -1
  4. package/dist/application/database/firestore/generics/add-items-to-database.js +2 -2
  5. package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map +1 -1
  6. package/dist/application/database/firestore/generics/add-or-update-items-to-database.js +3 -3
  7. package/dist/application/database/firestore/generics/delete-items-on-database.d.ts.map +1 -1
  8. package/dist/application/database/firestore/generics/delete-items-on-database.js +2 -2
  9. package/dist/application/database/firestore/generics/get-item-from-database.d.ts.map +1 -1
  10. package/dist/application/database/firestore/generics/get-item-from-database.js +2 -2
  11. package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map +1 -1
  12. package/dist/application/database/firestore/generics/get-items-different-path-on-database.js +2 -2
  13. package/dist/application/database/firestore/generics/get-items-from-database.d.ts.map +1 -1
  14. package/dist/application/database/firestore/generics/get-items-from-database.js +2 -2
  15. package/dist/application/database/firestore/generics/update-items-on-database.d.ts.map +1 -1
  16. package/dist/application/database/firestore/generics/update-items-on-database.js +2 -2
  17. package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map +1 -1
  18. package/dist/application/database/firestore/generics/update-items-properties-on-database.js +2 -2
  19. package/dist/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -1
  20. package/dist/helpers/request/params-object-helpers.d.ts +7 -1
  21. package/dist/helpers/request/params-object-helpers.d.ts.map +1 -1
  22. package/dist/helpers/request/params-object-helpers.js +10 -1
  23. package/dist/helpers/request/request-object-helpers.d.ts +16 -1
  24. package/dist/helpers/request/request-object-helpers.d.ts.map +1 -1
  25. package/dist/helpers/request/request-object-helpers.js +25 -2
  26. package/dist/models/application/audit-log/application-audit-log-models.d.ts +144 -60
  27. package/dist/models/application/audit-log/application-audit-log-models.d.ts.map +1 -1
  28. package/dist/models/application/audit-log/application-audit-log-models.js +87 -41
  29. package/dist/models/application/database/firestore-models.d.ts +370 -54
  30. package/dist/models/application/database/firestore-models.d.ts.map +1 -1
  31. package/dist/models/application/database/firestore-models.js +119 -1
  32. package/dist/models/authorization/authorization-models.d.ts +76 -33
  33. package/dist/models/authorization/authorization-models.d.ts.map +1 -1
  34. package/dist/models/authorization/authorization-models.js +80 -12
  35. package/dist/models/rules/share-rule-models.d.ts.map +1 -1
  36. package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts +14 -0
  37. package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -0
  38. package/dist/transactions/authority/create-safe-transaction-authority-data.js +21 -0
  39. package/dist/transactions/authority/create-safe-transaction-authority.d.ts +15 -0
  40. package/dist/transactions/authority/create-safe-transaction-authority.d.ts.map +1 -0
  41. package/dist/transactions/authority/create-safe-transaction-authority.js +29 -0
  42. package/dist/transactions/index.d.ts +3 -0
  43. package/dist/transactions/index.d.ts.map +1 -0
  44. package/dist/transactions/index.js +20 -0
  45. package/package.json +2 -2
@@ -1,4 +1,122 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.IDatabaseDeleteItemSchema = exports.IDatabaseGetInformationSchema = exports.IDatabaseQueryFieldsSchema = exports.IDatabaseOrderBySchema = exports.IDatabaseGetItemSchema = exports.WhereFilterOpSchema = exports.OrderByDirectionSchema = exports.IDatabaseUpdatesSchema = exports.IDatabaseRecordAndRefSchema = exports.IDatabasePropertyChangeInformationSchema = exports.IDatabaseChangeInformationSchema = exports.IDatabaseAuditLogUpdatesSchema = void 0;
27
+ const admin = __importStar(require("firebase-admin"));
28
+ const zod_1 = require("zod");
29
+ const firestore_1 = require("firebase-admin/firestore");
30
+ const application_audit_log_models_1 = require("../audit-log/application-audit-log-models");
31
+ //#region Backend Data Models
32
+ //#region Audit Log Information
33
+ /**
34
+ * This contains the additional information audit logs.
35
+ */
36
+ exports.IDatabaseAuditLogUpdatesSchema = zod_1.z.object({
37
+ alai: zod_1.z.array(application_audit_log_models_1.AdditionalApplicationAuditLogIdsSchema), // the additional application audit log ids
38
+ auditLogSubType: application_audit_log_models_1.ApplicationAuditLogSubTypeSchema, // the audit log sub type
39
+ });
3
40
  //#endregion Audit Log Information
4
- //#endregion Backend Data Models
41
+ //#region Database Change Information
42
+ /**
43
+ * This contains the information that is needed to pass a change to the generic database functions.
44
+ */
45
+ exports.IDatabaseChangeInformationSchema = zod_1.z.object({
46
+ alai: zod_1.z.array(application_audit_log_models_1.AdditionalApplicationAuditLogIdsSchema), // the additional application audit log ids
47
+ auditLogSubType: application_audit_log_models_1.ApplicationAuditLogSubTypeSchema, // the audit log sub type
48
+ item: zod_1.z.unknown(), // the item to add to the database
49
+ itemDocRef: zod_1.z.custom(arg => arg instanceof firestore_1.DocumentReference), // the item document reference (where to add the item to the database)
50
+ });
51
+ /**
52
+ * This contains the information that is needed to pass a change to the generic database functions.
53
+ * It allows for a property of an object to be retrieved and updated without needing the original
54
+ * object when called.
55
+ */
56
+ exports.IDatabasePropertyChangeInformationSchema = zod_1.z.object({
57
+ alai: zod_1.z.array(application_audit_log_models_1.AdditionalApplicationAuditLogIdsSchema), // the additional application audit log ids
58
+ auditLogSubType: application_audit_log_models_1.ApplicationAuditLogSubTypeSchema, // the audit log sub type
59
+ partialObjectUpdate: zod_1.z.any(), // the partial object to update
60
+ itemDocRef: zod_1.z.custom(arg => arg instanceof firestore_1.DocumentReference), // the item document reference (where to add the item to the database)
61
+ });
62
+ /**
63
+ * This contains the information for a record and its reference
64
+ */
65
+ exports.IDatabaseRecordAndRefSchema = zod_1.z.object({
66
+ record: zod_1.z.unknown(), // the record to update
67
+ recordDocRef: zod_1.z.custom(arg => arg instanceof firestore_1.DocumentReference), // the record document reference
68
+ });
69
+ /**
70
+ * This contains the information records and audit logs for database changes
71
+ */
72
+ exports.IDatabaseUpdatesSchema = zod_1.z.object({
73
+ recordsandRefs: zod_1.z.array(exports.IDatabaseRecordAndRefSchema), // the record to update
74
+ auditLogInfo: application_audit_log_models_1.IApplicationAuditLogSchema, // the audit logs to add
75
+ });
76
+ //#endregion Database Change Information
77
+ //#region Database Get Information
78
+ // Define the OrderByDirection schema
79
+ exports.OrderByDirectionSchema = zod_1.z.enum(['desc', 'asc']);
80
+ // Define the WhereFilterOpSchema schema
81
+ exports.WhereFilterOpSchema = zod_1.z.enum(['<', '<=', '==', '!=', '>=', '>', 'array-contains', 'in', 'not-in', 'array-contains-any']);
82
+ /**
83
+ * This contains the information to get a single item from the database.
84
+ */
85
+ exports.IDatabaseGetItemSchema = exports.IDatabaseAuditLogUpdatesSchema.extend({
86
+ itemDocRef: zod_1.z.custom(arg => arg instanceof firestore_1.DocumentReference), // the document reference to get the item from
87
+ throwErrorOnNotFound: zod_1.z.boolean(), // if true, then throw an error if the item is not found.
88
+ });
89
+ /**
90
+ * This contains the information that is needed to get information from the database.
91
+ */
92
+ exports.IDatabaseOrderBySchema = zod_1.z.object({
93
+ fieldPath: zod_1.z.union([zod_1.z.string(), zod_1.z.instanceof(admin.firestore.FieldPath)]), // the field to order by
94
+ direction: exports.OrderByDirectionSchema, // the direction to order by
95
+ });
96
+ /**
97
+ * This contains the query information for the database if it is required
98
+ */
99
+ exports.IDatabaseQueryFieldsSchema = zod_1.z.object({
100
+ fieldPath: zod_1.z.union([zod_1.z.string(), zod_1.z.instanceof(admin.firestore.FieldPath)]),
101
+ opStr: exports.WhereFilterOpSchema,
102
+ value: zod_1.z.any(),
103
+ });
104
+ /**
105
+ * This contains the information that is needed to get multiple items from the database.
106
+ */
107
+ exports.IDatabaseGetInformationSchema = exports.IDatabaseAuditLogUpdatesSchema.extend({
108
+ itemColRef: zod_1.z.custom(arg => arg instanceof firestore_1.CollectionReference), // the collection reference to get the items from
109
+ lastId: zod_1.z.string(), // the last id to get the next set of items.
110
+ orderBy: exports.IDatabaseOrderBySchema.optional(), // how to order the items
111
+ queryFields: zod_1.z.array(exports.IDatabaseQueryFieldsSchema), // the fields to query
112
+ isMaxSizeDocumentSet: zod_1.z.boolean().optional(), // if true, then the max size document the max number of docs to return
113
+ });
114
+ //#endregion Database Get Information
115
+ //#region Database Delete Information
116
+ /**
117
+ * This contains the information to delete a single item from the database.
118
+ */
119
+ exports.IDatabaseDeleteItemSchema = exports.IDatabaseAuditLogUpdatesSchema.extend({
120
+ itemDocRef: zod_1.z.custom(arg => arg instanceof firestore_1.DocumentReference), // the document reference to get the item to delete
121
+ throwErrorOnNotFound: zod_1.z.boolean(), // if true, then throw an error if the item is not found.
122
+ });
@@ -1,81 +1,124 @@
1
+ import { z } from 'zod';
1
2
  /**
2
3
  * This is the authorities that can be validated with incoming requests.
3
4
  * it is AuthorityName Declaration-with ending of the original hex version of the publickey, publickey for the authority
4
5
  */
5
- export type IJWTAuthority = Map<IAuthorizationIssuer, string>;
6
+ export declare const JWTAuthoritySchema: z.ZodMap<z.ZodString, z.ZodString>;
7
+ export type IJWTAuthority = z.infer<typeof JWTAuthoritySchema>;
6
8
  /**
7
9
  * This contains the types of validation that can be done on the authority.
8
10
  */
9
11
  export declare enum AuthorityValidationType {
10
- JWT = "jwt"
12
+ JWT = "JWT"
11
13
  }
14
+ export declare const AuthorityValidationTypeSchema: z.ZodEnum<[AuthorityValidationType]>;
12
15
  /**
13
16
  * This is the payload for the jwt.
14
17
  */
15
- export interface IAuthorizationPayload {
16
- [key: string]: any;
17
- }
18
+ export declare const AuthorizationPayloadSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
19
+ export type IAuthorizationPayload = z.infer<typeof AuthorizationPayloadSchema>;
18
20
  /**
19
21
  * This is the header for the jwt.
20
22
  */
21
- export interface IAuthorizationHeader {
23
+ export declare const AuthorizationHeaderSchema: z.ZodObject<{
24
+ alg: z.ZodString;
25
+ typ: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
22
27
  alg: string;
23
28
  typ: string;
24
- }
29
+ }, {
30
+ alg: string;
31
+ typ: string;
32
+ }>;
33
+ export type IAuthorizationHeader = z.infer<typeof AuthorizationHeaderSchema>;
25
34
  /**
26
35
  * This is the audience that the jwt is intended for.
27
36
  */
28
37
  export declare enum AuthorizationAudience {
29
- AUTHORITIES = "authorities",// the authorities in the SAFE Ecosystem
30
- SHAREDATA = "sharedata",// the Share Data in the SAFE Ecosystem
31
- FUNCTIONS = "functions",// the functions in the SAFE Ecosystem
32
- RULES = "rules",// the rules in the SAFE Ecosystem
33
- EVENTS = "events",// the events in the SAFE Ecosystem
34
- ENDPOINTS = "endpoints"
38
+ AUTHORITIES = "AUTHORITIES",
39
+ SHAREDATA = "SHAREDATA",
40
+ FUNCTIONS = "FUNCTIONS",
41
+ RULES = "RULES",
42
+ EVENTS = "EVENTS",
43
+ ENDPOINTS = "ENDPOINTS"
35
44
  }
45
+ export declare const AuthorizationAudienceSchema: z.ZodEnum<[AuthorizationAudience.AUTHORITIES, AuthorizationAudience.SHAREDATA, AuthorizationAudience.FUNCTIONS, AuthorizationAudience.RULES, AuthorizationAudience.EVENTS, AuthorizationAudience.ENDPOINTS]>;
36
46
  /**
37
47
  * This contains the start of the subject for the authorization subject
38
48
  */
39
49
  export declare enum AuthorizationSubjectStart {
40
- USER = "user",
41
- SAFE_NETWORK = "safe-network"
50
+ USER = "USER",
51
+ SAFE_NETWORK = "SAFE_NETWORK"
42
52
  }
53
+ export declare const AuthorizationSubjectStartSchema: z.ZodEnum<[AuthorizationSubjectStart.USER, AuthorizationSubjectStart.SAFE_NETWORK]>;
43
54
  /**
44
55
  * This type represents the formatted authorization subject.
45
56
  */
46
- export type IAuthorizationSubject = `${AuthorizationSubjectStart}:${string}`;
57
+ export declare const AuthorizationSubjectSchema: z.ZodString;
58
+ export type IAuthorizationSubject = z.infer<typeof AuthorizationSubjectSchema>;
47
59
  /**
48
60
  * This is the issuer of the token.
49
61
  */
50
- export type IAuthorizationIssuer = `${string}-${string}`;
62
+ export declare const AuthorizationIssuerSchema: z.ZodString;
63
+ export type IAuthorizationIssuer = z.infer<typeof AuthorizationIssuerSchema>;
51
64
  /**
52
65
  * Any custom network claims that are added to the token.
53
66
  */
54
- export interface ICustomClaims {
55
- [key: string]: any;
56
- }
67
+ export declare const CustomClaimsSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
68
+ export type ICustomClaims = z.infer<typeof CustomClaimsSchema>;
57
69
  /**
58
70
  * This interface represents the valid safe token payload (after deconstructing the jwt token).
59
71
  */
60
- export interface IValidSafeTokenPayload {
61
- [key: string]: any;
72
+ export declare const ValidSafeTokenPayloadSchema: z.ZodObject<{
73
+ aud: z.ZodEnum<[AuthorizationAudience.AUTHORITIES, AuthorizationAudience.SHAREDATA, AuthorizationAudience.FUNCTIONS, AuthorizationAudience.RULES, AuthorizationAudience.EVENTS, AuthorizationAudience.ENDPOINTS]>;
74
+ exp: z.ZodNumber;
75
+ iat: z.ZodNumber;
76
+ nbf: z.ZodNumber;
77
+ sub: z.ZodString;
78
+ iss: z.ZodString;
79
+ }, "strip", z.ZodAny, z.objectOutputType<{
80
+ aud: z.ZodEnum<[AuthorizationAudience.AUTHORITIES, AuthorizationAudience.SHAREDATA, AuthorizationAudience.FUNCTIONS, AuthorizationAudience.RULES, AuthorizationAudience.EVENTS, AuthorizationAudience.ENDPOINTS]>;
81
+ exp: z.ZodNumber;
82
+ iat: z.ZodNumber;
83
+ nbf: z.ZodNumber;
84
+ sub: z.ZodString;
85
+ iss: z.ZodString;
86
+ }, z.ZodAny, "strip">, z.objectInputType<{
87
+ aud: z.ZodEnum<[AuthorizationAudience.AUTHORITIES, AuthorizationAudience.SHAREDATA, AuthorizationAudience.FUNCTIONS, AuthorizationAudience.RULES, AuthorizationAudience.EVENTS, AuthorizationAudience.ENDPOINTS]>;
88
+ exp: z.ZodNumber;
89
+ iat: z.ZodNumber;
90
+ nbf: z.ZodNumber;
91
+ sub: z.ZodString;
92
+ iss: z.ZodString;
93
+ }, z.ZodAny, "strip">>;
94
+ export type IValidSafeTokenPayload = z.infer<typeof ValidSafeTokenPayloadSchema>;
95
+ /**
96
+ * This is the decoded jwt token.
97
+ */
98
+ export declare const DecodedJwtTokenSchema: z.ZodObject<{
99
+ customClaims: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
100
+ aud: z.ZodEnum<[AuthorizationAudience.AUTHORITIES, AuthorizationAudience.SHAREDATA, AuthorizationAudience.FUNCTIONS, AuthorizationAudience.RULES, AuthorizationAudience.EVENTS, AuthorizationAudience.ENDPOINTS]>;
101
+ exp: z.ZodNumber;
102
+ iat: z.ZodNumber;
103
+ nbf: z.ZodNumber;
104
+ sub: z.ZodString;
105
+ iss: z.ZodString;
106
+ }, "strip", z.ZodTypeAny, {
62
107
  aud: AuthorizationAudience;
63
108
  exp: number;
64
109
  iat: number;
65
110
  nbf: number;
66
- sub: IAuthorizationSubject;
67
- iss: IAuthorizationIssuer;
68
- }
69
- /**
70
- * This is the decoded jwt token.
71
- */
72
- export interface IDecodedJwtToken {
73
- customClaims?: ICustomClaims;
111
+ sub: string;
112
+ iss: string;
113
+ customClaims?: Record<string, any> | undefined;
114
+ }, {
74
115
  aud: AuthorizationAudience;
75
116
  exp: number;
76
117
  iat: number;
77
118
  nbf: number;
78
- sub: IAuthorizationSubject;
79
- iss: IAuthorizationIssuer;
80
- }
119
+ sub: string;
120
+ iss: string;
121
+ customClaims?: Record<string, any> | undefined;
122
+ }>;
123
+ export type IDecodedJwtToken = z.infer<typeof DecodedJwtTokenSchema>;
81
124
  //# sourceMappingURL=authorization-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-models.d.ts","sourceRoot":"","sources":["../../../src/models/authorization/authorization-models.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAG9D;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,GAAG,QAAQ;CACd;AAOD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC7B,WAAW,gBAAgB,CAAE,wCAAwC;IACrE,SAAS,cAAc,CAAE,uCAAuC;IAChE,SAAS,cAAc,CAAE,sCAAsC;IAC/D,KAAK,UAAU,CAAE,kCAAkC;IACnD,MAAM,WAAW,CAAE,mCAAmC;IACtD,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,oBAAY,yBAAyB;IACjC,IAAI,SAAS;IACb,YAAY,iBAAiB;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,GAAG,yBAAyB,IAAI,MAAM,EAAE,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAIzD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,oBAAoB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,oBAAoB,CAAC;CAC7B"}
1
+ {"version":3,"file":"authorization-models.d.ts","sourceRoot":"","sources":["../../../src/models/authorization/authorization-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,oCAAgC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,GAAG,QAAQ;CACd;AAED,eAAO,MAAM,6BAA6B,sCAAwC,CAAC;AAMnF;;GAEG;AACH,eAAO,MAAM,0BAA0B,oCAAoB,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E;;GAEG;AACH,eAAO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Property(exports, "__esModule", { value: true });
4
- exports.AuthorizationSubjectStart = exports.AuthorizationAudience = exports.AuthorityValidationType = void 0;
3
+ exports.DecodedJwtTokenSchema = exports.ValidSafeTokenPayloadSchema = exports.CustomClaimsSchema = exports.AuthorizationIssuerSchema = exports.AuthorizationSubjectSchema = exports.AuthorizationSubjectStartSchema = exports.AuthorizationSubjectStart = exports.AuthorizationAudienceSchema = exports.AuthorizationAudience = exports.AuthorizationHeaderSchema = exports.AuthorizationPayloadSchema = exports.AuthorityValidationTypeSchema = exports.AuthorityValidationType = exports.JWTAuthoritySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ //#region Authorities
6
+ /**
7
+ * This is the authorities that can be validated with incoming requests.
8
+ * it is AuthorityName Declaration-with ending of the original hex version of the publickey, publickey for the authority
9
+ */
10
+ exports.JWTAuthoritySchema = zod_1.z.map(zod_1.z.string(), zod_1.z.string());
5
11
  /**
6
12
  * This contains the types of validation that can be done on the authority.
7
13
  */
8
14
  var AuthorityValidationType;
9
15
  (function (AuthorityValidationType) {
10
- AuthorityValidationType["JWT"] = "jwt";
16
+ AuthorityValidationType["JWT"] = "JWT";
11
17
  })(AuthorityValidationType || (exports.AuthorityValidationType = AuthorityValidationType = {}));
18
+ exports.AuthorityValidationTypeSchema = zod_1.z.enum([AuthorityValidationType.JWT]);
19
+ //#endregion Authorities
20
+ //#region jwt models
21
+ /**
22
+ * This is the payload for the jwt.
23
+ */
24
+ exports.AuthorizationPayloadSchema = zod_1.z.record(zod_1.z.any());
25
+ /**
26
+ * This is the header for the jwt.
27
+ */
28
+ exports.AuthorizationHeaderSchema = zod_1.z.object({
29
+ alg: zod_1.z.string(),
30
+ typ: zod_1.z.string(),
31
+ });
12
32
  /**
13
33
  * This is the audience that the jwt is intended for.
14
34
  */
15
35
  var AuthorizationAudience;
16
36
  (function (AuthorizationAudience) {
17
- AuthorizationAudience["AUTHORITIES"] = "authorities";
18
- AuthorizationAudience["SHAREDATA"] = "sharedata";
19
- AuthorizationAudience["FUNCTIONS"] = "functions";
20
- AuthorizationAudience["RULES"] = "rules";
21
- AuthorizationAudience["EVENTS"] = "events";
22
- AuthorizationAudience["ENDPOINTS"] = "endpoints";
37
+ AuthorizationAudience["AUTHORITIES"] = "AUTHORITIES";
38
+ AuthorizationAudience["SHAREDATA"] = "SHAREDATA";
39
+ AuthorizationAudience["FUNCTIONS"] = "FUNCTIONS";
40
+ AuthorizationAudience["RULES"] = "RULES";
41
+ AuthorizationAudience["EVENTS"] = "EVENTS";
42
+ AuthorizationAudience["ENDPOINTS"] = "ENDPOINTS";
23
43
  })(AuthorizationAudience || (exports.AuthorizationAudience = AuthorizationAudience = {}));
44
+ exports.AuthorizationAudienceSchema = zod_1.z.enum([
45
+ AuthorizationAudience.AUTHORITIES,
46
+ AuthorizationAudience.SHAREDATA,
47
+ AuthorizationAudience.FUNCTIONS,
48
+ AuthorizationAudience.RULES,
49
+ AuthorizationAudience.EVENTS,
50
+ AuthorizationAudience.ENDPOINTS,
51
+ ]);
24
52
  /**
25
53
  * This contains the start of the subject for the authorization subject
26
54
  */
27
55
  var AuthorizationSubjectStart;
28
56
  (function (AuthorizationSubjectStart) {
29
- AuthorizationSubjectStart["USER"] = "user";
30
- AuthorizationSubjectStart["SAFE_NETWORK"] = "safe-network";
57
+ AuthorizationSubjectStart["USER"] = "USER";
58
+ AuthorizationSubjectStart["SAFE_NETWORK"] = "SAFE_NETWORK";
31
59
  })(AuthorizationSubjectStart || (exports.AuthorizationSubjectStart = AuthorizationSubjectStart = {}));
32
- //#region jwt header models
60
+ exports.AuthorizationSubjectStartSchema = zod_1.z.enum([
61
+ AuthorizationSubjectStart.USER,
62
+ AuthorizationSubjectStart.SAFE_NETWORK
63
+ ]);
64
+ /**
65
+ * This type represents the formatted authorization subject.
66
+ */
67
+ exports.AuthorizationSubjectSchema = zod_1.z.string().regex(/^(USER|SAFE_NETWORK):.+$/);
68
+ /**
69
+ * This is the issuer of the token.
70
+ */
71
+ exports.AuthorizationIssuerSchema = zod_1.z.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
72
+ //#region jwt token models
73
+ /**
74
+ * Any custom network claims that are added to the token.
75
+ */
76
+ exports.CustomClaimsSchema = zod_1.z.record(zod_1.z.any());
77
+ /**
78
+ * This interface represents the valid safe token payload (after deconstructing the jwt token).
79
+ */
80
+ exports.ValidSafeTokenPayloadSchema = zod_1.z.object({
81
+ aud: exports.AuthorizationAudienceSchema, // the audience of the token
82
+ exp: zod_1.z.number(), // the expiration time of the token
83
+ iat: zod_1.z.number(), // the issued at time of the token
84
+ nbf: zod_1.z.number(), // the not before time of the token
85
+ sub: exports.AuthorizationSubjectSchema, // the subject of the token
86
+ iss: exports.AuthorizationIssuerSchema, // the issuer of the token
87
+ }).catchall(zod_1.z.any()); // any other information that was added to the token
88
+ /**
89
+ * This is the decoded jwt token.
90
+ */
91
+ exports.DecodedJwtTokenSchema = zod_1.z.object({
92
+ customClaims: exports.CustomClaimsSchema.optional(), // the custom claims of the token
93
+ aud: exports.AuthorizationAudienceSchema, // the audience of the token
94
+ exp: zod_1.z.number(), // the expiration time of the token
95
+ iat: zod_1.z.number(), // the issued at time of the token
96
+ nbf: zod_1.z.number(), // the not before time of the token
97
+ sub: exports.AuthorizationSubjectSchema, // the subject of the token
98
+ iss: exports.AuthorizationIssuerSchema, // the issuer of the token
99
+ });
100
+ //#endregion jwt token models
33
101
  //#endregion jwt models
@@ -1 +1 @@
1
- {"version":3,"file":"share-rule-models.d.ts","sourceRoot":"","sources":["../../../src/models/rules/share-rule-models.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,uBAAuB,EAAE,UAAU,EAAE,CAAC;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,wBAAwB,EAAE,UAAU,EAAE,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,2B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C,KAAK,CAAC;IACzC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD,aAAa,EAAE,kBAAkB,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC;IAC5C,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CAChD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC5D,aAAa,EAAE,2BAA2B,CAAC;IAC3C,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IAClD,aAAa,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACrD,aAAa,EAAE,oBAAoB,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD,aAAa,EAAE,mBAAmB,CAAC,KAAK,CAAC;CAC5C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACrD,aAAa,EAAE,oBAAoB,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACvD,aAAa,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAC9C,cAAc,EAAE,UAAU,CAAC;CAC9B"}
1
+ {"version":3,"file":"share-rule-models.d.ts","sourceRoot":"","sources":["../../../src/models/rules/share-rule-models.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH;;GAEG;AACH,M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,mBAAoB,SAAQ,cAAc;IACvD,aAAa,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAC9C,cAAc,EAAE,UAAU,CAAC;CAC9B"}
@@ -0,0 +1,14 @@
1
+ import { AuthorityValidationType, IAuthorizationIssuer } from '../../models/authorization/authorization-models';
2
+ import { ISAFETransactionAuthorityData, SAFETransactionType } from '../../models/safe/safe-transaction-models';
3
+ /**
4
+ * This function creates the SAFE transaction authority data object
5
+ *
6
+ * @param authorizationIssuer the authorization issuer that is being targeted by the transaction
7
+ * @param authorizationPublicKey the public key of the authority that is being targeted by the transaction
8
+ * @param authorityValidationType the authority validation type thaat is being added
9
+ * @param authorityOver what the public key will have authority over.
10
+ * @returns
11
+ */
12
+ declare const createSafeTransactionAuthorityData: (authorizationIssuer: IAuthorizationIssuer, authorizationPublicKey: string, authorityValidationType: AuthorityValidationType, authorityOver: SAFETransactionType[]) => ISAFETransactionAuthorityData;
13
+ export { createSafeTransactionAuthorityData };
14
+ //# sourceMappingURL=create-safe-transaction-authority-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-safe-transaction-authority-data.d.ts","sourceRoot":"","sources":["../../../src/transactions/authority/create-safe-transaction-authority-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,uBAAuB,EACvB,oBAAoB,EACvB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACH,6BAA6B,EAC7B,mBAAmB,EAEtB,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;GAQG;AACH,QAAA,MAAM,kCAAkC,wBACf,oBAAoB,0BACjB,MAAM,2BACL,uBAAuB,iBACjC,mBAAmB,EAAE,KACrC,6BAOF,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSafeTransactionAuthorityData = void 0;
4
+ /**
5
+ * This function creates the SAFE transaction authority data object
6
+ *
7
+ * @param authorizationIssuer the authorization issuer that is being targeted by the transaction
8
+ * @param authorizationPublicKey the public key of the authority that is being targeted by the transaction
9
+ * @param authorityValidationType the authority validation type thaat is being added
10
+ * @param authorityOver what the public key will have authority over.
11
+ * @returns
12
+ */
13
+ const createSafeTransactionAuthorityData = (authorizationIssuer, authorizationPublicKey, authorityValidationType, authorityOver) => {
14
+ return {
15
+ authorizationIssuer,
16
+ authorizationPublicKey,
17
+ authorityValidationType,
18
+ authorityOver,
19
+ };
20
+ };
21
+ exports.createSafeTransactionAuthorityData = createSafeTransactionAuthorityData;
@@ -0,0 +1,15 @@
1
+ import { ISAFETransactionAuthority, ISAFETransactionAuthorityData, SAFETransactionActionType } from '../../models/safe/safe-transaction-models';
2
+ /**
3
+ * This function creates the SAFE transaction authority object transaction
4
+ *
5
+ * @param authorityPublicKey the public key of the authority that created the transaction
6
+ * @param authoritySignature the signature of the authority that created the transaction
7
+ * @param transactionAction the action to perform on the transaction
8
+ * @param data the data for the authority transaction
9
+ * @param version the version of the transaction (default to 1)
10
+ * @param createdAt the time the transaction was created (in milliseconds) (default to now)
11
+ * @returns
12
+ */
13
+ declare const createSafeTransactionAuthority: (authorityPublicKey: string, authoritySignature: string, transactionAction: SAFETransactionActionType, data: ISAFETransactionAuthorityData, version?: number, createdAt?: number) => ISAFETransactionAuthority;
14
+ export { createSafeTransactionAuthority };
15
+ //# sourceMappingURL=create-safe-transaction-authority.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-safe-transaction-authority.d.ts","sourceRoot":"","sources":["../../../src/transactions/authority/create-safe-transaction-authority.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAC7B,yBAAyB,EAE5B,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,QAAA,MAAM,8BAA8B,uBACZ,MAAM,sBACN,MAAM,qBACP,yBAAyB,QACtC,6BAA6B,2CAGpC,yBAYF,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSafeTransactionAuthority = void 0;
4
+ const safe_transaction_models_1 = require("../../models/safe/safe-transaction-models");
5
+ /**
6
+ * This function creates the SAFE transaction authority object transaction
7
+ *
8
+ * @param authorityPublicKey the public key of the authority that created the transaction
9
+ * @param authoritySignature the signature of the authority that created the transaction
10
+ * @param transactionAction the action to perform on the transaction
11
+ * @param data the data for the authority transaction
12
+ * @param version the version of the transaction (default to 1)
13
+ * @param createdAt the time the transaction was created (in milliseconds) (default to now)
14
+ * @returns
15
+ */
16
+ const createSafeTransactionAuthority = (authorityPublicKey, authoritySignature, transactionAction, data, version = 1, createdAt = Date.now()) => {
17
+ return {
18
+ authority: authorityPublicKey,
19
+ authoritySignature,
20
+ createdAt,
21
+ transaction: {
22
+ action: transactionAction,
23
+ data,
24
+ type: safe_transaction_models_1.SAFETransactionType.AUTHORITY,
25
+ },
26
+ version,
27
+ };
28
+ };
29
+ exports.createSafeTransactionAuthority = createSafeTransactionAuthority;
@@ -0,0 +1,3 @@
1
+ export * from './authority/create-safe-transaction-authority';
2
+ export * from './authority/create-safe-transaction-authority-data';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AACA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oDAAoD,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ //#region Authority
18
+ __exportStar(require("./authority/create-safe-transaction-authority"), exports);
19
+ __exportStar(require("./authority/create-safe-transaction-authority-data"), exports);
20
+ //#endregion Authority
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degenerate/generic",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "This contains the generic information needed for the ShareData Adaptive Framework Ecosystem (SAFE) network",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,5 +53,5 @@
53
53
  "firebase-functions": "^6.1.0",
54
54
  "jsonwebtoken": "^9.0.2"
55
55
  },
56
- "gitHead": "97a0ffd55ceb8dfb323efdd4b9de181511261902"
56
+ "gitHead": "2c7096896ce9690807a9b492c6fbd20dbed47b0b"
57
57
  }