@xyo-network/archivist-model 2.107.3 → 2.107.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +122 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +101 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/index.cjs +122 -1
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +101 -1
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/index.cjs +144 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +100 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +7 -7
package/dist/browser/index.cjs
CHANGED
|
@@ -1,2 +1,123 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
ArchivistAllQuerySchema: () => ArchivistAllQuerySchema,
|
|
25
|
+
ArchivistClearQuerySchema: () => ArchivistClearQuerySchema,
|
|
26
|
+
ArchivistCommitQuerySchema: () => ArchivistCommitQuerySchema,
|
|
27
|
+
ArchivistConfigSchema: () => ArchivistConfigSchema,
|
|
28
|
+
ArchivistDeleteQuerySchema: () => ArchivistDeleteQuerySchema,
|
|
29
|
+
ArchivistGetQuerySchema: () => ArchivistGetQuerySchema,
|
|
30
|
+
ArchivistInsertQuerySchema: () => ArchivistInsertQuerySchema,
|
|
31
|
+
ArchivistNextQuerySchema: () => ArchivistNextQuerySchema,
|
|
32
|
+
IndexSeparator: () => IndexSeparator,
|
|
33
|
+
IsAttachableArchivistInstanceFactory: () => IsAttachableArchivistInstanceFactory,
|
|
34
|
+
asArchivistInstance: () => asArchivistInstance,
|
|
35
|
+
asArchivistModule: () => asArchivistModule,
|
|
36
|
+
asAttachableArchivistInstance: () => asAttachableArchivistInstance,
|
|
37
|
+
buildStandardIndexName: () => buildStandardIndexName,
|
|
38
|
+
isArchivistInstance: () => isArchivistInstance,
|
|
39
|
+
isArchivistModule: () => isArchivistModule,
|
|
40
|
+
isAttachableArchivistInstance: () => isAttachableArchivistInstance,
|
|
41
|
+
requiredAttachableArchivistInstanceFunctions: () => requiredAttachableArchivistInstanceFunctions,
|
|
42
|
+
withArchivistInstance: () => withArchivistInstance,
|
|
43
|
+
withArchivistModule: () => withArchivistModule
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(src_exports);
|
|
46
|
+
|
|
47
|
+
// src/attachable/asAttachableInstance.ts
|
|
48
|
+
var import_object3 = require("@xylabs/object");
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var import_object2 = require("@xylabs/object");
|
|
52
|
+
var import_module_model2 = require("@xyo-network/module-model");
|
|
53
|
+
|
|
54
|
+
// src/typeChecks.ts
|
|
55
|
+
var import_object = require("@xylabs/object");
|
|
56
|
+
var import_module_model = require("@xyo-network/module-model");
|
|
57
|
+
|
|
58
|
+
// src/Queries/All.ts
|
|
59
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
60
|
+
|
|
61
|
+
// src/Queries/Clear.ts
|
|
62
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
63
|
+
|
|
64
|
+
// src/Queries/Commit.ts
|
|
65
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
66
|
+
|
|
67
|
+
// src/Queries/Delete.ts
|
|
68
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
69
|
+
|
|
70
|
+
// src/Queries/Get.ts
|
|
71
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
72
|
+
|
|
73
|
+
// src/Queries/Insert.ts
|
|
74
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
75
|
+
|
|
76
|
+
// src/Queries/Next.ts
|
|
77
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
78
|
+
|
|
79
|
+
// src/typeChecks.ts
|
|
80
|
+
var isArchivistInstance = new import_module_model.IsInstanceFactory().create({
|
|
81
|
+
get: "function"
|
|
82
|
+
}, [
|
|
83
|
+
import_module_model.isModuleInstance
|
|
84
|
+
]);
|
|
85
|
+
var isArchivistModule = new import_module_model.IsModuleFactory().create([
|
|
86
|
+
ArchivistGetQuerySchema
|
|
87
|
+
]);
|
|
88
|
+
var asArchivistModule = import_object.AsObjectFactory.create(isArchivistModule);
|
|
89
|
+
var asArchivistInstance = import_object.AsObjectFactory.create(isArchivistInstance);
|
|
90
|
+
var withArchivistModule = import_module_model.WithFactory.create(isArchivistModule);
|
|
91
|
+
var withArchivistInstance = import_module_model.WithFactory.create(isArchivistInstance);
|
|
92
|
+
|
|
93
|
+
// src/attachable/isAttachableInstance.ts
|
|
94
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
95
|
+
var factory = new import_object2.IsObjectFactory();
|
|
96
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
97
|
+
isArchivistInstance,
|
|
98
|
+
import_module_model2.isAttachableModuleInstance
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
// src/attachable/asAttachableInstance.ts
|
|
102
|
+
var asAttachableArchivistInstance = import_object3.AsObjectFactory.create(isAttachableArchivistInstance);
|
|
103
|
+
|
|
104
|
+
// src/attachable/AttachableInstance.ts
|
|
105
|
+
var import_object4 = require("@xylabs/object");
|
|
106
|
+
var IsAttachableArchivistInstanceFactory = class extends import_object4.IsObjectFactory {
|
|
107
|
+
static {
|
|
108
|
+
__name(this, "IsAttachableArchivistInstanceFactory");
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/Config.ts
|
|
113
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
114
|
+
|
|
115
|
+
// src/IndexDescription.ts
|
|
116
|
+
var IndexSeparator = "-";
|
|
117
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
118
|
+
const { key, unique } = index;
|
|
119
|
+
const prefix = unique ? "UX" : "IX";
|
|
120
|
+
const indexKeys = Object.keys(key);
|
|
121
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
122
|
+
}, "buildStandardIndexName");
|
|
2
123
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,8BAAAC,EAAA,+BAAAC,EAAA,0BAAAC,EAAA,+BAAAC,EAAA,4BAAAC,EAAA,+BAAAC,EAAA,6BAAAC,EAAA,mBAAAC,EAAA,yCAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,2BAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,iDAAAC,EAAA,0BAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAtB,GCAA,IAAAuB,EAAgC,0BCAhC,IAAAC,EAA4D,0BAC5DC,EAA2C,qCCD3C,IAAAC,EAAgC,0BAChCC,EAAkF,qCCE3E,IAAMC,EAAmD,kCCAzD,IAAMC,EAAuD,oCCA7D,IAAMC,EAAyD,qCCC/D,IAAMC,EAAyD,qCCA/D,IAAMC,EAAmD,kCCDzD,IAAMC,EAAyD,qCCE/D,IAAMC,EAAqD,mCPE3D,IAAMC,EAAsB,IAAIC,oBAAAA,EAAuCC,OAAO,CAAEC,IAAK,UAAW,EAAG,CAACC,mBAAiB,EAC/GC,EAAoB,IAAIC,kBAAAA,EAAmCJ,OAAO,CAACK,EAAwB,EAE3FC,EAAoBC,kBAAgBP,OAAOG,CAAAA,EAC3CK,EAAsBD,kBAAgBP,OAAOF,CAAAA,EAC7CW,EAAsBC,cAAYV,OAAOG,CAAAA,EACzCQ,EAAwBD,cAAYV,OAAOF,CAAAA,EDPjD,IAAMc,EAAgE,CAAC,EAGxEC,EAAU,IAAIC,kBAEPC,EAAwEF,EAAQG,OAAOJ,EAA8C,CAChJK,EACAC,6BACD,EDVM,IAAMC,EAAgCC,kBAAgBC,OAAOC,CAAAA,EUJpE,IAAAC,EAA2C,0BAmBpC,IAAMC,EAAN,cAAwHC,iBAAAA,CAnB/H,MAmB+HA,CAAAA,EAAAA,6CAAoB,ECR5I,IAAMC,EAAwB,+BCoB9B,IAAMC,EAAiB,IAQjBC,EAAyBC,EAACC,GAAAA,CACrC,GAAM,CAAEC,IAAAA,EAAKC,OAAAA,CAAM,EAAKF,EAClBG,EAASD,EAAS,KAAO,KACzBE,EAAYC,OAAOC,KAAKL,CAAAA,EAC9B,MAAO,GAAGE,CAAAA,IAAUC,EAAUG,KAAKV,CAAAA,CAAAA,EACrC,EALsC","names":["src_exports","__export","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistConfigSchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","IndexSeparator","IsAttachableArchivistInstanceFactory","asArchivistInstance","asArchivistModule","asAttachableArchivistInstance","buildStandardIndexName","isArchivistInstance","isArchivistModule","isAttachableArchivistInstance","requiredAttachableArchivistInstanceFunctions","withArchivistInstance","withArchivistModule","__toCommonJS","import_object","import_object","import_module_model","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","__name","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,IAAAA,iBAAgC;;;ACAhC,IAAAC,iBAA4D;AAC5D,IAAAC,uBAA2C;;;ACD3C,oBAAgC;AAChC,0BAAkF;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,sCAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,oCAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,8BAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,8BAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,gCAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,gCAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,+BAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,+BAAgBC,OAAOC,6BAAAA;;;AUJpE,IAAAC,iBAA2C;AAmBpC,IAAMC,uCAAN,cAAwHC,+BAAAA;EAnB/H,OAmB+HA;;;AAAoB;;;ACR5I,IAAMC,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["import_object","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,102 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/attachable/asAttachableInstance.ts
|
|
5
|
+
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
6
|
+
|
|
7
|
+
// src/attachable/isAttachableInstance.ts
|
|
8
|
+
import { IsObjectFactory } from "@xylabs/object";
|
|
9
|
+
import { isAttachableModuleInstance } from "@xyo-network/module-model";
|
|
10
|
+
|
|
11
|
+
// src/typeChecks.ts
|
|
12
|
+
import { AsObjectFactory } from "@xylabs/object";
|
|
13
|
+
import { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from "@xyo-network/module-model";
|
|
14
|
+
|
|
15
|
+
// src/Queries/All.ts
|
|
16
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
17
|
+
|
|
18
|
+
// src/Queries/Clear.ts
|
|
19
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
20
|
+
|
|
21
|
+
// src/Queries/Commit.ts
|
|
22
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
23
|
+
|
|
24
|
+
// src/Queries/Delete.ts
|
|
25
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
26
|
+
|
|
27
|
+
// src/Queries/Get.ts
|
|
28
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
29
|
+
|
|
30
|
+
// src/Queries/Insert.ts
|
|
31
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
32
|
+
|
|
33
|
+
// src/Queries/Next.ts
|
|
34
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
35
|
+
|
|
36
|
+
// src/typeChecks.ts
|
|
37
|
+
var isArchivistInstance = new IsInstanceFactory().create({
|
|
38
|
+
get: "function"
|
|
39
|
+
}, [
|
|
40
|
+
isModuleInstance
|
|
41
|
+
]);
|
|
42
|
+
var isArchivistModule = new IsModuleFactory().create([
|
|
43
|
+
ArchivistGetQuerySchema
|
|
44
|
+
]);
|
|
45
|
+
var asArchivistModule = AsObjectFactory.create(isArchivistModule);
|
|
46
|
+
var asArchivistInstance = AsObjectFactory.create(isArchivistInstance);
|
|
47
|
+
var withArchivistModule = WithFactory.create(isArchivistModule);
|
|
48
|
+
var withArchivistInstance = WithFactory.create(isArchivistInstance);
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
52
|
+
var factory = new IsObjectFactory();
|
|
53
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
54
|
+
isArchivistInstance,
|
|
55
|
+
isAttachableModuleInstance
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// src/attachable/asAttachableInstance.ts
|
|
59
|
+
var asAttachableArchivistInstance = AsObjectFactory2.create(isAttachableArchivistInstance);
|
|
60
|
+
|
|
61
|
+
// src/attachable/AttachableInstance.ts
|
|
62
|
+
import { IsObjectFactory as IsObjectFactory2 } from "@xylabs/object";
|
|
63
|
+
var IsAttachableArchivistInstanceFactory = class extends IsObjectFactory2 {
|
|
64
|
+
static {
|
|
65
|
+
__name(this, "IsAttachableArchivistInstanceFactory");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/Config.ts
|
|
70
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
71
|
+
|
|
72
|
+
// src/IndexDescription.ts
|
|
73
|
+
var IndexSeparator = "-";
|
|
74
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
75
|
+
const { key, unique } = index;
|
|
76
|
+
const prefix = unique ? "UX" : "IX";
|
|
77
|
+
const indexKeys = Object.keys(key);
|
|
78
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
79
|
+
}, "buildStandardIndexName");
|
|
80
|
+
export {
|
|
81
|
+
ArchivistAllQuerySchema,
|
|
82
|
+
ArchivistClearQuerySchema,
|
|
83
|
+
ArchivistCommitQuerySchema,
|
|
84
|
+
ArchivistConfigSchema,
|
|
85
|
+
ArchivistDeleteQuerySchema,
|
|
86
|
+
ArchivistGetQuerySchema,
|
|
87
|
+
ArchivistInsertQuerySchema,
|
|
88
|
+
ArchivistNextQuerySchema,
|
|
89
|
+
IndexSeparator,
|
|
90
|
+
IsAttachableArchivistInstanceFactory,
|
|
91
|
+
asArchivistInstance,
|
|
92
|
+
asArchivistModule,
|
|
93
|
+
asAttachableArchivistInstance,
|
|
94
|
+
buildStandardIndexName,
|
|
95
|
+
isArchivistInstance,
|
|
96
|
+
isArchivistModule,
|
|
97
|
+
isAttachableArchivistInstance,
|
|
98
|
+
requiredAttachableArchivistInstanceFunctions,
|
|
99
|
+
withArchivistInstance,
|
|
100
|
+
withArchivistModule
|
|
101
|
+
};
|
|
2
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAAA,wBAAuB;;;ACAhC,SAASC,uBAAmD;AAC5D,SAASC,kCAAkC;;;ACD3C,SAASC,uBAAuB;AAChC,SAASC,mBAAmBC,iBAAiBC,kBAAkBC,mBAAmB;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,kBAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,gBAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,gBAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,gBAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,YAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,YAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,gBAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,iBAAgBC,OAAOC,6BAAAA;;;AUJpE,SAASC,mBAAAA,wBAAkC;AAmBpC,IAAMC,uCAAN,cAAwHC,iBAAAA;EAnB/H,OAmB+HA;;;AAAoB;;;ACR5I,IAAMC,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["AsObjectFactory","IsObjectFactory","isAttachableModuleInstance","AsObjectFactory","IsInstanceFactory","IsModuleFactory","isModuleInstance","WithFactory","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","IsObjectFactory","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/dist/neutral/index.cjs
CHANGED
|
@@ -1,2 +1,123 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
ArchivistAllQuerySchema: () => ArchivistAllQuerySchema,
|
|
25
|
+
ArchivistClearQuerySchema: () => ArchivistClearQuerySchema,
|
|
26
|
+
ArchivistCommitQuerySchema: () => ArchivistCommitQuerySchema,
|
|
27
|
+
ArchivistConfigSchema: () => ArchivistConfigSchema,
|
|
28
|
+
ArchivistDeleteQuerySchema: () => ArchivistDeleteQuerySchema,
|
|
29
|
+
ArchivistGetQuerySchema: () => ArchivistGetQuerySchema,
|
|
30
|
+
ArchivistInsertQuerySchema: () => ArchivistInsertQuerySchema,
|
|
31
|
+
ArchivistNextQuerySchema: () => ArchivistNextQuerySchema,
|
|
32
|
+
IndexSeparator: () => IndexSeparator,
|
|
33
|
+
IsAttachableArchivistInstanceFactory: () => IsAttachableArchivistInstanceFactory,
|
|
34
|
+
asArchivistInstance: () => asArchivistInstance,
|
|
35
|
+
asArchivistModule: () => asArchivistModule,
|
|
36
|
+
asAttachableArchivistInstance: () => asAttachableArchivistInstance,
|
|
37
|
+
buildStandardIndexName: () => buildStandardIndexName,
|
|
38
|
+
isArchivistInstance: () => isArchivistInstance,
|
|
39
|
+
isArchivistModule: () => isArchivistModule,
|
|
40
|
+
isAttachableArchivistInstance: () => isAttachableArchivistInstance,
|
|
41
|
+
requiredAttachableArchivistInstanceFunctions: () => requiredAttachableArchivistInstanceFunctions,
|
|
42
|
+
withArchivistInstance: () => withArchivistInstance,
|
|
43
|
+
withArchivistModule: () => withArchivistModule
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(src_exports);
|
|
46
|
+
|
|
47
|
+
// src/attachable/asAttachableInstance.ts
|
|
48
|
+
var import_object3 = require("@xylabs/object");
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var import_object2 = require("@xylabs/object");
|
|
52
|
+
var import_module_model2 = require("@xyo-network/module-model");
|
|
53
|
+
|
|
54
|
+
// src/typeChecks.ts
|
|
55
|
+
var import_object = require("@xylabs/object");
|
|
56
|
+
var import_module_model = require("@xyo-network/module-model");
|
|
57
|
+
|
|
58
|
+
// src/Queries/All.ts
|
|
59
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
60
|
+
|
|
61
|
+
// src/Queries/Clear.ts
|
|
62
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
63
|
+
|
|
64
|
+
// src/Queries/Commit.ts
|
|
65
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
66
|
+
|
|
67
|
+
// src/Queries/Delete.ts
|
|
68
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
69
|
+
|
|
70
|
+
// src/Queries/Get.ts
|
|
71
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
72
|
+
|
|
73
|
+
// src/Queries/Insert.ts
|
|
74
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
75
|
+
|
|
76
|
+
// src/Queries/Next.ts
|
|
77
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
78
|
+
|
|
79
|
+
// src/typeChecks.ts
|
|
80
|
+
var isArchivistInstance = new import_module_model.IsInstanceFactory().create({
|
|
81
|
+
get: "function"
|
|
82
|
+
}, [
|
|
83
|
+
import_module_model.isModuleInstance
|
|
84
|
+
]);
|
|
85
|
+
var isArchivistModule = new import_module_model.IsModuleFactory().create([
|
|
86
|
+
ArchivistGetQuerySchema
|
|
87
|
+
]);
|
|
88
|
+
var asArchivistModule = import_object.AsObjectFactory.create(isArchivistModule);
|
|
89
|
+
var asArchivistInstance = import_object.AsObjectFactory.create(isArchivistInstance);
|
|
90
|
+
var withArchivistModule = import_module_model.WithFactory.create(isArchivistModule);
|
|
91
|
+
var withArchivistInstance = import_module_model.WithFactory.create(isArchivistInstance);
|
|
92
|
+
|
|
93
|
+
// src/attachable/isAttachableInstance.ts
|
|
94
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
95
|
+
var factory = new import_object2.IsObjectFactory();
|
|
96
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
97
|
+
isArchivistInstance,
|
|
98
|
+
import_module_model2.isAttachableModuleInstance
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
// src/attachable/asAttachableInstance.ts
|
|
102
|
+
var asAttachableArchivistInstance = import_object3.AsObjectFactory.create(isAttachableArchivistInstance);
|
|
103
|
+
|
|
104
|
+
// src/attachable/AttachableInstance.ts
|
|
105
|
+
var import_object4 = require("@xylabs/object");
|
|
106
|
+
var IsAttachableArchivistInstanceFactory = class extends import_object4.IsObjectFactory {
|
|
107
|
+
static {
|
|
108
|
+
__name(this, "IsAttachableArchivistInstanceFactory");
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/Config.ts
|
|
113
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
114
|
+
|
|
115
|
+
// src/IndexDescription.ts
|
|
116
|
+
var IndexSeparator = "-";
|
|
117
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
118
|
+
const { key, unique } = index;
|
|
119
|
+
const prefix = unique ? "UX" : "IX";
|
|
120
|
+
const indexKeys = Object.keys(key);
|
|
121
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
122
|
+
}, "buildStandardIndexName");
|
|
2
123
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,8BAAAC,EAAA,+BAAAC,EAAA,0BAAAC,EAAA,+BAAAC,EAAA,4BAAAC,EAAA,+BAAAC,EAAA,6BAAAC,EAAA,mBAAAC,EAAA,yCAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,2BAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,iDAAAC,EAAA,0BAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAtB,GCAA,IAAAuB,EAAgC,0BCAhC,IAAAC,EAA4D,0BAC5DC,EAA2C,qCCD3C,IAAAC,EAAgC,0BAChCC,EAAkF,qCCE3E,IAAMC,EAAmD,kCCAzD,IAAMC,EAAuD,oCCA7D,IAAMC,EAAyD,qCCC/D,IAAMC,EAAyD,qCCA/D,IAAMC,EAAmD,kCCDzD,IAAMC,EAAyD,qCCE/D,IAAMC,EAAqD,mCPE3D,IAAMC,EAAsB,IAAIC,oBAAAA,EAAuCC,OAAO,CAAEC,IAAK,UAAW,EAAG,CAACC,mBAAiB,EAC/GC,EAAoB,IAAIC,kBAAAA,EAAmCJ,OAAO,CAACK,EAAwB,EAE3FC,EAAoBC,kBAAgBP,OAAOG,CAAAA,EAC3CK,EAAsBD,kBAAgBP,OAAOF,CAAAA,EAC7CW,EAAsBC,cAAYV,OAAOG,CAAAA,EACzCQ,EAAwBD,cAAYV,OAAOF,CAAAA,EDPjD,IAAMc,EAAgE,CAAC,EAGxEC,EAAU,IAAIC,kBAEPC,EAAwEF,EAAQG,OAAOJ,EAA8C,CAChJK,EACAC,6BACD,EDVM,IAAMC,EAAgCC,kBAAgBC,OAAOC,CAAAA,EUJpE,IAAAC,EAA2C,0BAmBpC,IAAMC,EAAN,cAAwHC,iBAAAA,CAnB/H,MAmB+HA,CAAAA,EAAAA,6CAAoB,ECR5I,IAAMC,EAAwB,+BCoB9B,IAAMC,EAAiB,IAQjBC,EAAyBC,EAACC,GAAAA,CACrC,GAAM,CAAEC,IAAAA,EAAKC,OAAAA,CAAM,EAAKF,EAClBG,EAASD,EAAS,KAAO,KACzBE,EAAYC,OAAOC,KAAKL,CAAAA,EAC9B,MAAO,GAAGE,CAAAA,IAAUC,EAAUG,KAAKV,CAAAA,CAAAA,EACrC,EALsC","names":["src_exports","__export","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistConfigSchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","IndexSeparator","IsAttachableArchivistInstanceFactory","asArchivistInstance","asArchivistModule","asAttachableArchivistInstance","buildStandardIndexName","isArchivistInstance","isArchivistModule","isAttachableArchivistInstance","requiredAttachableArchivistInstanceFunctions","withArchivistInstance","withArchivistModule","__toCommonJS","import_object","import_object","import_module_model","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","__name","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,IAAAA,iBAAgC;;;ACAhC,IAAAC,iBAA4D;AAC5D,IAAAC,uBAA2C;;;ACD3C,oBAAgC;AAChC,0BAAkF;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,sCAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,oCAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,8BAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,8BAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,gCAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,gCAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,+BAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,+BAAgBC,OAAOC,6BAAAA;;;AUJpE,IAAAC,iBAA2C;AAmBpC,IAAMC,uCAAN,cAAwHC,+BAAAA;EAnB/H,OAmB+HA;;;AAAoB;;;ACR5I,IAAMC,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["import_object","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/dist/neutral/index.js
CHANGED
|
@@ -1,2 +1,102 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/attachable/asAttachableInstance.ts
|
|
5
|
+
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
6
|
+
|
|
7
|
+
// src/attachable/isAttachableInstance.ts
|
|
8
|
+
import { IsObjectFactory } from "@xylabs/object";
|
|
9
|
+
import { isAttachableModuleInstance } from "@xyo-network/module-model";
|
|
10
|
+
|
|
11
|
+
// src/typeChecks.ts
|
|
12
|
+
import { AsObjectFactory } from "@xylabs/object";
|
|
13
|
+
import { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from "@xyo-network/module-model";
|
|
14
|
+
|
|
15
|
+
// src/Queries/All.ts
|
|
16
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
17
|
+
|
|
18
|
+
// src/Queries/Clear.ts
|
|
19
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
20
|
+
|
|
21
|
+
// src/Queries/Commit.ts
|
|
22
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
23
|
+
|
|
24
|
+
// src/Queries/Delete.ts
|
|
25
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
26
|
+
|
|
27
|
+
// src/Queries/Get.ts
|
|
28
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
29
|
+
|
|
30
|
+
// src/Queries/Insert.ts
|
|
31
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
32
|
+
|
|
33
|
+
// src/Queries/Next.ts
|
|
34
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
35
|
+
|
|
36
|
+
// src/typeChecks.ts
|
|
37
|
+
var isArchivistInstance = new IsInstanceFactory().create({
|
|
38
|
+
get: "function"
|
|
39
|
+
}, [
|
|
40
|
+
isModuleInstance
|
|
41
|
+
]);
|
|
42
|
+
var isArchivistModule = new IsModuleFactory().create([
|
|
43
|
+
ArchivistGetQuerySchema
|
|
44
|
+
]);
|
|
45
|
+
var asArchivistModule = AsObjectFactory.create(isArchivistModule);
|
|
46
|
+
var asArchivistInstance = AsObjectFactory.create(isArchivistInstance);
|
|
47
|
+
var withArchivistModule = WithFactory.create(isArchivistModule);
|
|
48
|
+
var withArchivistInstance = WithFactory.create(isArchivistInstance);
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
52
|
+
var factory = new IsObjectFactory();
|
|
53
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
54
|
+
isArchivistInstance,
|
|
55
|
+
isAttachableModuleInstance
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// src/attachable/asAttachableInstance.ts
|
|
59
|
+
var asAttachableArchivistInstance = AsObjectFactory2.create(isAttachableArchivistInstance);
|
|
60
|
+
|
|
61
|
+
// src/attachable/AttachableInstance.ts
|
|
62
|
+
import { IsObjectFactory as IsObjectFactory2 } from "@xylabs/object";
|
|
63
|
+
var IsAttachableArchivistInstanceFactory = class extends IsObjectFactory2 {
|
|
64
|
+
static {
|
|
65
|
+
__name(this, "IsAttachableArchivistInstanceFactory");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/Config.ts
|
|
70
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
71
|
+
|
|
72
|
+
// src/IndexDescription.ts
|
|
73
|
+
var IndexSeparator = "-";
|
|
74
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
75
|
+
const { key, unique } = index;
|
|
76
|
+
const prefix = unique ? "UX" : "IX";
|
|
77
|
+
const indexKeys = Object.keys(key);
|
|
78
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
79
|
+
}, "buildStandardIndexName");
|
|
80
|
+
export {
|
|
81
|
+
ArchivistAllQuerySchema,
|
|
82
|
+
ArchivistClearQuerySchema,
|
|
83
|
+
ArchivistCommitQuerySchema,
|
|
84
|
+
ArchivistConfigSchema,
|
|
85
|
+
ArchivistDeleteQuerySchema,
|
|
86
|
+
ArchivistGetQuerySchema,
|
|
87
|
+
ArchivistInsertQuerySchema,
|
|
88
|
+
ArchivistNextQuerySchema,
|
|
89
|
+
IndexSeparator,
|
|
90
|
+
IsAttachableArchivistInstanceFactory,
|
|
91
|
+
asArchivistInstance,
|
|
92
|
+
asArchivistModule,
|
|
93
|
+
asAttachableArchivistInstance,
|
|
94
|
+
buildStandardIndexName,
|
|
95
|
+
isArchivistInstance,
|
|
96
|
+
isArchivistModule,
|
|
97
|
+
isAttachableArchivistInstance,
|
|
98
|
+
requiredAttachableArchivistInstanceFunctions,
|
|
99
|
+
withArchivistInstance,
|
|
100
|
+
withArchivistModule
|
|
101
|
+
};
|
|
2
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAAA,wBAAuB;;;ACAhC,SAASC,uBAAmD;AAC5D,SAASC,kCAAkC;;;ACD3C,SAASC,uBAAuB;AAChC,SAASC,mBAAmBC,iBAAiBC,kBAAkBC,mBAAmB;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,kBAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,gBAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,gBAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,gBAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,YAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,YAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,gBAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,iBAAgBC,OAAOC,6BAAAA;;;AUJpE,SAASC,mBAAAA,wBAAkC;AAmBpC,IAAMC,uCAAN,cAAwHC,iBAAAA;EAnB/H,OAmB+HA;;;AAAoB;;;ACR5I,IAAMC,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["AsObjectFactory","IsObjectFactory","isAttachableModuleInstance","AsObjectFactory","IsInstanceFactory","IsModuleFactory","isModuleInstance","WithFactory","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","IsObjectFactory","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,2 +1,145 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
ArchivistAllQuerySchema: () => ArchivistAllQuerySchema,
|
|
25
|
+
ArchivistClearQuerySchema: () => ArchivistClearQuerySchema,
|
|
26
|
+
ArchivistCommitQuerySchema: () => ArchivistCommitQuerySchema,
|
|
27
|
+
ArchivistConfigSchema: () => ArchivistConfigSchema,
|
|
28
|
+
ArchivistDeleteQuerySchema: () => ArchivistDeleteQuerySchema,
|
|
29
|
+
ArchivistGetQuerySchema: () => ArchivistGetQuerySchema,
|
|
30
|
+
ArchivistInsertQuerySchema: () => ArchivistInsertQuerySchema,
|
|
31
|
+
ArchivistNextQuerySchema: () => ArchivistNextQuerySchema,
|
|
32
|
+
IndexSeparator: () => IndexSeparator,
|
|
33
|
+
IsAttachableArchivistInstanceFactory: () => IsAttachableArchivistInstanceFactory,
|
|
34
|
+
asArchivistInstance: () => asArchivistInstance,
|
|
35
|
+
asArchivistModule: () => asArchivistModule,
|
|
36
|
+
asAttachableArchivistInstance: () => asAttachableArchivistInstance,
|
|
37
|
+
buildStandardIndexName: () => buildStandardIndexName,
|
|
38
|
+
isArchivistInstance: () => isArchivistInstance,
|
|
39
|
+
isArchivistModule: () => isArchivistModule,
|
|
40
|
+
isAttachableArchivistInstance: () => isAttachableArchivistInstance,
|
|
41
|
+
requiredAttachableArchivistInstanceFunctions: () => requiredAttachableArchivistInstanceFunctions,
|
|
42
|
+
withArchivistInstance: () => withArchivistInstance,
|
|
43
|
+
withArchivistModule: () => withArchivistModule
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(src_exports);
|
|
46
|
+
|
|
47
|
+
// src/attachable/asAttachableInstance.ts
|
|
48
|
+
var import_object3 = require("@xylabs/object");
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var import_object2 = require("@xylabs/object");
|
|
52
|
+
var import_module_model2 = require("@xyo-network/module-model");
|
|
53
|
+
|
|
54
|
+
// src/typeChecks.ts
|
|
55
|
+
var import_object = require("@xylabs/object");
|
|
56
|
+
var import_module_model = require("@xyo-network/module-model");
|
|
57
|
+
|
|
58
|
+
// src/Queries/All.ts
|
|
59
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
60
|
+
|
|
61
|
+
// src/Queries/Clear.ts
|
|
62
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
63
|
+
|
|
64
|
+
// src/Queries/Commit.ts
|
|
65
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
66
|
+
|
|
67
|
+
// src/Queries/Delete.ts
|
|
68
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
69
|
+
|
|
70
|
+
// src/Queries/Get.ts
|
|
71
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
72
|
+
|
|
73
|
+
// src/Queries/Insert.ts
|
|
74
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
75
|
+
|
|
76
|
+
// src/Queries/Next.ts
|
|
77
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
78
|
+
|
|
79
|
+
// src/typeChecks.ts
|
|
80
|
+
var isArchivistInstance = new import_module_model.IsInstanceFactory().create({
|
|
81
|
+
get: "function"
|
|
82
|
+
}, [
|
|
83
|
+
import_module_model.isModuleInstance
|
|
84
|
+
]);
|
|
85
|
+
var isArchivistModule = new import_module_model.IsModuleFactory().create([
|
|
86
|
+
ArchivistGetQuerySchema
|
|
87
|
+
]);
|
|
88
|
+
var asArchivistModule = import_object.AsObjectFactory.create(isArchivistModule);
|
|
89
|
+
var asArchivistInstance = import_object.AsObjectFactory.create(isArchivistInstance);
|
|
90
|
+
var withArchivistModule = import_module_model.WithFactory.create(isArchivistModule);
|
|
91
|
+
var withArchivistInstance = import_module_model.WithFactory.create(isArchivistInstance);
|
|
92
|
+
|
|
93
|
+
// src/attachable/isAttachableInstance.ts
|
|
94
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
95
|
+
var factory = new import_object2.IsObjectFactory();
|
|
96
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
97
|
+
isArchivistInstance,
|
|
98
|
+
import_module_model2.isAttachableModuleInstance
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
// src/attachable/asAttachableInstance.ts
|
|
102
|
+
var asAttachableArchivistInstance = import_object3.AsObjectFactory.create(isAttachableArchivistInstance);
|
|
103
|
+
|
|
104
|
+
// src/attachable/AttachableInstance.ts
|
|
105
|
+
var import_object4 = require("@xylabs/object");
|
|
106
|
+
var _IsAttachableArchivistInstanceFactory = class _IsAttachableArchivistInstanceFactory extends import_object4.IsObjectFactory {
|
|
107
|
+
};
|
|
108
|
+
__name(_IsAttachableArchivistInstanceFactory, "IsAttachableArchivistInstanceFactory");
|
|
109
|
+
var IsAttachableArchivistInstanceFactory = _IsAttachableArchivistInstanceFactory;
|
|
110
|
+
|
|
111
|
+
// src/Config.ts
|
|
112
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
113
|
+
|
|
114
|
+
// src/IndexDescription.ts
|
|
115
|
+
var IndexSeparator = "-";
|
|
116
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
117
|
+
const { key, unique } = index;
|
|
118
|
+
const prefix = unique ? "UX" : "IX";
|
|
119
|
+
const indexKeys = Object.keys(key);
|
|
120
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
121
|
+
}, "buildStandardIndexName");
|
|
122
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
+
0 && (module.exports = {
|
|
124
|
+
ArchivistAllQuerySchema,
|
|
125
|
+
ArchivistClearQuerySchema,
|
|
126
|
+
ArchivistCommitQuerySchema,
|
|
127
|
+
ArchivistConfigSchema,
|
|
128
|
+
ArchivistDeleteQuerySchema,
|
|
129
|
+
ArchivistGetQuerySchema,
|
|
130
|
+
ArchivistInsertQuerySchema,
|
|
131
|
+
ArchivistNextQuerySchema,
|
|
132
|
+
IndexSeparator,
|
|
133
|
+
IsAttachableArchivistInstanceFactory,
|
|
134
|
+
asArchivistInstance,
|
|
135
|
+
asArchivistModule,
|
|
136
|
+
asAttachableArchivistInstance,
|
|
137
|
+
buildStandardIndexName,
|
|
138
|
+
isArchivistInstance,
|
|
139
|
+
isArchivistModule,
|
|
140
|
+
isAttachableArchivistInstance,
|
|
141
|
+
requiredAttachableArchivistInstanceFunctions,
|
|
142
|
+
withArchivistInstance,
|
|
143
|
+
withArchivistModule
|
|
144
|
+
});
|
|
2
145
|
//# sourceMappingURL=index.cjs.map
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,8BAAAC,EAAA,+BAAAC,EAAA,0BAAAC,EAAA,+BAAAC,EAAA,4BAAAC,EAAA,+BAAAC,EAAA,6BAAAC,EAAA,mBAAAC,EAAA,yCAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,2BAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,kCAAAC,EAAA,iDAAAC,EAAA,0BAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAtB,GCAA,IAAAuB,EAAgC,0BCAhC,IAAAC,EAA4D,0BAC5DC,EAA2C,qCCD3C,IAAAC,EAAgC,0BAChCC,EAAkF,qCCE3E,IAAMC,EAAmD,kCCAzD,IAAMC,EAAuD,oCCA7D,IAAMC,EAAyD,qCCC/D,IAAMC,EAAyD,qCCA/D,IAAMC,EAAmD,kCCDzD,IAAMC,EAAyD,qCCE/D,IAAMC,EAAqD,mCPE3D,IAAMC,EAAsB,IAAIC,oBAAAA,EAAuCC,OAAO,CAAEC,IAAK,UAAW,EAAG,CAACC,mBAAiB,EAC/GC,EAAoB,IAAIC,kBAAAA,EAAmCJ,OAAO,CAACK,EAAwB,EAE3FC,EAAoBC,kBAAgBP,OAAOG,CAAAA,EAC3CK,EAAsBD,kBAAgBP,OAAOF,CAAAA,EAC7CW,EAAsBC,cAAYV,OAAOG,CAAAA,EACzCQ,EAAwBD,cAAYV,OAAOF,CAAAA,EDPjD,IAAMc,EAAgE,CAAC,EAGxEC,EAAU,IAAIC,kBAEPC,EAAwEF,EAAQG,OAAOJ,EAA8C,CAChJK,EACAC,6BACD,EDVM,IAAMC,EAAgCC,kBAAgBC,OAAOC,CAAAA,EUJpE,IAAAC,EAA2C,0BAmBpC,IAAMC,EAAN,MAAMA,UAAkHC,iBAAAA,CAAoB,EAApBA,EAAAA,EAAAA,wCAAxH,IAAMD,EAANE,ECRA,IAAMC,EAAwB,+BCoB9B,IAAMC,EAAiB,IAQjBC,EAAyBC,EAACC,GAAAA,CACrC,GAAM,CAAEC,IAAAA,EAAKC,OAAAA,CAAM,EAAKF,EAClBG,EAASD,EAAS,KAAO,KACzBE,EAAYC,OAAOC,KAAKL,CAAAA,EAC9B,MAAO,GAAGE,CAAAA,IAAUC,EAAUG,KAAKV,CAAAA,CAAAA,EACrC,EALsC","names":["src_exports","__export","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistConfigSchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","IndexSeparator","IsAttachableArchivistInstanceFactory","asArchivistInstance","asArchivistModule","asAttachableArchivistInstance","buildStandardIndexName","isArchivistInstance","isArchivistModule","isAttachableArchivistInstance","requiredAttachableArchivistInstanceFunctions","withArchivistInstance","withArchivistModule","__toCommonJS","import_object","import_object","import_module_model","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","_IsAttachableArchivistInstanceFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","__name","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["export * from './attachable'\nexport * from './Config'\nexport * from './EventData'\nexport * from './IndexDescription'\nexport * from './Instance'\nexport * from './Module'\nexport * from './NextOptions'\nexport * from './Params'\nexport * from './Queries'\nexport * from './QueryFunctions'\nexport * from './RawQueryFunctions'\nexport * from './typeChecks'\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,IAAAA,iBAAgC;;;ACAhC,IAAAC,iBAA4D;AAC5D,IAAAC,uBAA2C;;;ACD3C,oBAAgC;AAChC,0BAAkF;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,sCAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,oCAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,8BAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,8BAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,gCAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,gCAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,+BAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,+BAAgBC,OAAOC,6BAAAA;;;AUJpE,IAAAC,iBAA2C;AAmBpC,IAAMC,wCAAN,MAAMA,8CAAkHC,+BAAAA;AAAoB;AAApBA;AAAxH,IAAMD,uCAAN;;;ACRA,IAAME,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["import_object","import_object","import_module_model","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","import_object","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,2 +1,101 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/attachable/asAttachableInstance.ts
|
|
5
|
+
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
6
|
+
|
|
7
|
+
// src/attachable/isAttachableInstance.ts
|
|
8
|
+
import { IsObjectFactory } from "@xylabs/object";
|
|
9
|
+
import { isAttachableModuleInstance } from "@xyo-network/module-model";
|
|
10
|
+
|
|
11
|
+
// src/typeChecks.ts
|
|
12
|
+
import { AsObjectFactory } from "@xylabs/object";
|
|
13
|
+
import { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from "@xyo-network/module-model";
|
|
14
|
+
|
|
15
|
+
// src/Queries/All.ts
|
|
16
|
+
var ArchivistAllQuerySchema = "network.xyo.query.archivist.all";
|
|
17
|
+
|
|
18
|
+
// src/Queries/Clear.ts
|
|
19
|
+
var ArchivistClearQuerySchema = "network.xyo.query.archivist.clear";
|
|
20
|
+
|
|
21
|
+
// src/Queries/Commit.ts
|
|
22
|
+
var ArchivistCommitQuerySchema = "network.xyo.query.archivist.commit";
|
|
23
|
+
|
|
24
|
+
// src/Queries/Delete.ts
|
|
25
|
+
var ArchivistDeleteQuerySchema = "network.xyo.query.archivist.delete";
|
|
26
|
+
|
|
27
|
+
// src/Queries/Get.ts
|
|
28
|
+
var ArchivistGetQuerySchema = "network.xyo.query.archivist.get";
|
|
29
|
+
|
|
30
|
+
// src/Queries/Insert.ts
|
|
31
|
+
var ArchivistInsertQuerySchema = "network.xyo.query.archivist.insert";
|
|
32
|
+
|
|
33
|
+
// src/Queries/Next.ts
|
|
34
|
+
var ArchivistNextQuerySchema = "network.xyo.query.archivist.next";
|
|
35
|
+
|
|
36
|
+
// src/typeChecks.ts
|
|
37
|
+
var isArchivistInstance = new IsInstanceFactory().create({
|
|
38
|
+
get: "function"
|
|
39
|
+
}, [
|
|
40
|
+
isModuleInstance
|
|
41
|
+
]);
|
|
42
|
+
var isArchivistModule = new IsModuleFactory().create([
|
|
43
|
+
ArchivistGetQuerySchema
|
|
44
|
+
]);
|
|
45
|
+
var asArchivistModule = AsObjectFactory.create(isArchivistModule);
|
|
46
|
+
var asArchivistInstance = AsObjectFactory.create(isArchivistInstance);
|
|
47
|
+
var withArchivistModule = WithFactory.create(isArchivistModule);
|
|
48
|
+
var withArchivistInstance = WithFactory.create(isArchivistInstance);
|
|
49
|
+
|
|
50
|
+
// src/attachable/isAttachableInstance.ts
|
|
51
|
+
var requiredAttachableArchivistInstanceFunctions = {};
|
|
52
|
+
var factory = new IsObjectFactory();
|
|
53
|
+
var isAttachableArchivistInstance = factory.create(requiredAttachableArchivistInstanceFunctions, [
|
|
54
|
+
isArchivistInstance,
|
|
55
|
+
isAttachableModuleInstance
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// src/attachable/asAttachableInstance.ts
|
|
59
|
+
var asAttachableArchivistInstance = AsObjectFactory2.create(isAttachableArchivistInstance);
|
|
60
|
+
|
|
61
|
+
// src/attachable/AttachableInstance.ts
|
|
62
|
+
import { IsObjectFactory as IsObjectFactory2 } from "@xylabs/object";
|
|
63
|
+
var _IsAttachableArchivistInstanceFactory = class _IsAttachableArchivistInstanceFactory extends IsObjectFactory2 {
|
|
64
|
+
};
|
|
65
|
+
__name(_IsAttachableArchivistInstanceFactory, "IsAttachableArchivistInstanceFactory");
|
|
66
|
+
var IsAttachableArchivistInstanceFactory = _IsAttachableArchivistInstanceFactory;
|
|
67
|
+
|
|
68
|
+
// src/Config.ts
|
|
69
|
+
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
70
|
+
|
|
71
|
+
// src/IndexDescription.ts
|
|
72
|
+
var IndexSeparator = "-";
|
|
73
|
+
var buildStandardIndexName = /* @__PURE__ */ __name((index) => {
|
|
74
|
+
const { key, unique } = index;
|
|
75
|
+
const prefix = unique ? "UX" : "IX";
|
|
76
|
+
const indexKeys = Object.keys(key);
|
|
77
|
+
return `${prefix}_${indexKeys.join(IndexSeparator)}`;
|
|
78
|
+
}, "buildStandardIndexName");
|
|
79
|
+
export {
|
|
80
|
+
ArchivistAllQuerySchema,
|
|
81
|
+
ArchivistClearQuerySchema,
|
|
82
|
+
ArchivistCommitQuerySchema,
|
|
83
|
+
ArchivistConfigSchema,
|
|
84
|
+
ArchivistDeleteQuerySchema,
|
|
85
|
+
ArchivistGetQuerySchema,
|
|
86
|
+
ArchivistInsertQuerySchema,
|
|
87
|
+
ArchivistNextQuerySchema,
|
|
88
|
+
IndexSeparator,
|
|
89
|
+
IsAttachableArchivistInstanceFactory,
|
|
90
|
+
asArchivistInstance,
|
|
91
|
+
asArchivistModule,
|
|
92
|
+
asAttachableArchivistInstance,
|
|
93
|
+
buildStandardIndexName,
|
|
94
|
+
isArchivistInstance,
|
|
95
|
+
isArchivistModule,
|
|
96
|
+
isAttachableArchivistInstance,
|
|
97
|
+
requiredAttachableArchivistInstanceFunctions,
|
|
98
|
+
withArchivistInstance,
|
|
99
|
+
withArchivistModule
|
|
100
|
+
};
|
|
2
101
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":"+EAAA,OAASA,mBAAAA,MAAuB,iBCAhC,OAASC,mBAAAA,MAAmD,iBAC5D,OAASC,8BAAAA,MAAkC,4BCD3C,OAASC,mBAAAA,MAAuB,iBAChC,OAASC,qBAAAA,EAAmBC,mBAAAA,EAAiBC,oBAAAA,EAAkBC,eAAAA,MAAmB,4BCE3E,IAAMC,EAAmD,kCCAzD,IAAMC,EAAuD,oCCA7D,IAAMC,EAAyD,qCCC/D,IAAMC,EAAyD,qCCA/D,IAAMC,EAAmD,kCCDzD,IAAMC,EAAyD,qCCE/D,IAAMC,EAAqD,mCPE3D,IAAMC,EAAsB,IAAIC,EAAAA,EAAuCC,OAAO,CAAEC,IAAK,UAAW,EAAG,CAACC,EAAiB,EAC/GC,EAAoB,IAAIC,EAAAA,EAAmCJ,OAAO,CAACK,EAAwB,EAE3FC,EAAoBC,EAAgBP,OAAOG,CAAAA,EAC3CK,EAAsBD,EAAgBP,OAAOF,CAAAA,EAC7CW,EAAsBC,EAAYV,OAAOG,CAAAA,EACzCQ,EAAwBD,EAAYV,OAAOF,CAAAA,EDPjD,IAAMc,EAAgE,CAAC,EAGxEC,EAAU,IAAIC,EAEPC,EAAwEF,EAAQG,OAAOJ,EAA8C,CAChJK,EACAC,EACD,EDVM,IAAMC,EAAgCC,EAAgBC,OAAOC,CAAAA,EUJpE,OAASC,mBAAAA,MAAkC,iBAmBpC,IAAMC,EAAN,MAAMA,UAAkHC,CAAAA,CAAoB,EAApBA,EAAAA,EAAAA,wCAAxH,IAAMD,EAANE,ECRA,IAAMC,GAAwB,+BCoB9B,IAAMC,EAAiB,IAQjBC,GAAyBC,EAACC,GAAAA,CACrC,GAAM,CAAEC,IAAAA,EAAKC,OAAAA,CAAM,EAAKF,EAClBG,EAASD,EAAS,KAAO,KACzBE,EAAYC,OAAOC,KAAKL,CAAAA,EAC9B,MAAO,GAAGE,CAAAA,IAAUC,EAAUG,KAAKV,CAAAA,CAAAA,EACrC,EALsC","names":["AsObjectFactory","IsObjectFactory","isAttachableModuleInstance","AsObjectFactory","IsInstanceFactory","IsModuleFactory","isModuleInstance","WithFactory","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","IsObjectFactory","IsAttachableArchivistInstanceFactory","IsObjectFactory","_IsAttachableArchivistInstanceFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","__name","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
|
1
|
+
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/object'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks'\nimport { AttachableArchivistInstance } from './AttachableInstance'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport { IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory } from '@xyo-network/module-model'\n\nimport { ArchivistInstance } from './Instance'\nimport { ArchivistModule } from './Module'\nimport { ArchivistGetQuerySchema } from './Queries'\n\nexport const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = new IsModuleFactory<ArchivistModule>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\nexport const ArchivistAllQuerySchema: ArchivistAllQuerySchema = 'network.xyo.query.archivist.all'\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\nexport const ArchivistClearQuerySchema: ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear'\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\nexport const ArchivistCommitQuerySchema: ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit'\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\nexport const ArchivistDeleteQuerySchema: ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete'\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import { Hash } from '@xylabs/hex'\nimport { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\nexport const ArchivistGetQuerySchema: ArchivistGetQuerySchema = 'network.xyo.query.archivist.get'\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\nexport const ArchivistInsertQuerySchema: ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert'\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nimport { ArchivistNextOptions } from '../NextOptions'\n\nexport type ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\nexport const ArchivistNextQuerySchema: ArchivistNextQuerySchema = 'network.xyo.query.archivist.next'\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { AttachableModuleInstance } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ArchivistModuleEventData } from '../EventData'\nimport { ArchivistInstance } from '../Instance'\nimport { ArchivistModule } from '../Module'\nimport { ArchivistParams } from '../Params'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { ModuleConfig } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface ArchivistParents {\n commit?: Address[]\n read?: Address[]\n write?: Address[]\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key:\n | {\n [key: string]: IndexDirection\n }\n | Map<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n"],"mappings":";;;;AAAA,SAASA,mBAAAA,wBAAuB;;;ACAhC,SAASC,uBAAmD;AAC5D,SAASC,kCAAkC;;;ACD3C,SAASC,uBAAuB;AAChC,SAASC,mBAAmBC,iBAAiBC,kBAAkBC,mBAAmB;;;ACE3E,IAAMC,0BAAmD;;;ACAzD,IAAMC,4BAAuD;;;ACA7D,IAAMC,6BAAyD;;;ACC/D,IAAMC,6BAAyD;;;ACA/D,IAAMC,0BAAmD;;;ACDzD,IAAMC,6BAAyD;;;ACE/D,IAAMC,2BAAqD;;;APE3D,IAAMC,sBAAsB,IAAIC,kBAAAA,EAAuCC,OAAO;EAAEC,KAAK;AAAW,GAAG;EAACC;CAAiB;AACrH,IAAMC,oBAAoB,IAAIC,gBAAAA,EAAmCJ,OAAO;EAACK;CAAwB;AAEjG,IAAMC,oBAAoBC,gBAAgBP,OAAOG,iBAAAA;AACjD,IAAMK,sBAAsBD,gBAAgBP,OAAOF,mBAAAA;AACnD,IAAMW,sBAAsBC,YAAYV,OAAOG,iBAAAA;AAC/C,IAAMQ,wBAAwBD,YAAYV,OAAOF,mBAAAA;;;ADPjD,IAAMc,+CAAgE,CAAC;AAG9E,IAAMC,UAAU,IAAIC,gBAAAA;AAEb,IAAMC,gCAAwEF,QAAQG,OAAOJ,8CAA8C;EAChJK;EACAC;CACD;;;ADVM,IAAMC,gCAAgCC,iBAAgBC,OAAOC,6BAAAA;;;AUJpE,SAASC,mBAAAA,wBAAkC;AAmBpC,IAAMC,wCAAN,MAAMA,8CAAkHC,iBAAAA;AAAoB;AAApBA;AAAxH,IAAMD,uCAAN;;;ACRA,IAAME,wBAAwB;;;ACoB9B,IAAMC,iBAAiB;AAQvB,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,QAAM,EAAEC,KAAKC,OAAM,IAAKF;AACxB,QAAMG,SAASD,SAAS,OAAO;AAC/B,QAAME,YAAYC,OAAOC,KAAKL,GAAAA;AAC9B,SAAO,GAAGE,MAAAA,IAAUC,UAAUG,KAAKT,cAAAA,CAAAA;AACrC,GALsC;","names":["AsObjectFactory","IsObjectFactory","isAttachableModuleInstance","AsObjectFactory","IsInstanceFactory","IsModuleFactory","isModuleInstance","WithFactory","ArchivistAllQuerySchema","ArchivistClearQuerySchema","ArchivistCommitQuerySchema","ArchivistDeleteQuerySchema","ArchivistGetQuerySchema","ArchivistInsertQuerySchema","ArchivistNextQuerySchema","isArchivistInstance","IsInstanceFactory","create","get","isModuleInstance","isArchivistModule","IsModuleFactory","ArchivistGetQuerySchema","asArchivistModule","AsObjectFactory","asArchivistInstance","withArchivistModule","WithFactory","withArchivistInstance","requiredAttachableArchivistInstanceFunctions","factory","IsObjectFactory","isAttachableArchivistInstance","create","isArchivistInstance","isAttachableModuleInstance","asAttachableArchivistInstance","AsObjectFactory","create","isAttachableArchivistInstance","IsObjectFactory","IsAttachableArchivistInstanceFactory","IsObjectFactory","ArchivistConfigSchema","IndexSeparator","buildStandardIndexName","index","key","unique","prefix","indexKeys","Object","keys","join"]}
|
package/package.json
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"@xylabs/hex": "^3.5.1",
|
|
14
14
|
"@xylabs/object": "^3.5.1",
|
|
15
15
|
"@xylabs/promise": "^3.5.1",
|
|
16
|
-
"@xyo-network/account-model": "^2.107.
|
|
17
|
-
"@xyo-network/module-events": "~2.107.
|
|
18
|
-
"@xyo-network/module-model": "~2.107.
|
|
19
|
-
"@xyo-network/payload-model": "~2.107.
|
|
16
|
+
"@xyo-network/account-model": "^2.107.4",
|
|
17
|
+
"@xyo-network/module-events": "~2.107.4",
|
|
18
|
+
"@xyo-network/module-model": "~2.107.4",
|
|
19
|
+
"@xyo-network/payload-model": "~2.107.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@xylabs/ts-scripts-yarn3": "^3.11.
|
|
23
|
-
"@xylabs/tsconfig": "^3.11.
|
|
22
|
+
"@xylabs/ts-scripts-yarn3": "^3.11.10",
|
|
23
|
+
"@xylabs/tsconfig": "^3.11.10",
|
|
24
24
|
"typescript": "^5.5.2"
|
|
25
25
|
},
|
|
26
26
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
63
63
|
},
|
|
64
64
|
"sideEffects": false,
|
|
65
|
-
"version": "2.107.
|
|
65
|
+
"version": "2.107.4",
|
|
66
66
|
"type": "module"
|
|
67
67
|
}
|