@palantir/pack.state.core 0.1.0 → 0.1.1
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/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-transpileBrowser.log +1 -1
- package/.turbo/turbo-transpileCjs.log +1 -1
- package/.turbo/turbo-transpileEsm.log +1 -1
- package/.turbo/turbo-transpileTypes.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +11 -0
- package/build/browser/index.js +25 -0
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +25 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +93 -0
- package/build/esm/index.js +25 -0
- package/build/esm/index.js.map +1 -1
- package/build/types/service/BaseYjsDocumentService.d.ts +6 -0
- package/build/types/service/BaseYjsDocumentService.d.ts.map +1 -1
- package/build/types/types/DocumentRefImpl.d.ts +20 -0
- package/build/types/types/DocumentRefImpl.d.ts.map +1 -1
- package/build/types/types/DocumentService.d.ts +13 -0
- package/build/types/types/DocumentService.d.ts.map +1 -1
- package/build/types/types/RecordCollectionRefImpl.d.ts +23 -0
- package/build/types/types/RecordCollectionRefImpl.d.ts.map +1 -1
- package/build/types/types/RecordRefImpl.d.ts +25 -0
- package/build/types/types/RecordRefImpl.d.ts.map +1 -1
- package/build/types/types/StateModule.d.ts +12 -0
- package/build/types/types/StateModule.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/service/BaseYjsDocumentService.ts +8 -0
- package/src/service/InMemoryDocumentService.ts +30 -0
- package/src/types/DocumentRefImpl.ts +20 -0
- package/src/types/DocumentService.ts +16 -0
- package/src/types/RecordCollectionRefImpl.ts +23 -0
- package/src/types/RecordRefImpl.ts +25 -0
- package/src/types/StateModule.ts +20 -0
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @palantir/pack.state.core
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eba27ae: Fix issues locating model metadata when multiple copies of the schema package are present
|
|
8
|
+
- 67df6e4: Documented public apis
|
|
9
|
+
- Updated dependencies [eba27ae]
|
|
10
|
+
- Updated dependencies [67df6e4]
|
|
11
|
+
- @palantir/pack.document-schema.model-types@0.1.1
|
|
12
|
+
- @palantir/pack.core@0.1.1
|
|
13
|
+
|
|
3
14
|
## 0.1.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/build/browser/index.js
CHANGED
|
@@ -46,6 +46,9 @@ var StateModuleImpl = class {
|
|
|
46
46
|
async createDocument(metadata, schema) {
|
|
47
47
|
return this.documentService.createDocument(metadata, schema);
|
|
48
48
|
}
|
|
49
|
+
async searchDocuments(documentTypeName, schema, options) {
|
|
50
|
+
return this.documentService.searchDocuments(documentTypeName, schema, options);
|
|
51
|
+
}
|
|
49
52
|
async getDocumentSnapshot(docRef) {
|
|
50
53
|
return this.documentService.getDocumentSnapshot(docRef);
|
|
51
54
|
}
|
|
@@ -1250,6 +1253,28 @@ var InMemoryDocumentService = class extends BaseYjsDocumentService {
|
|
|
1250
1253
|
this.getCreateInternalDoc(docRef, metadata, yDoc);
|
|
1251
1254
|
return Promise.resolve(docRef);
|
|
1252
1255
|
};
|
|
1256
|
+
searchDocuments = (documentTypeName, schema, options) => {
|
|
1257
|
+
const results = [];
|
|
1258
|
+
const {
|
|
1259
|
+
documentName,
|
|
1260
|
+
limit
|
|
1261
|
+
} = options ?? {};
|
|
1262
|
+
for (const [docId, internalDoc] of this.documents.entries()) {
|
|
1263
|
+
if (internalDoc.metadata?.documentTypeName === documentTypeName) {
|
|
1264
|
+
if (documentName && !internalDoc.metadata.name.includes(documentName)) {
|
|
1265
|
+
continue;
|
|
1266
|
+
}
|
|
1267
|
+
results.push({
|
|
1268
|
+
...internalDoc.metadata,
|
|
1269
|
+
id: docId
|
|
1270
|
+
});
|
|
1271
|
+
if (limit && results.length >= limit) {
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
return Promise.resolve(results);
|
|
1277
|
+
};
|
|
1253
1278
|
// Lifecycle method implementations
|
|
1254
1279
|
onMetadataSubscriptionOpened(internalDoc, docRef) {
|
|
1255
1280
|
this.updateMetadataStatus(internalDoc, docRef, {
|