@degenerate/endpoints 0.0.10 → 0.0.12

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 (61) hide show
  1. package/README.md +27 -2
  2. package/dist/__tests__/jest.setup.d.ts +10 -0
  3. package/dist/__tests__/jest.setup.d.ts.map +1 -0
  4. package/dist/__tests__/jest.setup.js +2 -0
  5. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts +2 -2
  6. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -1
  7. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts +16 -0
  8. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts.map +1 -0
  9. package/dist/cors/authority/jwt/validate-jwt-endpoints.js +32 -0
  10. package/dist/cors/authority/jwt/validate-jwt-events.d.ts +16 -0
  11. package/dist/cors/authority/jwt/validate-jwt-events.d.ts.map +1 -0
  12. package/dist/cors/authority/jwt/validate-jwt-events.js +32 -0
  13. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts +16 -0
  14. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts.map +1 -0
  15. package/dist/cors/authority/jwt/validate-jwt-functions.js +32 -0
  16. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts +16 -0
  17. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts.map +1 -0
  18. package/dist/cors/authority/jwt/validate-jwt-rules.js +32 -0
  19. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts +16 -0
  20. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts.map +1 -0
  21. package/dist/cors/authority/jwt/validate-jwt-share-data.js +32 -0
  22. package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts.map +1 -1
  23. package/dist/cors/endpoints/helpers/validate-incoming-request-data.js +1 -0
  24. package/dist/cors/index.d.ts +12 -4
  25. package/dist/cors/index.d.ts.map +1 -1
  26. package/dist/cors/index.js +20 -6
  27. package/dist/cors/logging/add-unique-tracking.d.ts +11 -0
  28. package/dist/cors/logging/add-unique-tracking.d.ts.map +1 -0
  29. package/dist/cors/logging/add-unique-tracking.js +18 -0
  30. package/dist/cors/logging/request-logging.d.ts +11 -0
  31. package/dist/cors/logging/request-logging.d.ts.map +1 -0
  32. package/dist/cors/logging/request-logging.js +26 -0
  33. package/dist/cors/routes/authorities/v1.routes.d.ts +2 -0
  34. package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -0
  35. package/dist/cors/routes/authorities/v1.routes.js +88 -0
  36. package/dist/cors/routes/authorities.routes.d.ts.map +1 -1
  37. package/dist/cors/routes/authorities.routes.js +8 -61
  38. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts +2 -0
  39. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts.map +1 -0
  40. package/dist/cors/routes/rules/v1/rule-set.routes.js +104 -0
  41. package/dist/cors/routes/rules/v1.routes.d.ts +2 -0
  42. package/dist/cors/routes/rules/v1.routes.d.ts.map +1 -0
  43. package/dist/cors/routes/rules/v1.routes.js +44 -0
  44. package/dist/cors/routes/rules.routes.d.ts.map +1 -1
  45. package/dist/cors/routes/rules.routes.js +6 -24
  46. package/dist/schema/rules-transactions.schema.d.ts +278 -0
  47. package/dist/schema/rules-transactions.schema.d.ts.map +1 -0
  48. package/dist/schema/rules-transactions.schema.js +63 -0
  49. package/dist/schema/transactions.schema.d.ts +44 -0
  50. package/dist/schema/transactions.schema.d.ts.map +1 -0
  51. package/dist/schema/transactions.schema.js +41 -0
  52. package/package.json +3 -3
  53. package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts +0 -30
  54. package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +0 -1
  55. package/dist/cors/endpoints/authorities/validate-authorities-transaction.js +0 -155
  56. package/dist/schema/authorities.schema.d.ts +0 -343
  57. package/dist/schema/authorities.schema.d.ts.map +0 -1
  58. package/dist/schema/authorities.schema.js +0 -84
  59. package/dist/schema/transaction.schema.d.ts +0 -8
  60. package/dist/schema/transaction.schema.d.ts.map +0 -1
  61. package/dist/schema/transaction.schema.js +0 -28
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionBaseSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
7
- // This contains the schemas for the authorities objects in the zod format..
8
- const zod_1 = __importDefault(require("zod"));
9
- const transaction_schema_1 = require("./transaction.schema");
10
- const generic_1 = require("@degenerate/generic");
11
- const IAuthorizationIssuerSchema = zod_1.default.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
12
- const AuthorityValidationTypeSchema = zod_1.default.enum([generic_1.AuthorityValidationType.JWT]);
13
- /**
14
- * This is the data for the authority in the SAFE Ecosystem.
15
- */
16
- exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
17
- authorizationIssuer: IAuthorizationIssuerSchema,
18
- authorizationPublicKey: zod_1.default.string(),
19
- authorityValidationType: AuthorityValidationTypeSchema,
20
- authorityOver: zod_1.default.array(transaction_schema_1.SAFETransactionTypeSchema),
21
- });
22
- /**
23
- * This is the schema for the SAFE transaction base.
24
- */
25
- exports.ISAFETransactionBaseSchema = zod_1.default.object({
26
- createdAt: zod_1.default.number(), // the javascript timestamp of when the transaction was created
27
- authority: zod_1.default.string(), // the public key of the authority that created the transaction
28
- authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
29
- transaction: zod_1.default.object({
30
- type: transaction_schema_1.SAFETransactionTypeSchema, // the type of transaction
31
- action: transaction_schema_1.SAFETransactionActionTypeSchema, // the action to perform on the transaction
32
- }),
33
- version: zod_1.default.number(), // the version of the transaction
34
- });
35
- /**
36
- * This is the transaction targetting an authority in the SAFE Ecosystem.
37
- *
38
- const sampleTransactionAuthority: ISAFETransactionAuthority = {
39
- createdAt: Date.now(),
40
- authority: '0xAuthorityPublicKey',
41
- authoritySignature: '0xAuthoritySignature',
42
- transaction: {
43
- type: SAFETransactionType.AUTHORITY,
44
- action: SAFETransactionActionType.CREATE,
45
- data: {
46
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
47
- authorizationPublicKey: '0xAuthorizationPublicKey',
48
- authorityValidationType: AuthorityValidationType.JWT,
49
- authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
50
- },
51
- },
52
- version: 1,
53
- };
54
- */
55
- /**
56
- * This is the schema for the authority transaction add.
57
- */
58
- exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionBaseSchema.extend({
59
- transaction: zod_1.default.object({
60
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
61
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.ADD),
62
- data: exports.ISAFETransactionAuthorityDataSchema,
63
- }),
64
- });
65
- /**
66
- * This is the schema for the authority transaction update.
67
- */
68
- exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionBaseSchema.extend({
69
- transaction: zod_1.default.object({
70
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
71
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.UPDATE),
72
- data: exports.ISAFETransactionAuthorityDataSchema,
73
- }),
74
- });
75
- /**
76
- * This is the schema for the authority transaction remove.
77
- */
78
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionBaseSchema.extend({
79
- transaction: zod_1.default.object({
80
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
81
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.REMOVE),
82
- data: exports.ISAFETransactionAuthorityDataSchema,
83
- }),
84
- });
@@ -1,8 +0,0 @@
1
- import z from 'zod';
2
- import { SAFETransactionActionType, SAFETransactionType } from '@degenerate/generic';
3
- export declare const SAFETransactionTypeSchema: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
4
- /**
5
- * This is the type of function that is being targetted in the transaction.
6
- */
7
- export declare const SAFETransactionActionTypeSchema: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
8
- //# sourceMappingURL=transaction.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transaction.schema.d.ts","sourceRoot":"","sources":["../../src/schema/transaction.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACH,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,eAAO,MAAM,yBAAyB,gMAOpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,gHAI1C,CAAC"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
7
- //This file contains the schema for the transaction data in the SAFE Ecosystem in zod format.
8
- const zod_1 = __importDefault(require("zod"));
9
- const generic_1 = require("@degenerate/generic");
10
- //#region Enums
11
- // This is the schema for the authority data.
12
- exports.SAFETransactionTypeSchema = zod_1.default.enum([
13
- generic_1.SAFETransactionType.AUTHORITY,
14
- generic_1.SAFETransactionType.SHAREDATA,
15
- generic_1.SAFETransactionType.FUNCTIONS,
16
- generic_1.SAFETransactionType.RULES,
17
- generic_1.SAFETransactionType.EVENTS,
18
- generic_1.SAFETransactionType.ENDPOINTS,
19
- ]);
20
- /**
21
- * This is the type of function that is being targetted in the transaction.
22
- */
23
- exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
24
- generic_1.SAFETransactionActionType.ADD,
25
- generic_1.SAFETransactionActionType.REMOVE,
26
- generic_1.SAFETransactionActionType.UPDATE,
27
- ]);
28
- //#endregion Enums