skedyul 0.2.43 → 0.2.45
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/.build-stamp +1 -1
- package/dist/core/client.d.ts +30 -28
- package/dist/core/client.js +33 -40
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1769392562585
|
package/dist/core/client.d.ts
CHANGED
|
@@ -202,75 +202,76 @@ export declare const instance: {
|
|
|
202
202
|
/**
|
|
203
203
|
* List instances of an internal model.
|
|
204
204
|
*
|
|
205
|
-
*
|
|
206
|
-
* -
|
|
207
|
-
* -
|
|
205
|
+
* The API token determines the context:
|
|
206
|
+
* - sk_wkp_ tokens: scoped to the token's app installation
|
|
207
|
+
* - sk_app_ tokens: searches across ALL installations for the app
|
|
208
208
|
*
|
|
209
209
|
* @example
|
|
210
210
|
* ```ts
|
|
211
|
-
* //
|
|
212
|
-
* const
|
|
213
|
-
*
|
|
214
|
-
* workplace: context.workplace,
|
|
215
|
-
* }
|
|
216
|
-
* const { data, pagination } = await instance.list('compliance_record', ctx, {
|
|
211
|
+
* // List with filters
|
|
212
|
+
* const { data, pagination } = await instance.list('compliance_record', {
|
|
213
|
+
* filter: { status: 'pending' },
|
|
217
214
|
* page: 1,
|
|
218
215
|
* limit: 10,
|
|
219
216
|
* })
|
|
220
217
|
*
|
|
221
|
-
* // Cross-installation search (
|
|
222
|
-
* const { data } = await instance.list('phone_number',
|
|
218
|
+
* // Cross-installation search (with sk_app_ token)
|
|
219
|
+
* const { data } = await instance.list('phone_number', {
|
|
223
220
|
* filter: { phone: '+1234567890' },
|
|
224
221
|
* })
|
|
225
|
-
* if (data.length > 0) {
|
|
226
|
-
* const { appInstallationId } = data[0]
|
|
227
|
-
* const { token: scopedToken } = await token.exchange(appInstallationId)
|
|
228
|
-
* }
|
|
229
222
|
* ```
|
|
230
223
|
*/
|
|
231
|
-
list(modelHandle: string,
|
|
224
|
+
list(modelHandle: string, args?: InstanceListArgs): Promise<InstanceListResult>;
|
|
232
225
|
/**
|
|
233
226
|
* Get a single instance by ID.
|
|
234
227
|
*
|
|
228
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
229
|
+
*
|
|
235
230
|
* @example
|
|
236
231
|
* ```ts
|
|
237
|
-
* const record = await instance.get('
|
|
232
|
+
* const record = await instance.get('phone_number', 'ins_abc123')
|
|
238
233
|
* ```
|
|
239
234
|
*/
|
|
240
|
-
get(
|
|
235
|
+
get(modelHandle: string, id: string): Promise<InstanceData | null>;
|
|
241
236
|
/**
|
|
242
237
|
* Create a new instance of an internal model.
|
|
243
238
|
*
|
|
239
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
240
|
+
*
|
|
244
241
|
* @example
|
|
245
242
|
* ```ts
|
|
246
243
|
* const newRecord = await instance.create('compliance_record', {
|
|
247
244
|
* status: 'pending',
|
|
248
245
|
* document_url: 'https://...',
|
|
249
|
-
* }
|
|
246
|
+
* })
|
|
250
247
|
* ```
|
|
251
248
|
*/
|
|
252
|
-
create(modelHandle: string, data: Record<string, unknown
|
|
249
|
+
create(modelHandle: string, data: Record<string, unknown>): Promise<InstanceData>;
|
|
253
250
|
/**
|
|
254
251
|
* Update an existing instance.
|
|
255
252
|
*
|
|
253
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
254
|
+
*
|
|
256
255
|
* @example
|
|
257
256
|
* ```ts
|
|
258
|
-
* const updated = await instance.update('
|
|
257
|
+
* const updated = await instance.update('compliance_record', 'ins_abc123', {
|
|
259
258
|
* status: 'approved',
|
|
260
259
|
* bundle_sid: 'BU123456',
|
|
261
|
-
* }
|
|
260
|
+
* })
|
|
262
261
|
* ```
|
|
263
262
|
*/
|
|
264
|
-
update(id: string, data: Record<string, unknown
|
|
263
|
+
update(modelHandle: string, id: string, data: Record<string, unknown>): Promise<InstanceData>;
|
|
265
264
|
/**
|
|
266
265
|
* Delete an existing instance.
|
|
267
266
|
*
|
|
267
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
268
|
+
*
|
|
268
269
|
* @example
|
|
269
270
|
* ```ts
|
|
270
|
-
* const { deleted } = await instance.delete('
|
|
271
|
+
* const { deleted } = await instance.delete('phone_number', 'ins_abc123')
|
|
271
272
|
* ```
|
|
272
273
|
*/
|
|
273
|
-
delete(
|
|
274
|
+
delete(modelHandle: string, id: string): Promise<{
|
|
274
275
|
deleted: boolean;
|
|
275
276
|
}>;
|
|
276
277
|
};
|
|
@@ -481,8 +482,9 @@ export declare const resource: {
|
|
|
481
482
|
* This establishes the connection between an app's SHARED model
|
|
482
483
|
* (e.g., 'contact') and a user's actual workplace model (e.g., 'Clients').
|
|
483
484
|
*
|
|
485
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
486
|
+
*
|
|
484
487
|
* @param params - Link parameters
|
|
485
|
-
* @param ctx - Instance context with appInstallationId and workplace
|
|
486
488
|
*
|
|
487
489
|
* @example
|
|
488
490
|
* ```ts
|
|
@@ -491,9 +493,9 @@ export declare const resource: {
|
|
|
491
493
|
* handle: 'contact', // SHARED model handle from provision config
|
|
492
494
|
* targetModelId: modelId, // User's selected model ID
|
|
493
495
|
* channelId: channel.id, // Optional: scope to communication channel
|
|
494
|
-
* }
|
|
496
|
+
* })
|
|
495
497
|
* ```
|
|
496
498
|
*/
|
|
497
|
-
link(params: ResourceLinkParams
|
|
499
|
+
link(params: ResourceLinkParams): Promise<ResourceLinkResult>;
|
|
498
500
|
};
|
|
499
501
|
export {};
|
package/dist/core/client.js
CHANGED
|
@@ -216,37 +216,28 @@ exports.instance = {
|
|
|
216
216
|
/**
|
|
217
217
|
* List instances of an internal model.
|
|
218
218
|
*
|
|
219
|
-
*
|
|
220
|
-
* -
|
|
221
|
-
* -
|
|
219
|
+
* The API token determines the context:
|
|
220
|
+
* - sk_wkp_ tokens: scoped to the token's app installation
|
|
221
|
+
* - sk_app_ tokens: searches across ALL installations for the app
|
|
222
222
|
*
|
|
223
223
|
* @example
|
|
224
224
|
* ```ts
|
|
225
|
-
* //
|
|
226
|
-
* const
|
|
227
|
-
*
|
|
228
|
-
* workplace: context.workplace,
|
|
229
|
-
* }
|
|
230
|
-
* const { data, pagination } = await instance.list('compliance_record', ctx, {
|
|
225
|
+
* // List with filters
|
|
226
|
+
* const { data, pagination } = await instance.list('compliance_record', {
|
|
227
|
+
* filter: { status: 'pending' },
|
|
231
228
|
* page: 1,
|
|
232
229
|
* limit: 10,
|
|
233
230
|
* })
|
|
234
231
|
*
|
|
235
|
-
* // Cross-installation search (
|
|
236
|
-
* const { data } = await instance.list('phone_number',
|
|
232
|
+
* // Cross-installation search (with sk_app_ token)
|
|
233
|
+
* const { data } = await instance.list('phone_number', {
|
|
237
234
|
* filter: { phone: '+1234567890' },
|
|
238
235
|
* })
|
|
239
|
-
* if (data.length > 0) {
|
|
240
|
-
* const { appInstallationId } = data[0]
|
|
241
|
-
* const { token: scopedToken } = await token.exchange(appInstallationId)
|
|
242
|
-
* }
|
|
243
236
|
* ```
|
|
244
237
|
*/
|
|
245
|
-
async list(modelHandle,
|
|
238
|
+
async list(modelHandle, args) {
|
|
246
239
|
const { data, pagination } = await callCore('instance.list', {
|
|
247
240
|
modelHandle,
|
|
248
|
-
...(ctx?.appInstallationId ? { appInstallationId: ctx.appInstallationId } : {}),
|
|
249
|
-
...(ctx?.workplace?.id ? { workplaceId: ctx.workplace.id } : {}),
|
|
250
241
|
...(args?.page !== undefined ? { page: args.page } : {}),
|
|
251
242
|
...(args?.limit !== undefined ? { limit: args.limit } : {}),
|
|
252
243
|
...(args?.filter ? { filter: args.filter } : {}),
|
|
@@ -259,35 +250,36 @@ exports.instance = {
|
|
|
259
250
|
/**
|
|
260
251
|
* Get a single instance by ID.
|
|
261
252
|
*
|
|
253
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
254
|
+
*
|
|
262
255
|
* @example
|
|
263
256
|
* ```ts
|
|
264
|
-
* const record = await instance.get('
|
|
257
|
+
* const record = await instance.get('phone_number', 'ins_abc123')
|
|
265
258
|
* ```
|
|
266
259
|
*/
|
|
267
|
-
async get(
|
|
260
|
+
async get(modelHandle, id) {
|
|
268
261
|
const { data } = await callCore('instance.get', {
|
|
262
|
+
modelHandle,
|
|
269
263
|
id,
|
|
270
|
-
appInstallationId: ctx.appInstallationId,
|
|
271
|
-
workplaceId: ctx.workplace.id,
|
|
272
264
|
});
|
|
273
265
|
return data;
|
|
274
266
|
},
|
|
275
267
|
/**
|
|
276
268
|
* Create a new instance of an internal model.
|
|
277
269
|
*
|
|
270
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
271
|
+
*
|
|
278
272
|
* @example
|
|
279
273
|
* ```ts
|
|
280
274
|
* const newRecord = await instance.create('compliance_record', {
|
|
281
275
|
* status: 'pending',
|
|
282
276
|
* document_url: 'https://...',
|
|
283
|
-
* }
|
|
277
|
+
* })
|
|
284
278
|
* ```
|
|
285
279
|
*/
|
|
286
|
-
async create(modelHandle, data
|
|
280
|
+
async create(modelHandle, data) {
|
|
287
281
|
const { data: instance } = await callCore('instance.create', {
|
|
288
282
|
modelHandle,
|
|
289
|
-
appInstallationId: ctx.appInstallationId,
|
|
290
|
-
workplaceId: ctx.workplace.id,
|
|
291
283
|
data,
|
|
292
284
|
});
|
|
293
285
|
return instance;
|
|
@@ -295,19 +287,20 @@ exports.instance = {
|
|
|
295
287
|
/**
|
|
296
288
|
* Update an existing instance.
|
|
297
289
|
*
|
|
290
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
291
|
+
*
|
|
298
292
|
* @example
|
|
299
293
|
* ```ts
|
|
300
|
-
* const updated = await instance.update('
|
|
294
|
+
* const updated = await instance.update('compliance_record', 'ins_abc123', {
|
|
301
295
|
* status: 'approved',
|
|
302
296
|
* bundle_sid: 'BU123456',
|
|
303
|
-
* }
|
|
297
|
+
* })
|
|
304
298
|
* ```
|
|
305
299
|
*/
|
|
306
|
-
async update(id, data
|
|
300
|
+
async update(modelHandle, id, data) {
|
|
307
301
|
const { data: instance } = await callCore('instance.update', {
|
|
302
|
+
modelHandle,
|
|
308
303
|
id,
|
|
309
|
-
appInstallationId: ctx.appInstallationId,
|
|
310
|
-
workplaceId: ctx.workplace.id,
|
|
311
304
|
data,
|
|
312
305
|
});
|
|
313
306
|
return instance;
|
|
@@ -315,16 +308,17 @@ exports.instance = {
|
|
|
315
308
|
/**
|
|
316
309
|
* Delete an existing instance.
|
|
317
310
|
*
|
|
311
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
312
|
+
*
|
|
318
313
|
* @example
|
|
319
314
|
* ```ts
|
|
320
|
-
* const { deleted } = await instance.delete('
|
|
315
|
+
* const { deleted } = await instance.delete('phone_number', 'ins_abc123')
|
|
321
316
|
* ```
|
|
322
317
|
*/
|
|
323
|
-
async delete(
|
|
318
|
+
async delete(modelHandle, id) {
|
|
324
319
|
const { data } = await callCore('instance.delete', {
|
|
320
|
+
modelHandle,
|
|
325
321
|
id,
|
|
326
|
-
appInstallationId: ctx.appInstallationId,
|
|
327
|
-
workplaceId: ctx.workplace.id,
|
|
328
322
|
});
|
|
329
323
|
return data;
|
|
330
324
|
},
|
|
@@ -493,8 +487,9 @@ exports.resource = {
|
|
|
493
487
|
* This establishes the connection between an app's SHARED model
|
|
494
488
|
* (e.g., 'contact') and a user's actual workplace model (e.g., 'Clients').
|
|
495
489
|
*
|
|
490
|
+
* The API token determines the context (app installation is embedded in sk_wkp_ tokens).
|
|
491
|
+
*
|
|
496
492
|
* @param params - Link parameters
|
|
497
|
-
* @param ctx - Instance context with appInstallationId and workplace
|
|
498
493
|
*
|
|
499
494
|
* @example
|
|
500
495
|
* ```ts
|
|
@@ -503,13 +498,11 @@ exports.resource = {
|
|
|
503
498
|
* handle: 'contact', // SHARED model handle from provision config
|
|
504
499
|
* targetModelId: modelId, // User's selected model ID
|
|
505
500
|
* channelId: channel.id, // Optional: scope to communication channel
|
|
506
|
-
* }
|
|
501
|
+
* })
|
|
507
502
|
* ```
|
|
508
503
|
*/
|
|
509
|
-
async link(params
|
|
504
|
+
async link(params) {
|
|
510
505
|
const { data } = await callCore('resource.link', {
|
|
511
|
-
appInstallationId: ctx.appInstallationId,
|
|
512
|
-
workplaceId: ctx.workplace.id,
|
|
513
506
|
...params,
|
|
514
507
|
});
|
|
515
508
|
return data;
|