@degenerate/generic 0.2.7 → 0.3.2
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/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-multiple-path-alai.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-query-audit-log-for-alai.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.js +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.js +2 -2
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.js +3 -3
- package/dist/application/database/firestore/generics/create-database-change-information.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-item-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-item-from-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-from-database.js +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-properties-on-database.js +2 -2
- package/dist/authorization/index.d.ts +1 -0
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts +7 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts +31 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts.map +1 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.js +50 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -1
- package/dist/crypto/calculate-combined-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.d.ts +1 -1
- package/dist/crypto/calculate-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.js +1 -1
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.js +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts +11 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts.map +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.js +51 -0
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.d.ts +11 -0
- package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.js +14 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.js +8 -2
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-hash.js +7 -1
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -0
- package/dist/errors/share-data/share-data-errors.d.ts +92 -1
- package/dist/errors/share-data/share-data-errors.d.ts.map +1 -1
- package/dist/errors/share-data/share-data-errors.js +130 -1
- package/dist/errors/shareblock/shareblock-errors.d.ts +40 -0
- package/dist/errors/shareblock/shareblock-errors.d.ts.map +1 -0
- package/dist/errors/shareblock/shareblock-errors.js +50 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts +8 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts.map +1 -0
- package/dist/errors/validation/crypto-validation-errors.js +15 -0
- package/dist/helpers/array/array-helpers.d.ts.map +1 -1
- package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -1
- package/dist/helpers/data/data-helpers.d.ts.map +1 -1
- package/dist/helpers/file/file-helpers.d.ts.map +1 -1
- package/dist/helpers/id-helpers.d.ts.map +1 -1
- package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -1
- package/dist/helpers/object-helpers.d.ts.map +1 -1
- package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.d.ts +6 -13
- package/dist/helpers/request/params-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.js +11 -21
- package/dist/helpers/request/query-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/request-object-helpers.d.ts.map +1 -1
- package/dist/models/application/audit-log/application-audit-log-models.d.ts +82 -92
- package/dist/models/application/audit-log/application-audit-log-models.d.ts.map +1 -1
- package/dist/models/application/database/firestore-models.d.ts +158 -307
- package/dist/models/application/database/firestore-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.d.ts +34 -44
- package/dist/models/authorization/authorization-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.js +2 -2
- package/dist/models/crypto/crypto-models.d.ts +1 -7
- package/dist/models/crypto/crypto-models.d.ts.map +1 -1
- package/dist/models/data/data-models.d.ts +27 -13
- package/dist/models/data/data-models.d.ts.map +1 -1
- package/dist/models/data/data-models.js +23 -2
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +1 -9
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.d.ts +91 -120
- package/dist/models/events/share-event-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.js +35 -4
- package/dist/models/functions/share-data-function-models.d.ts +23 -193
- package/dist/models/functions/share-data-function-models.d.ts.map +1 -1
- package/dist/models/functions/share-data-function-models.js +1 -1
- package/dist/models/generic/request-response-models.d.ts +1 -7
- package/dist/models/generic/request-response-models.d.ts.map +1 -1
- package/dist/models/index.d.ts +4 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +4 -1
- package/dist/models/rules/share-rule-models.d.ts +759 -1116
- package/dist/models/rules/share-rule-models.d.ts.map +1 -1
- package/dist/models/rules/share-rule-models.js +6 -6
- package/dist/models/safe/safe-transaction-models.d.ts +28 -30
- package/dist/models/safe/safe-transaction-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts +77 -419
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.js +3 -3
- package/dist/models/safe/transactions/events-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/events-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/events-transactions-models.js +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/functions-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.js +1 -1
- package/dist/models/safe/transactions/rules-transactions-models.d.ts +59 -603
- package/dist/models/safe/transactions/rules-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts +251 -388
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.js +30 -4
- package/dist/models/share-data/share-data-crypto-models.d.ts +307 -0
- package/dist/models/share-data/share-data-crypto-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-crypto-models.js +91 -0
- package/dist/models/share-data/share-data-models.d.ts +114 -0
- package/dist/models/share-data/share-data-models.d.ts.map +1 -0
- package/dist/models/share-data/{share-data.js → share-data-models.js} +1 -1
- package/dist/models/share-data/share-data-persistence-models.d.ts +158 -0
- package/dist/models/share-data/share-data-persistence-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-persistence-models.js +94 -0
- package/dist/models/shareblock/shareblock-models.d.ts +280 -0
- package/dist/models/shareblock/shareblock-models.d.ts.map +1 -0
- package/dist/models/shareblock/shareblock-models.js +222 -0
- package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -1
- package/dist/transactions/authority/create-safe-transaction-authority.d.ts.map +1 -1
- package/package.json +30 -22
- package/dist/models/share-data/share-data.d.ts +0 -181
- package/dist/models/share-data/share-data.d.ts.map +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
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.IShareBlockMarkFullyDistributedInputSchema = exports.IShareBlockDisburseInputSchema = exports.IShareBlockFundInputSchema = exports.IShareBlockRegisterLenderInputSchema = exports.IShareBlockCommitInputSchema = exports.IShareBlockCloseInputSchema = exports.IShareBlockWithdrawInputSchema = exports.IShareBlockDepositInputSchema = exports.IShareBlockInitialStateInputSchema = exports.IShareBlockMetadataSchema = exports.IDistributionShareBlockStateSchema = exports.IFundingShareBlockStateSchema = exports.IShareBlockStateSchema = exports.IShareBlockParticipantSchema = exports.ShareBlockParticipantRoleSchema = exports.ShareBlockParticipantRole = exports.ShareBlockTypeSchema = exports.ShareBlockType = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
//#region Enums
|
|
9
|
+
/**
|
|
10
|
+
* The three ShareBlock specializations the platform uses to move money
|
|
11
|
+
* through a loan's lifecycle.
|
|
12
|
+
*
|
|
13
|
+
* - `Clearing` — neutral holding spot funds pass through before they're
|
|
14
|
+
* committed to either side of a deal. Used to net
|
|
15
|
+
* borrower and lender flows before settling.
|
|
16
|
+
* - `Funding` — the lender-funded pool that backs a specific loan.
|
|
17
|
+
* Holds principal between funding and disbursement.
|
|
18
|
+
* - `Distribution` — the destination ShareBlock that pays principal to a
|
|
19
|
+
* borrower or returns/interest to a lender.
|
|
20
|
+
*
|
|
21
|
+
* New ShareBlock variants should be additive — never re-use a value with new
|
|
22
|
+
* semantics, since downstream rule libraries pattern-match on the literal.
|
|
23
|
+
*/
|
|
24
|
+
var ShareBlockType;
|
|
25
|
+
(function (ShareBlockType) {
|
|
26
|
+
ShareBlockType["Clearing"] = "Clearing";
|
|
27
|
+
ShareBlockType["Funding"] = "Funding";
|
|
28
|
+
ShareBlockType["Distribution"] = "Distribution";
|
|
29
|
+
})(ShareBlockType || (exports.ShareBlockType = ShareBlockType = {}));
|
|
30
|
+
exports.ShareBlockTypeSchema = zod_1.default.enum([
|
|
31
|
+
'Clearing',
|
|
32
|
+
'Funding',
|
|
33
|
+
'Distribution',
|
|
34
|
+
]);
|
|
35
|
+
//#endregion Enums
|
|
36
|
+
//#region Participant
|
|
37
|
+
/**
|
|
38
|
+
* Roles a participant plays inside a ShareBlock. A single party may hold
|
|
39
|
+
* multiple roles across different ShareBlocks (e.g. the same uid is `Lender`
|
|
40
|
+
* on a Funding block and `Recipient` on a Distribution block).
|
|
41
|
+
*/
|
|
42
|
+
var ShareBlockParticipantRole;
|
|
43
|
+
(function (ShareBlockParticipantRole) {
|
|
44
|
+
ShareBlockParticipantRole["Borrower"] = "Borrower";
|
|
45
|
+
ShareBlockParticipantRole["Lender"] = "Lender";
|
|
46
|
+
ShareBlockParticipantRole["Platform"] = "Platform";
|
|
47
|
+
ShareBlockParticipantRole["Recipient"] = "Recipient";
|
|
48
|
+
})(ShareBlockParticipantRole || (exports.ShareBlockParticipantRole = ShareBlockParticipantRole = {}));
|
|
49
|
+
exports.ShareBlockParticipantRoleSchema = zod_1.default.enum([
|
|
50
|
+
'Borrower',
|
|
51
|
+
'Lender',
|
|
52
|
+
'Platform',
|
|
53
|
+
'Recipient',
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* A party in a ShareBlock with their associated role and committed amount.
|
|
57
|
+
* `committedAmount` is the headline contribution promised by the participant;
|
|
58
|
+
* `settledAmount` tracks how much has actually moved (so partial fills are
|
|
59
|
+
* representable). Both are in the ShareBlock's `currency`.
|
|
60
|
+
*/
|
|
61
|
+
exports.IShareBlockParticipantSchema = zod_1.default.object({
|
|
62
|
+
userId: zod_1.default.string(),
|
|
63
|
+
role: exports.ShareBlockParticipantRoleSchema,
|
|
64
|
+
committedAmount: zod_1.default.number().nonnegative(),
|
|
65
|
+
settledAmount: zod_1.default.number().nonnegative(),
|
|
66
|
+
});
|
|
67
|
+
//#endregion Participant
|
|
68
|
+
//#region State
|
|
69
|
+
/**
|
|
70
|
+
* The mutable state carried inside a ShareBlock's `_currentState`. This is
|
|
71
|
+
* the canonical shape rules and functions inspect when proposing changes.
|
|
72
|
+
*
|
|
73
|
+
* - `balance` — funds currently held in the ShareBlock. Never negative.
|
|
74
|
+
* - `currency` — ISO-4217 code (e.g. `'USD'`, `'CAD'`). Pinned at creation.
|
|
75
|
+
* - `isOpen` — whether the ShareBlock will accept further transactions.
|
|
76
|
+
* Closing is irreversible; once `false`, all standard rules
|
|
77
|
+
* reject mutating proposals.
|
|
78
|
+
* - `participants` — committed parties keyed by `userId`. Adding a
|
|
79
|
+
* participant goes through a rule-gated function so the
|
|
80
|
+
* participant list itself is auditable.
|
|
81
|
+
*/
|
|
82
|
+
exports.IShareBlockStateSchema = zod_1.default.object({
|
|
83
|
+
blockType: exports.ShareBlockTypeSchema,
|
|
84
|
+
balance: zod_1.default.number().nonnegative(),
|
|
85
|
+
currency: zod_1.default.string().min(3).max(3),
|
|
86
|
+
isOpen: zod_1.default.boolean(),
|
|
87
|
+
participants: zod_1.default.record(zod_1.default.string(), exports.IShareBlockParticipantSchema),
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Funding-specific extension of `IShareBlockState`. Adds:
|
|
91
|
+
*
|
|
92
|
+
* - `committed` — once `true`, the block's funds are locked: deposits and
|
|
93
|
+
* withdrawals become no-ops, and a "committed-is-monotonic"
|
|
94
|
+
* rule blocks any proposal that flips it back to `false`.
|
|
95
|
+
* - `committedBy` / `committedAt` — audit attribution for the commit moment.
|
|
96
|
+
*
|
|
97
|
+
* Clearing ShareBlocks don't carry these fields; the discriminator is the
|
|
98
|
+
* `blockType` on the base state.
|
|
99
|
+
*/
|
|
100
|
+
exports.IFundingShareBlockStateSchema = exports.IShareBlockStateSchema.extend({
|
|
101
|
+
blockType: zod_1.default.literal(exports.ShareBlockTypeSchema.enum.Funding),
|
|
102
|
+
committed: zod_1.default.boolean(),
|
|
103
|
+
committedBy: zod_1.default.string().optional(),
|
|
104
|
+
committedAt: zod_1.default.number().optional(),
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* Distribution-specific extension of `IShareBlockState`. Adds:
|
|
108
|
+
*
|
|
109
|
+
* - `distributed` — once `true`, the block is fully paid out and further
|
|
110
|
+
* disbursements become no-ops. Enforced as monotonic by
|
|
111
|
+
* a dedicated rule (mirrors Funding's `committed`).
|
|
112
|
+
* - `distributedAt` — audit attribution for the moment the block was
|
|
113
|
+
* marked fully distributed.
|
|
114
|
+
*
|
|
115
|
+
* Clearing ShareBlocks don't carry these fields; the discriminator is the
|
|
116
|
+
* `blockType` on the base state.
|
|
117
|
+
*/
|
|
118
|
+
exports.IDistributionShareBlockStateSchema = exports.IShareBlockStateSchema.extend({
|
|
119
|
+
blockType: zod_1.default.literal(exports.ShareBlockTypeSchema.enum.Distribution),
|
|
120
|
+
distributed: zod_1.default.boolean(),
|
|
121
|
+
distributedBy: zod_1.default.string().optional(),
|
|
122
|
+
distributedAt: zod_1.default.number().optional(),
|
|
123
|
+
});
|
|
124
|
+
//#endregion State
|
|
125
|
+
//#region Metadata
|
|
126
|
+
/**
|
|
127
|
+
* Static information about a ShareBlock — set at construction and never
|
|
128
|
+
* mutated through transactions. Lives outside `IShareBlockState` because
|
|
129
|
+
* the rule-evaluation engine compares state shapes, and including identity
|
|
130
|
+
* metadata in that comparison would treat any new ShareBlock as a "change."
|
|
131
|
+
*/
|
|
132
|
+
exports.IShareBlockMetadataSchema = zod_1.default.object({
|
|
133
|
+
shareBlockId: zod_1.default.string(),
|
|
134
|
+
blockType: exports.ShareBlockTypeSchema,
|
|
135
|
+
relatedLoanApplicationId: zod_1.default.string().optional(),
|
|
136
|
+
description: zod_1.default.string().optional(),
|
|
137
|
+
createdAt: zod_1.default.number(),
|
|
138
|
+
createdBy: zod_1.default.string(),
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Input shape every ShareBlock factory's `initialState` argument accepts.
|
|
142
|
+
* The factory layers the variant-specific defaults on top (`blockType`,
|
|
143
|
+
* `committed: false`, `distributed: false`, `isOpen: true`) — callers only
|
|
144
|
+
* supply the genuinely variant-agnostic fields.
|
|
145
|
+
*
|
|
146
|
+
* Used by the HTTP create route to validate the wire payload before
|
|
147
|
+
* dispatching to the matching factory.
|
|
148
|
+
*/
|
|
149
|
+
exports.IShareBlockInitialStateInputSchema = zod_1.default.object({
|
|
150
|
+
currency: zod_1.default.string().min(3).max(3),
|
|
151
|
+
participants: zod_1.default.record(zod_1.default.string(), exports.IShareBlockParticipantSchema),
|
|
152
|
+
balance: zod_1.default.number().nonnegative().optional(),
|
|
153
|
+
});
|
|
154
|
+
//#endregion Metadata
|
|
155
|
+
//#region Transaction Function Inputs
|
|
156
|
+
/**
|
|
157
|
+
* Input shapes for the standard ShareBlock mutating functions. Each function
|
|
158
|
+
* the factory wires up takes one of these and proposes a new
|
|
159
|
+
* `IShareBlockState`. Rules judge the transition; the ShareData container
|
|
160
|
+
* applies it iff every rule passes.
|
|
161
|
+
*/
|
|
162
|
+
exports.IShareBlockDepositInputSchema = zod_1.default.object({
|
|
163
|
+
userId: zod_1.default.string(),
|
|
164
|
+
amount: zod_1.default.number().positive(),
|
|
165
|
+
});
|
|
166
|
+
exports.IShareBlockWithdrawInputSchema = zod_1.default.object({
|
|
167
|
+
userId: zod_1.default.string(),
|
|
168
|
+
amount: zod_1.default.number().positive(),
|
|
169
|
+
});
|
|
170
|
+
exports.IShareBlockCloseInputSchema = zod_1.default.object({
|
|
171
|
+
userId: zod_1.default.string(), // Who is closing the block — used for audit attribution.
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Input for the Funding-specific `commit` function. Records who pulled the
|
|
175
|
+
* trigger on locking the funded amount; the function itself stamps
|
|
176
|
+
* `committedAt` from the system clock.
|
|
177
|
+
*/
|
|
178
|
+
exports.IShareBlockCommitInputSchema = zod_1.default.object({
|
|
179
|
+
userId: zod_1.default.string(),
|
|
180
|
+
});
|
|
181
|
+
/**
|
|
182
|
+
* Input for the Funding-specific `registerLender` function. Adds a new
|
|
183
|
+
* `Lender`-role participant to the block so they can subsequently
|
|
184
|
+
* `deposit` (deposit gates on participant.role === Lender).
|
|
185
|
+
*
|
|
186
|
+
* The caller (Rapture's authenticated endpoint) is responsible for
|
|
187
|
+
* authorizing the registration — i.e. for confirming that `userId` is the
|
|
188
|
+
* authenticated user pledging on this loan. The shareblock layer just
|
|
189
|
+
* enforces structural invariants (no duplicate userId, positive
|
|
190
|
+
* committedAmount, block must be open and not committed).
|
|
191
|
+
*/
|
|
192
|
+
exports.IShareBlockRegisterLenderInputSchema = zod_1.default.object({
|
|
193
|
+
userId: zod_1.default.string(),
|
|
194
|
+
committedAmount: zod_1.default.number().positive().finite(),
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Input for the Distribution-specific `fund` function. Distinct from
|
|
198
|
+
* `IShareBlockDepositInput` only at the type level: keeps the wire shape
|
|
199
|
+
* narrow to "money coming in from another block" semantics rather than the
|
|
200
|
+
* general-purpose deposit on Clearing.
|
|
201
|
+
*/
|
|
202
|
+
exports.IShareBlockFundInputSchema = zod_1.default.object({
|
|
203
|
+
fromBlockId: zod_1.default.string().optional(), // upstream block id when known
|
|
204
|
+
amount: zod_1.default.number().positive(),
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* Input for the Distribution-specific `disburse` function. `userId` must
|
|
208
|
+
* resolve to a participant with role `Recipient`, or the function no-ops.
|
|
209
|
+
*/
|
|
210
|
+
exports.IShareBlockDisburseInputSchema = zod_1.default.object({
|
|
211
|
+
userId: zod_1.default.string(),
|
|
212
|
+
amount: zod_1.default.number().positive(),
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* Input for the Distribution-specific `markFullyDistributed` function.
|
|
216
|
+
* Records who declared the block fully paid out; the function stamps
|
|
217
|
+
* `distributedAt`.
|
|
218
|
+
*/
|
|
219
|
+
exports.IShareBlockMarkFullyDistributedInputSchema = zod_1.default.object({
|
|
220
|
+
userId: zod_1.default.string(),
|
|
221
|
+
});
|
|
222
|
+
//#endregion Transaction Function Inputs
|
|
@@ -1 +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,mBAAmB,EACtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,gEAAgE,CAAC;AAE/G;;;;;;;;GAQG;AACH,QAAA,MAAM,kCAAkC,
|
|
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,mBAAmB,EACtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,gEAAgE,CAAC;AAE/G;;;;;;;;GAQG;AACH,QAAA,MAAM,kCAAkC,GACpC,qBAAqB,mBAAmB,EACxC,wBAAwB,MAAM,EAC9B,yBAAyB,uBAAuB,EAChD,eAAe,mBAAmB,EAAE,KACrC,6BAOF,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
|
|
@@ -1 +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,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EAC5B,MAAM,gEAAgE,CAAC;AAExE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,8BAA8B,
|
|
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,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EAC5B,MAAM,gEAAgE,CAAC;AAExE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,8BAA8B,GAChC,oBAAoB,MAAM,EAC1B,oBAAoB,MAAM,EAC1B,mBAAmB,yBAAyB,EAC5C,MAAM,6BAA6B,EACnC,gBAAW,EACX,kBAAsB,KACvB,yBAYF,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/generic",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
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",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
7
16
|
"scripts": {
|
|
8
17
|
"build": "rm -rf dist/* && tsc -p tsconfig.pkg.json",
|
|
9
18
|
"compile": "rm -rf dist/* && tsc -p tsconfig.pkg.json",
|
|
10
|
-
"test": "jest --forceExit --detectOpenHandles --verbose --silent=false --env node
|
|
11
|
-
"test:coverage": "jest --forceExit --coverage --detectOpenHandles --verbose --silent=false --env node
|
|
19
|
+
"test": "jest --forceExit --detectOpenHandles --verbose --silent=false --env node",
|
|
20
|
+
"test:coverage": "jest --forceExit --coverage --detectOpenHandles --verbose --silent=false --env node ",
|
|
12
21
|
"test:clearCache": "jest --clearCache"
|
|
13
22
|
},
|
|
14
23
|
"repository": {
|
|
@@ -32,30 +41,29 @@
|
|
|
32
41
|
"@types/elliptic": "^6.4.18",
|
|
33
42
|
"bip39": "^3.1.0",
|
|
34
43
|
"elliptic": "^6.6.1",
|
|
35
|
-
"firebase-admin": "^13.0
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"zod": "^3.24.1"
|
|
44
|
+
"firebase-admin": "^13.9.0",
|
|
45
|
+
"jsonwebtoken": "^9.0.3",
|
|
46
|
+
"zod": "^4.4.3"
|
|
39
47
|
},
|
|
40
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "c33ed2f06679f5bd76c2eccf7054212c1820a014",
|
|
41
49
|
"devDependencies": {
|
|
42
|
-
"@eslint/js": "^
|
|
50
|
+
"@eslint/js": "^10.0.1",
|
|
43
51
|
"@types/eslint__js": "^8.42.3",
|
|
44
|
-
"@types/jest": "^
|
|
45
|
-
"@types/node": "^22.
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
47
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"eslint-import-resolver-typescript": "^
|
|
50
|
-
"eslint-plugin-import": "^2.
|
|
51
|
-
"jest": "^
|
|
52
|
-
"jest-environment-jsdom": "^
|
|
53
|
-
"ts-jest": "^29.
|
|
52
|
+
"@types/jest": "^30.0.0",
|
|
53
|
+
"@types/node": "^22.19.18",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
55
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
56
|
+
"eslint": "^10.3.0",
|
|
57
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
58
|
+
"eslint-plugin-import": "^2.32.0",
|
|
59
|
+
"jest": "^30.4.2",
|
|
60
|
+
"jest-environment-jsdom": "^30.4.1",
|
|
61
|
+
"ts-jest": "^29.4.9",
|
|
54
62
|
"ts-node": "^10.9.2",
|
|
55
|
-
"typescript": "^
|
|
56
|
-
"typescript-eslint": "^8.
|
|
63
|
+
"typescript": "^6.0.3",
|
|
64
|
+
"typescript-eslint": "^8.59.3"
|
|
57
65
|
},
|
|
58
66
|
"engines": {
|
|
59
|
-
"node": "22
|
|
67
|
+
"node": ">=22"
|
|
60
68
|
}
|
|
61
69
|
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* This contains the data for the share data object
|
|
4
|
-
*/
|
|
5
|
-
export declare enum ShareDataTypes {
|
|
6
|
-
AUTHORIZATION = "AUTHORIZATION",
|
|
7
|
-
RULE = "RULE",
|
|
8
|
-
FUNCTION = "FUNCTION",
|
|
9
|
-
TRANSACTION_HISTORY = "TRANSACTION_HISTORY",
|
|
10
|
-
DATA = "DATA"
|
|
11
|
-
}
|
|
12
|
-
export declare const ShareDataTypesSchema: z.ZodEnum<["AUTHORIZATION", "RULE", "FUNCTION", "TRANSACTION_HISTORY", "DATA"]>;
|
|
13
|
-
/**
|
|
14
|
-
* This contains the interface for a data in a share data object
|
|
15
|
-
*/
|
|
16
|
-
export declare const IShareDataSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
17
|
-
export type IShareData = z.infer<typeof IShareDataSchema>;
|
|
18
|
-
/**
|
|
19
|
-
* This contains the interface for a share function record in the share data object
|
|
20
|
-
*/
|
|
21
|
-
export declare const IShareFunctionRecordSchema: z.ZodObject<{
|
|
22
|
-
id: z.ZodString;
|
|
23
|
-
groupingId: z.ZodString;
|
|
24
|
-
groupingName: z.ZodString;
|
|
25
|
-
name: z.ZodString;
|
|
26
|
-
description: z.ZodString;
|
|
27
|
-
hash: z.ZodString;
|
|
28
|
-
stringifiedFunction: z.ZodString;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
stringifiedFunction: string;
|
|
31
|
-
id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
description: string;
|
|
34
|
-
groupingId: string;
|
|
35
|
-
groupingName: string;
|
|
36
|
-
hash: string;
|
|
37
|
-
}, {
|
|
38
|
-
stringifiedFunction: string;
|
|
39
|
-
id: string;
|
|
40
|
-
name: string;
|
|
41
|
-
description: string;
|
|
42
|
-
groupingId: string;
|
|
43
|
-
groupingName: string;
|
|
44
|
-
hash: string;
|
|
45
|
-
}>;
|
|
46
|
-
export type IShareFunctionRecord = z.infer<typeof IShareFunctionRecordSchema>;
|
|
47
|
-
/**
|
|
48
|
-
* This contains the interface for a share function in the share data object
|
|
49
|
-
*/
|
|
50
|
-
export declare const IShareFunctionSchema: z.ZodObject<{
|
|
51
|
-
input: z.ZodAny;
|
|
52
|
-
func: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
53
|
-
output: z.ZodAny;
|
|
54
|
-
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
func: (...args: unknown[]) => unknown;
|
|
56
|
-
output?: any;
|
|
57
|
-
input?: any;
|
|
58
|
-
}, {
|
|
59
|
-
func: (...args: unknown[]) => unknown;
|
|
60
|
-
output?: any;
|
|
61
|
-
input?: any;
|
|
62
|
-
}>;
|
|
63
|
-
export interface IShareFunction<TInput, TFunction extends (...args: any[]) => any, TOutput> {
|
|
64
|
-
input: TInput;
|
|
65
|
-
func: TFunction;
|
|
66
|
-
output: TOutput;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* This contains the interface for the rule failures in the share data object
|
|
70
|
-
*/
|
|
71
|
-
export declare const IShareDataRuleFailuresSchema: z.ZodObject<{
|
|
72
|
-
ruleId: z.ZodString;
|
|
73
|
-
}, "strip", z.ZodTypeAny, {
|
|
74
|
-
ruleId: string;
|
|
75
|
-
}, {
|
|
76
|
-
ruleId: string;
|
|
77
|
-
}>;
|
|
78
|
-
export type IShareDataRuleFailures = z.infer<typeof IShareDataRuleFailuresSchema>;
|
|
79
|
-
/**
|
|
80
|
-
* This contains the interface for the share transaction history in the share data object
|
|
81
|
-
*/
|
|
82
|
-
export declare const IShareDataTransactionBaseSchema: z.ZodObject<{
|
|
83
|
-
ruleOutcome: z.ZodBoolean;
|
|
84
|
-
ruleFailures: z.ZodArray<z.ZodObject<{
|
|
85
|
-
ruleId: z.ZodString;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
ruleId: string;
|
|
88
|
-
}, {
|
|
89
|
-
ruleId: string;
|
|
90
|
-
}>, "many">;
|
|
91
|
-
transactionFunction: z.ZodObject<{
|
|
92
|
-
input: z.ZodAny;
|
|
93
|
-
func: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
94
|
-
output: z.ZodAny;
|
|
95
|
-
}, "strip", z.ZodTypeAny, {
|
|
96
|
-
func: (...args: unknown[]) => unknown;
|
|
97
|
-
output?: any;
|
|
98
|
-
input?: any;
|
|
99
|
-
}, {
|
|
100
|
-
func: (...args: unknown[]) => unknown;
|
|
101
|
-
output?: any;
|
|
102
|
-
input?: any;
|
|
103
|
-
}>;
|
|
104
|
-
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
ruleOutcome: boolean;
|
|
106
|
-
ruleFailures: {
|
|
107
|
-
ruleId: string;
|
|
108
|
-
}[];
|
|
109
|
-
transactionFunction: {
|
|
110
|
-
func: (...args: unknown[]) => unknown;
|
|
111
|
-
output?: any;
|
|
112
|
-
input?: any;
|
|
113
|
-
};
|
|
114
|
-
}, {
|
|
115
|
-
ruleOutcome: boolean;
|
|
116
|
-
ruleFailures: {
|
|
117
|
-
ruleId: string;
|
|
118
|
-
}[];
|
|
119
|
-
transactionFunction: {
|
|
120
|
-
func: (...args: unknown[]) => unknown;
|
|
121
|
-
output?: any;
|
|
122
|
-
input?: any;
|
|
123
|
-
};
|
|
124
|
-
}>;
|
|
125
|
-
export type IShareDataTransactionBase = z.infer<typeof IShareDataTransactionBaseSchema>;
|
|
126
|
-
/**
|
|
127
|
-
* This contains the interface for the share transaction history in the share data object
|
|
128
|
-
* This is done for storage
|
|
129
|
-
*/
|
|
130
|
-
export declare const IShareDataTransactionHistorySchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
131
|
-
ruleOutcome: z.ZodBoolean;
|
|
132
|
-
ruleFailures: z.ZodArray<z.ZodObject<{
|
|
133
|
-
ruleId: z.ZodString;
|
|
134
|
-
}, "strip", z.ZodTypeAny, {
|
|
135
|
-
ruleId: string;
|
|
136
|
-
}, {
|
|
137
|
-
ruleId: string;
|
|
138
|
-
}>, "many">;
|
|
139
|
-
transactionFunction: z.ZodObject<{
|
|
140
|
-
input: z.ZodAny;
|
|
141
|
-
func: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
142
|
-
output: z.ZodAny;
|
|
143
|
-
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
func: (...args: unknown[]) => unknown;
|
|
145
|
-
output?: any;
|
|
146
|
-
input?: any;
|
|
147
|
-
}, {
|
|
148
|
-
func: (...args: unknown[]) => unknown;
|
|
149
|
-
output?: any;
|
|
150
|
-
input?: any;
|
|
151
|
-
}>;
|
|
152
|
-
}, {
|
|
153
|
-
transactionId: z.ZodString;
|
|
154
|
-
transactionTime: z.ZodNumber;
|
|
155
|
-
}>, "strip", z.ZodTypeAny, {
|
|
156
|
-
ruleOutcome: boolean;
|
|
157
|
-
ruleFailures: {
|
|
158
|
-
ruleId: string;
|
|
159
|
-
}[];
|
|
160
|
-
transactionFunction: {
|
|
161
|
-
func: (...args: unknown[]) => unknown;
|
|
162
|
-
output?: any;
|
|
163
|
-
input?: any;
|
|
164
|
-
};
|
|
165
|
-
transactionId: string;
|
|
166
|
-
transactionTime: number;
|
|
167
|
-
}, {
|
|
168
|
-
ruleOutcome: boolean;
|
|
169
|
-
ruleFailures: {
|
|
170
|
-
ruleId: string;
|
|
171
|
-
}[];
|
|
172
|
-
transactionFunction: {
|
|
173
|
-
func: (...args: unknown[]) => unknown;
|
|
174
|
-
output?: any;
|
|
175
|
-
input?: any;
|
|
176
|
-
};
|
|
177
|
-
transactionId: string;
|
|
178
|
-
transactionTime: number;
|
|
179
|
-
}>;
|
|
180
|
-
export type IShareDataTransactionHistory = z.infer<typeof IShareDataTransactionHistorySchema>;
|
|
181
|
-
//# sourceMappingURL=share-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"share-data.d.ts","sourceRoot":"","sources":["../../../src/models/share-data/share-data.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB;;GAEG;AACH,oBAAY,cAAc;IACtB,aAAa,kBAAkB;IAC/B,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;IAC3C,IAAI,SAAS;CAChB;AAED,eAAO,MAAM,oBAAoB,iFAM/B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,gBAAgB,oCAAoB,CAAC;AAClD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAGH,MAAM,WAAW,cAAc,CAAC,MAAM,EAAE,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,OAAO;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACnB;AAGD;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|