@aephia/atlas-kit 0.6.0-next.3 → 0.6.0-next.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/README.md +1 -0
- package/dist/identity/actions/index.d.ts +35 -0
- package/dist/identity/actions/index.d.ts.map +1 -0
- package/dist/identity/actions/index.js +108 -0
- package/dist/identity/actions/index.js.map +1 -0
- package/dist/internal/c4/character-registration.d.ts +9 -0
- package/dist/internal/c4/character-registration.d.ts.map +1 -0
- package/dist/internal/c4/character-registration.js +21 -0
- package/dist/internal/c4/character-registration.js.map +1 -0
- package/dist/registry/onboarding.d.ts +4 -0
- package/dist/registry/onboarding.d.ts.map +1 -0
- package/dist/registry/onboarding.js +19 -0
- package/dist/registry/onboarding.js.map +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -75,6 +75,7 @@ const systems = await getStarSystems(ctx);
|
|
|
75
75
|
| `@aephia/atlas-kit/fleets` | Fleets, composition, movement state, and relationships |
|
|
76
76
|
| `@aephia/atlas-kit/fleets/actions` | Inspectable Fleet movement and arrival-settlement planners |
|
|
77
77
|
| `@aephia/atlas-kit/identity` | Wallet, Profile, Character, progression, and research reads |
|
|
78
|
+
| `@aephia/atlas-kit/identity/actions` | Address-only Character registration for an existing Profile, with an explicit funder |
|
|
78
79
|
| `@aephia/atlas-kit/loyalty` | Loyalty epochs, contributions, banks, and lifecycle |
|
|
79
80
|
| `@aephia/atlas-kit/loyalty/actions` | Address-only full-balance Loyalty ATLAS claim planning |
|
|
80
81
|
| `@aephia/atlas-kit/markets` | Local Market orders, maker state, and discovery |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Address } from '@solana/kit';
|
|
2
|
+
import type { SageContext } from '../../client/contracts.js';
|
|
3
|
+
import { type Plan } from '../../planning/index.js';
|
|
4
|
+
/** Address of the external signer that will fund Character account storage.
|
|
5
|
+
* Character registration has no Profile-authority or faction signer role.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* declare const funder: Address;
|
|
9
|
+
* const options:PlanRegisterCharacterOptions={funder};
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface PlanRegisterCharacterOptions {
|
|
13
|
+
readonly funder: Address;
|
|
14
|
+
}
|
|
15
|
+
/** Plans creation of an existing Profile's canonical Character in the configured Game.
|
|
16
|
+
* Only the explicit storage funder signs. The Profile's authority and faction
|
|
17
|
+
* enrollment are not prerequisites for this instruction. Planning never creates
|
|
18
|
+
* an account, signs, submits, or retains a signer. Existing Characters are rejected;
|
|
19
|
+
* reuse them through `getCharacterForProfile` or `maybeGetCharacterForProfile`.
|
|
20
|
+
* Rent, funder balance, and final creation remain chain-authoritative. Simulate
|
|
21
|
+
* before signing and read the Character after confirmed execution to verify its
|
|
22
|
+
* exact Profile/Game identity. Submission alone does not prove creation.
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import {planRegisterCharacter} from '@aephia/atlas-kit/identity/actions';
|
|
26
|
+
* import type {SageContext,Address} from '@aephia/atlas-kit/client';
|
|
27
|
+
* declare const ctx:SageContext;
|
|
28
|
+
* declare const profileAddress:Address;
|
|
29
|
+
* declare const funder:Address;
|
|
30
|
+
* const plan=await planRegisterCharacter(ctx,profileAddress,{funder});
|
|
31
|
+
* console.log(plan.summary,plan.requiredSigners);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function planRegisterCharacter(ctx: SageContext, profileAddress: Address, input: PlanRegisterCharacterOptions): Promise<Plan>;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAUzE,OAAO,EAEL,KAAK,IAAI,EAEV,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAoDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAChB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,IAAI,CAAC,CA2Ef"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getAddressEncoder, isAddress, isOffCurveAddress, } from '@solana/kit';
|
|
2
|
+
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
3
|
+
import { readContextRawAccounts } from '../../client/reconciliation.js';
|
|
4
|
+
import { createRegisterCharacterInstruction } from '../../internal/c4/character-registration.js';
|
|
5
|
+
import { characterAccountDefinition, profileAccountDefinition, findCharacterPda, } from '../../internal/c4/identity.js';
|
|
6
|
+
import { requireGameAddress } from '../../internal/game-context.js';
|
|
7
|
+
import { createPlan, } from '../../planning/index.js';
|
|
8
|
+
import { readFreshGameForCharacterRegistration } from '../../registry/onboarding.js';
|
|
9
|
+
function validateOptions(input) {
|
|
10
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
11
|
+
throw new InvalidActionInputError('options', input, 'an object containing only funder', 'Pass { funder } with the address that will pay for Character account storage.');
|
|
12
|
+
const record = input;
|
|
13
|
+
if (Object.keys(record).length !== 1 ||
|
|
14
|
+
!Object.hasOwn(record, 'funder') ||
|
|
15
|
+
typeof record.funder !== 'string' ||
|
|
16
|
+
!isAddress(record.funder) ||
|
|
17
|
+
isOffCurveAddress(record.funder))
|
|
18
|
+
throw new InvalidActionInputError('options.funder', record.funder, 'one directly signing z.ink/Solana address and no other option fields', 'Set funder to an external signer address, not a signer object or program-derived address.');
|
|
19
|
+
return { funder: record.funder };
|
|
20
|
+
}
|
|
21
|
+
function fail(message, address) {
|
|
22
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', message, { address });
|
|
23
|
+
}
|
|
24
|
+
async function observe(account, describes) {
|
|
25
|
+
const owner = getAddressEncoder().encode(account.owner);
|
|
26
|
+
const data = new Uint8Array(owner.length + account.data.length);
|
|
27
|
+
data.set(owner);
|
|
28
|
+
data.set(account.data, owner.length);
|
|
29
|
+
const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', data));
|
|
30
|
+
return {
|
|
31
|
+
kind: 'account-state',
|
|
32
|
+
address: account.address,
|
|
33
|
+
dataHash: [...digest]
|
|
34
|
+
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
35
|
+
.join(''),
|
|
36
|
+
describes,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Plans creation of an existing Profile's canonical Character in the configured Game.
|
|
40
|
+
* Only the explicit storage funder signs. The Profile's authority and faction
|
|
41
|
+
* enrollment are not prerequisites for this instruction. Planning never creates
|
|
42
|
+
* an account, signs, submits, or retains a signer. Existing Characters are rejected;
|
|
43
|
+
* reuse them through `getCharacterForProfile` or `maybeGetCharacterForProfile`.
|
|
44
|
+
* Rent, funder balance, and final creation remain chain-authoritative. Simulate
|
|
45
|
+
* before signing and read the Character after confirmed execution to verify its
|
|
46
|
+
* exact Profile/Game identity. Submission alone does not prove creation.
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import {planRegisterCharacter} from '@aephia/atlas-kit/identity/actions';
|
|
50
|
+
* import type {SageContext,Address} from '@aephia/atlas-kit/client';
|
|
51
|
+
* declare const ctx:SageContext;
|
|
52
|
+
* declare const profileAddress:Address;
|
|
53
|
+
* declare const funder:Address;
|
|
54
|
+
* const plan=await planRegisterCharacter(ctx,profileAddress,{funder});
|
|
55
|
+
* console.log(plan.summary,plan.requiredSigners);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export async function planRegisterCharacter(ctx, profileAddress, input) {
|
|
59
|
+
const { funder } = validateOptions(input);
|
|
60
|
+
if (typeof profileAddress !== 'string' || !isAddress(profileAddress))
|
|
61
|
+
throw new InvalidActionInputError('profileAddress', profileAddress, 'an existing Profile account address', 'Pass the Profile address, not a wallet address or loaded signer.');
|
|
62
|
+
const game = requireGameAddress(ctx);
|
|
63
|
+
const character = await findCharacterPda(profileAddress, game);
|
|
64
|
+
const [gameAccount, [profileAccount, characterAccount]] = await Promise.all([
|
|
65
|
+
readFreshGameForCharacterRegistration(ctx),
|
|
66
|
+
readContextRawAccounts(ctx, [profileAddress, character]),
|
|
67
|
+
]);
|
|
68
|
+
if (!profileAccount)
|
|
69
|
+
fail(`Profile ${profileAddress} does not exist. Create or select an existing Profile before registering its Character.`, profileAddress);
|
|
70
|
+
if (profileAccount.executable)
|
|
71
|
+
fail(`Profile ${profileAddress} is executable instead of Profile state. Select a valid Player Profile account and retry.`, profileAddress);
|
|
72
|
+
profileAccountDefinition.decode(profileAccount);
|
|
73
|
+
if (characterAccount) {
|
|
74
|
+
if (characterAccount.executable)
|
|
75
|
+
fail(`Canonical Character ${character} is executable instead of Character state. Verify the configured Game and account data before retrying.`, character);
|
|
76
|
+
const existing = characterAccountDefinition.decode(characterAccount);
|
|
77
|
+
if (existing.playerProfile !== profileAddress || existing.game !== game)
|
|
78
|
+
fail(`Canonical Character ${character} contains a different Profile or Game relationship. Verify the deployment and refresh the account; do not treat it as a missing Character.`, character);
|
|
79
|
+
fail(`Character ${character} is already registered for Profile ${profileAddress} in Game ${game}. Read and reuse it with getCharacterForProfile or maybeGetCharacterForProfile; registration is not idempotent.`, character);
|
|
80
|
+
}
|
|
81
|
+
const summary = `Register canonical Character ${character} for existing Profile ${profileAddress} in Game ${game}. Funder ${funder} is the sole instruction signer and pays Character account storage; transaction fees are separate. No Profile-authority or faction signature is required. Storage rent, funder balance and final creation remain chain-authoritative: simulate before signing, then use getCharacterForProfile after confirmed execution to verify the Profile/Game identity.`;
|
|
82
|
+
return createPlan({
|
|
83
|
+
kind: 'identity.register-character',
|
|
84
|
+
summary,
|
|
85
|
+
preconditions: [
|
|
86
|
+
await observe(profileAccount, `Profile ${profileAddress} retains its validated Player Profile state.`),
|
|
87
|
+
await observe(gameAccount, `Game ${game} retains its validated C4 state.`),
|
|
88
|
+
{
|
|
89
|
+
kind: 'account-absent',
|
|
90
|
+
address: character,
|
|
91
|
+
describes: `Canonical Character ${character} remains absent; if another transaction registers it, read and reuse it instead.`,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
steps: [
|
|
95
|
+
{
|
|
96
|
+
describes: summary,
|
|
97
|
+
signers: [funder],
|
|
98
|
+
instruction: createRegisterCharacterInstruction({
|
|
99
|
+
profile: profileAddress,
|
|
100
|
+
funder,
|
|
101
|
+
character,
|
|
102
|
+
game,
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,UAAU,GAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qCAAqC,EAAE,MAAM,8BAA8B,CAAC;AAcrF,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,OAA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adapter for the pinned registerCharacter instruction contract. */
|
|
3
|
+
export declare function createRegisterCharacterInstruction(input: {
|
|
4
|
+
readonly profile: Address;
|
|
5
|
+
readonly funder: Address;
|
|
6
|
+
readonly character: Address;
|
|
7
|
+
readonly game: Address;
|
|
8
|
+
}): Instruction;
|
|
9
|
+
//# sourceMappingURL=character-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-registration.d.ts","sourceRoot":"","sources":["../../../src/internal/c4/character-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1E,kFAAkF;AAClF,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,GAAG,WAAW,CAgBd"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AccountRole } from '@solana/kit';
|
|
2
|
+
import { SAGE_PROGRAM_ADDRESS, getRegisterCharacterInstructionDataEncoder, } from '@staratlas/dev-sage';
|
|
3
|
+
/** Address-only adapter for the pinned registerCharacter instruction contract. */
|
|
4
|
+
export function createRegisterCharacterInstruction(input) {
|
|
5
|
+
// Preserve the generated account order and roles without creating a signer.
|
|
6
|
+
return {
|
|
7
|
+
programAddress: SAGE_PROGRAM_ADDRESS,
|
|
8
|
+
accounts: [
|
|
9
|
+
{ address: input.profile, role: AccountRole.READONLY },
|
|
10
|
+
{ address: input.funder, role: AccountRole.WRITABLE_SIGNER },
|
|
11
|
+
{ address: input.character, role: AccountRole.WRITABLE },
|
|
12
|
+
{ address: input.game, role: AccountRole.READONLY },
|
|
13
|
+
{
|
|
14
|
+
address: '11111111111111111111111111111111',
|
|
15
|
+
role: AccountRole.READONLY,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
data: getRegisterCharacterInstructionDataEncoder().encode({}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=character-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-registration.js","sourceRoot":"","sources":["../../../src/internal/c4/character-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,0CAA0C,GAC3C,MAAM,qBAAqB,CAAC;AAE7B,kFAAkF;AAClF,MAAM,UAAU,kCAAkC,CAAC,KAKlD;IACC,4EAA4E;IAC5E,OAAO;QACL,cAAc,EAAE,oBAAoB;QACpC,QAAQ,EAAE;YACR,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE;YACtD,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE;YAC5D,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE;YACxD,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE;YACnD;gBACE,OAAO,EAAE,kCAA6C;gBACtD,IAAI,EAAE,WAAW,CAAC,QAAQ;aAC3B;SACF;QACD,IAAI,EAAE,0CAA0C,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RawAccount, SageContext } from '../client/contracts.js';
|
|
2
|
+
/** Fresh Game validation for Character creation, without loading retained catalogs. */
|
|
3
|
+
export declare function readFreshGameForCharacterRegistration(ctx: SageContext): Promise<RawAccount>;
|
|
4
|
+
//# sourceMappingURL=onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/registry/onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMtE,uFAAuF;AACvF,wBAAsB,qCAAqC,CACzD,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,UAAU,CAAC,CAoBrB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SageSdkError } from '../client/errors.js';
|
|
2
|
+
import { readContextRawAccounts } from '../client/reconciliation.js';
|
|
3
|
+
import { decodeGameRegistrySections } from '../internal/c4/game.js';
|
|
4
|
+
import { requireGameAddress } from '../internal/game-context.js';
|
|
5
|
+
/** Fresh Game validation for Character creation, without loading retained catalogs. */
|
|
6
|
+
export async function readFreshGameForCharacterRegistration(ctx) {
|
|
7
|
+
const game = requireGameAddress(ctx);
|
|
8
|
+
const [account] = await readContextRawAccounts(ctx, [game]);
|
|
9
|
+
if (!account)
|
|
10
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `The configured Game ${game} is missing. Select an existing C4 Game before registering this Profile's Character.`, { address: game });
|
|
11
|
+
if (account.executable)
|
|
12
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `The configured Game ${game} is executable instead of Game state. Select a valid C4 Game account and retry registration.`, { address: game });
|
|
13
|
+
// Prefix validation alone cannot detect truncated variable-length Game data.
|
|
14
|
+
// The registry's pinned exact codec validates the whole account transiently;
|
|
15
|
+
// an empty section request translates and retains no definition catalogs.
|
|
16
|
+
decodeGameRegistrySections(account, []);
|
|
17
|
+
return account;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../src/registry/onboarding.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,GAAgB;IAEhB,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,sBAAsB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,uBAAuB,IAAI,sFAAsF,EACjH,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;IACJ,IAAI,OAAO,CAAC,UAAU;QACpB,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,uBAAuB,IAAI,8FAA8F,EACzH,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;IACJ,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,0BAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aephia/atlas-kit",
|
|
3
|
-
"version": "0.6.0-next.
|
|
3
|
+
"version": "0.6.0-next.4",
|
|
4
4
|
"description": "Community-maintained non-custodial TypeScript SDK for Star Atlas SAGE C4.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Aephia contributors",
|
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
"types": "./dist/identity/index.d.ts",
|
|
93
93
|
"import": "./dist/identity/index.js"
|
|
94
94
|
},
|
|
95
|
+
"./identity/actions": {
|
|
96
|
+
"types": "./dist/identity/actions/index.d.ts",
|
|
97
|
+
"import": "./dist/identity/actions/index.js"
|
|
98
|
+
},
|
|
95
99
|
"./loyalty": {
|
|
96
100
|
"types": "./dist/loyalty/index.d.ts",
|
|
97
101
|
"import": "./dist/loyalty/index.js"
|